Skip to content

Commit ec1ac29

Browse files
committed
Update to Symfony 3
1 parent b6e1d55 commit ec1ac29

5 files changed

Lines changed: 7 additions & 96 deletions

File tree

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.4.0",
15+
"php": ">=5.5.0",
1616
"nette/di": "^2.3.0",
17-
"symfony/dependency-injection": "^2.8.0"
17+
"symfony/dependency-injection": "^3.0.0"
1818
},
1919
"require-dev": {
20-
"php": ">=5.5.0",
2120
"arachne/bootstrap": "~0.2.1",
2221
"codeception/codeception": "~2.2.0@rc"
2322
},

src/ContainerAdapter.php

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
use Nette\DI\MissingServiceException;
1616
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1717
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
18-
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
19-
use Symfony\Component\DependencyInjection\ScopeInterface;
18+
use Symfony\Component\DependencyInjection\ContainerInterface;
2019

2120
/**
2221
* @author Jáchym Toušek <enumag@gmail.com>
2322
*/
24-
class ContainerAdapter implements IntrospectableContainerInterface
23+
class ContainerAdapter implements ContainerInterface
2524
{
2625
/**
2726
* @var Container
@@ -36,11 +35,8 @@ public function __construct(Container $container)
3635
/**
3736
* {@inheritdoc}
3837
*/
39-
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
38+
public function set($id, $service)
4039
{
41-
if (func_num_args() >= 3) {
42-
throw new NotSupportedException();
43-
}
4440
$this->container->removeService($id);
4541
$this->container->addService($id, $service);
4642
}
@@ -101,29 +97,4 @@ public function setParameter($name, $value)
10197
{
10298
$this->container->parameters[$name] = $value;
10399
}
104-
105-
public function enterScope($name)
106-
{
107-
throw new NotSupportedException();
108-
}
109-
110-
public function leaveScope($name)
111-
{
112-
throw new NotSupportedException();
113-
}
114-
115-
public function addScope(ScopeInterface $scope)
116-
{
117-
throw new NotSupportedException();
118-
}
119-
120-
public function hasScope($name)
121-
{
122-
throw new NotSupportedException();
123-
}
124-
125-
public function isScopeActive($name)
126-
{
127-
throw new NotSupportedException();
128-
}
129100
}

src/DI/ContainerAdapterExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Arachne\ContainerAdapter\DI;
1212

13+
use Arachne\ContainerAdapter\ContainerAdapter;
1314
use Nette\DI\CompilerExtension;
1415

1516
/**
@@ -22,6 +23,6 @@ public function loadConfiguration()
2223
$builder = $this->getContainerBuilder();
2324

2425
$builder->addDefinition($this->prefix('containerAdapter'))
25-
->setClass('Arachne\ContainerAdapter\ContainerAdapter');
26+
->setClass(ContainerAdapter::class);
2627
}
2728
}

src/Exception/NotSupportedException.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/integration/src/ContainerAdapterTest.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44

55
use Arachne\Bootstrap\Configurator;
66
use Arachne\ContainerAdapter\ContainerAdapter;
7-
use Arachne\ContainerAdapter\Exception\NotSupportedException;
87
use Codeception\Test\Unit;
9-
use Codeception\Util\Stub;
108
use DateTime;
119
use IntegrationSuiteGuy;
1210
use Nette\DI\Container;
1311
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1412
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
15-
use Symfony\Component\DependencyInjection\ScopeInterface;
1613

1714
/**
1815
* @author Jáchym Toušek <enumag@gmail.com>
@@ -60,10 +57,6 @@ public function testSet()
6057
$service2 = new DateTime();
6158
$this->containerAdapter->set('date', $service2);
6259
$this->assertSame($service2, $this->containerAdapter->get('date'));
63-
64-
$this->tester->expectException(NotSupportedException::class, function () {
65-
$this->containerAdapter->set('date', new DateTime(), 'scope');
66-
});
6760
}
6861

6962
public function testHas()
@@ -103,41 +96,6 @@ public function testSetParameter()
10396
$this->assertSame('value', $this->containerAdapter->getParameter('nonexistent'));
10497
}
10598

106-
public function testEnterScope()
107-
{
108-
$this->tester->expectException(NotSupportedException::class, function () {
109-
$this->containerAdapter->enterScope('scope');
110-
});
111-
}
112-
113-
public function testLeaveScope()
114-
{
115-
$this->tester->expectException(NotSupportedException::class, function () {
116-
$this->containerAdapter->leaveScope('scope');
117-
}, NotSupportedException::class);
118-
}
119-
120-
public function testAddScope()
121-
{
122-
$this->tester->expectException(NotSupportedException::class, function () {
123-
$this->containerAdapter->addScope(Stub::makeEmpty(ScopeInterface::class));
124-
});
125-
}
126-
127-
public function testHasScope()
128-
{
129-
$this->tester->expectException(NotSupportedException::class, function () {
130-
$this->containerAdapter->hasScope('scope');
131-
});
132-
}
133-
134-
public function testIsScopeActive()
135-
{
136-
$this->tester->expectException(NotSupportedException::class, function () {
137-
$this->containerAdapter->isScopeActive('scope');
138-
});
139-
}
140-
14199
private function createContainer($file)
142100
{
143101
$config = new Configurator();

0 commit comments

Comments
 (0)