Skip to content

Commit 90a7527

Browse files
Merge branch '2.7' into 2.8
* 2.7: (70 commits) [travis] Use container-based infrastructure [HttpKernel] use ConfigCache::getPath() method when it exists [PropertyAccess] Fix setting public property on a class having a magic getter [Routing] Display file which contain deprecated option ContainerInterface: unused exception dropped bumped Symfony version to 2.6.8 updated VERSION for 2.6.7 updated CHANGELOG for 2.6.7 bumped Symfony version to 2.3.29 updated VERSION for 2.3.28 update CONTRIBUTORS for 2.3.28 updated CHANGELOG for 2.3.28 [Debug] Fixed ClassNotFoundFatalErrorHandlerTest [SecurityBundle] use access decision constants in config [SecurityBundle] use session auth constants in config PhpDoc fix in AbstractRememberMeServices [Filesystem] Simplified an if statement [SecurityBundle] Use Enum Nodes Instead Of Scalar [Debug 2.3] Fix test for PHP7 [HttpKernel] Check if "symfony/proxy-manager-bridge" package is installed ... Conflicts: src/Symfony/Bundle/DebugBundle/composer.json src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php src/Symfony/Component/Form/README.md src/Symfony/Component/Intl/README.md src/Symfony/Component/Security/README.md src/Symfony/Component/Translation/Loader/CsvFileLoader.php src/Symfony/Component/Translation/Loader/IniFileLoader.php src/Symfony/Component/Translation/Loader/MoFileLoader.php src/Symfony/Component/Translation/Loader/PhpFileLoader.php src/Symfony/Component/Translation/Loader/PoFileLoader.php src/Symfony/Component/Translation/Loader/YamlFileLoader.php src/Symfony/Component/Translation/README.md src/Symfony/Component/Translation/Translator.php src/Symfony/Component/Validator/README.md
2 parents a489846 + 9d373af commit 90a7527

File tree

9 files changed

+17
-24
lines changed

9 files changed

+17
-24
lines changed

Container.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ class Container implements IntrospectableContainerInterface
8686
public function __construct(ParameterBagInterface $parameterBag = null)
8787
{
8888
$this->parameterBag = $parameterBag ?: new ParameterBag();
89-
90-
$this->set('service_container', $this);
9189
}
9290

9391
/**
@@ -261,7 +259,6 @@ public function has($id)
261259
*
262260
* @return object The associated service
263261
*
264-
* @throws InvalidArgumentException if the service is not defined
265262
* @throws ServiceCircularReferenceException When a circular reference is detected
266263
* @throws ServiceNotFoundException When the service is not defined
267264
* @throws \Exception if an exception has been thrown when the service has been resolved

ContainerBuilder.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
470470
return $service;
471471
}
472472

473-
if (!$this->hasDefinition($id) && isset($this->aliasDefinitions[$id])) {
473+
if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
474474
return $this->get($this->aliasDefinitions[$id]);
475475
}
476476

@@ -684,7 +684,7 @@ public function setAlias($alias, $id)
684684
throw new InvalidArgumentException('$id must be a string, or an Alias object.');
685685
}
686686

687-
if ($alias === strtolower($id)) {
687+
if ($alias === (string) $id) {
688688
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
689689
}
690690

@@ -746,7 +746,7 @@ public function getAlias($id)
746746
{
747747
$id = strtolower($id);
748748

749-
if (!$this->hasAlias($id)) {
749+
if (!isset($this->aliasDefinitions[$id])) {
750750
throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id));
751751
}
752752

@@ -864,7 +864,7 @@ public function getDefinition($id)
864864
{
865865
$id = strtolower($id);
866866

867-
if (!$this->hasDefinition($id)) {
867+
if (!array_key_exists($id, $this->definitions)) {
868868
throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id));
869869
}
870870

@@ -886,8 +886,10 @@ public function getDefinition($id)
886886
*/
887887
public function findDefinition($id)
888888
{
889-
while ($this->hasAlias($id)) {
890-
$id = (string) $this->getAlias($id);
889+
$id = strtolower($id);
890+
891+
while (isset($this->aliasDefinitions[$id])) {
892+
$id = (string) $this->aliasDefinitions[$id];
891893
}
892894

893895
return $this->getDefinition($id);

ContainerInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER);
5050
*
5151
* @return object The associated service
5252
*
53-
* @throws InvalidArgumentException if the service is not defined
5453
* @throws ServiceCircularReferenceException When a circular reference is detected
5554
* @throws ServiceNotFoundException When the service is not defined
5655
*

Dumper/PhpDumper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,6 @@ public function __construct()
904904
\$this->services =
905905
\$this->scopedServices =
906906
\$this->scopeStacks = array();
907-
908-
\$this->set('service_container', \$this);
909-
910907
EOF;
911908

912909
$code .= "\n";

Tests/ContainerBuilderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ public function testAliases()
190190
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
191191
$this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
192192

193+
try {
194+
$builder->setAlias('foobar', 'foobar');
195+
$this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself');
196+
} catch (\InvalidArgumentException $e) {
197+
$this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself');
198+
}
199+
193200
try {
194201
$builder->getAlias('foobar');
195202
$this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist');

Tests/Fixtures/php/services10.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public function __construct()
2929
$this->services =
3030
$this->scopedServices =
3131
$this->scopeStacks = array();
32-
33-
$this->set('service_container', $this);
34-
3532
$this->scopes = array();
3633
$this->scopeChildren = array();
3734
$this->methodMap = array(

Tests/Fixtures/php/services12.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public function __construct()
3333
$this->services =
3434
$this->scopedServices =
3535
$this->scopeStacks = array();
36-
37-
$this->set('service_container', $this);
38-
3936
$this->scopes = array();
4037
$this->scopeChildren = array();
4138
$this->methodMap = array(

Tests/Fixtures/php/services9_compiled.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public function __construct()
2929
$this->services =
3030
$this->scopedServices =
3131
$this->scopeStacks = array();
32-
33-
$this->set('service_container', $this);
34-
3532
$this->scopes = array();
3633
$this->scopeChildren = array();
3734
$this->methodMap = array(

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Symfony DependencyInjection Component",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

0 commit comments

Comments
 (0)