diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
index c8123c4619254..764bd22a1b347 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
@@ -40,10 +40,6 @@
-
-
-
-
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index 084198df319ac..6dd5110d2ee37 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\DependencyInjection;
+use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Component\DependencyInjection\Argument\ClosureProxyArgument;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
@@ -38,6 +39,7 @@
use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator;
use Symfony\Component\DependencyInjection\LazyProxy\InheritanceProxyHelper;
use Symfony\Component\DependencyInjection\LazyProxy\InheritanceProxyInterface;
+use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
@@ -117,6 +119,16 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*/
private $vendors;
+ public function __construct(ParameterBagInterface $parameterBag = null)
+ {
+ parent::__construct($parameterBag);
+
+ $this->setDefinition('service_container', (new Definition(ContainerInterface::class))->setSynthetic(true));
+ $this->setAlias(PsrContainerInterface::class, new Alias('service_container', false));
+ $this->setAlias(ContainerInterface::class, new Alias('service_container', false));
+ $this->setAlias(Container::class, new Alias('service_container', false));
+ }
+
/**
* Sets the track resources flag.
*
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index b85cf691f4545..d460d4cc62c4b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -15,6 +15,7 @@
require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
use PHPUnit\Framework\TestCase;
+use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Component\Config\Resource\ComposerResource;
use Symfony\Component\Config\Resource\ResourceInterface;
use Symfony\Component\Config\Resource\DirectoryResource;
@@ -25,6 +26,7 @@
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
+use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
@@ -42,6 +44,22 @@
class ContainerBuilderTest extends TestCase
{
+ public function testDefaultRegisteredDefinitions()
+ {
+ $builder = new ContainerBuilder();
+
+ $this->assertCount(1, $builder->getDefinitions());
+ $this->assertTrue($builder->hasDefinition('service_container'));
+
+ $definition = $builder->getDefinition('service_container');
+ $this->assertInstanceOf(Definition::class, $definition);
+ $this->assertTrue($definition->isSynthetic());
+ $this->assertSame(ContainerInterface::class, $definition->getClass());
+ $this->assertTrue($builder->hasAlias(PsrContainerInterface::class));
+ $this->assertTrue($builder->hasAlias(ContainerInterface::class));
+ $this->assertTrue($builder->hasAlias(Container::class));
+ }
+
public function testDefinitions()
{
$builder = new ContainerBuilder();
@@ -203,7 +221,18 @@ public function testGetServiceIds()
$builder->register('foo', 'stdClass');
$builder->bar = $bar = new \stdClass();
$builder->register('bar', 'stdClass');
- $this->assertEquals(array('foo', 'bar', 'service_container'), $builder->getServiceIds(), '->getServiceIds() returns all defined service ids');
+ $this->assertEquals(
+ array(
+ 'service_container',
+ 'foo',
+ 'bar',
+ 'Psr\Container\ContainerInterface',
+ 'Symfony\Component\DependencyInjection\ContainerInterface',
+ 'Symfony\Component\DependencyInjection\Container',
+ ),
+ $builder->getServiceIds(),
+ '->getServiceIds() returns all defined service ids'
+ );
}
public function testAliases()
@@ -251,7 +280,7 @@ public function testGetAliases()
$builder->set('foobar', 'stdClass');
$builder->set('moo', 'stdClass');
- $this->assertCount(0, $builder->getAliases(), '->getAliases() does not return aliased services that have been overridden');
+ $this->assertCount(3, $builder->getAliases(), '->getAliases() does not return aliased services that have been overridden');
}
public function testSetAliases()
@@ -538,7 +567,7 @@ public function testMerge()
$config->setDefinition('baz', new Definition('BazClass'));
$config->setAlias('alias_for_foo', 'foo');
$container->merge($config);
- $this->assertEquals(array('foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones');
+ $this->assertEquals(array('service_container', 'foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones');
$aliases = $container->getAliases();
$this->assertTrue(isset($aliases['alias_for_foo']));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
index 924f2d99ddf9f..50ea8c384ccad 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
@@ -70,6 +70,7 @@ public function testDumpAnonymousServices()
$this->assertEquals('
+
@@ -79,6 +80,9 @@ public function testDumpAnonymousServices()
+
+
+
', $dumper->dump());
@@ -91,10 +95,14 @@ public function testDumpEntities()
$this->assertEquals("
+
foo<>&bar
+
+
+
", $dumper->dump());
@@ -117,14 +125,22 @@ public function provideDecoratedServicesData()
array("
+
+
+
+
", include $fixturesPath.'/containers/container15.php'),
array("
+
+
+
+
", include $fixturesPath.'/containers/container16.php'),
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot
index 1bb7c30b8c702..b7fe815b791bd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot
@@ -3,5 +3,5 @@ digraph sc {
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
- node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
+ node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Container)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot
index 0e578b161b8f5..d748265cc3a13 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot
@@ -3,8 +3,8 @@ digraph sc {
node [fontsize="13" fontname="Verdana" shape="square"];
edge [fontsize="12" fontname="Verdana" color="white" arrowhead="closed" arrowsize="1"];
+ node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Container)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=square, fillcolor="grey", style="filled"];
node_foo [label="foo\nFooClass\n", shape=square, fillcolor="grey", style="filled"];
- node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=square, fillcolor="green", style="empty"];
node_bar [label="bar\n\n", shape=square, fillcolor="red", style="empty"];
node_foo -> node_bar [label="" style="filled"];
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot
index f17857fe428ef..0320d7da8317d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot
@@ -3,8 +3,8 @@ digraph sc {
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
+ node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Container)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
- node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
node_bar [label="bar\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foo -> node_bar [label="" style="filled"];
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot
index bc7f81317e50a..fffe8f1b54743 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot
@@ -3,8 +3,8 @@ digraph sc {
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
+ node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_bar [label="bar\nBarClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
- node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
node_foo -> node_bar [label="" style="filled"];
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot
index d07dc389e0b2e..b7fe815b791bd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot
@@ -3,5 +3,5 @@ digraph sc {
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
- node_service_container [label="service_container\nContainer14\\ProjectServiceContainer\n", shape=record, fillcolor="#9999ff", style="filled"];
+ node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Container)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot
index a6d04bf5a097f..aade43a799797 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot
@@ -3,6 +3,6 @@ digraph sc {
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
+ node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Container)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo\n%foo.class%\n", shape=record, fillcolor="#eeeeee", style="filled"];
- node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
index f62f7a2312d8a..2c84476b7b575 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
@@ -3,6 +3,7 @@ digraph sc {
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
+ node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Container)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo (alias_for_foo)\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo_baz [label="foo.baz\nBazClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_bar [label="bar\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
@@ -30,7 +31,6 @@ digraph sc {
node_lazy_context_ignore_invalid_ref [label="lazy_context_ignore_invalid_ref\nLazyContext\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_closure_proxy [label="closure_proxy\nBarClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_service_locator [label="service_locator\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
- node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
node_foo2 [label="foo2\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foo3 [label="foo3\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foobaz [label="foobaz\n\n", shape=record, fillcolor="#ff9999", style="filled"];
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
index fbaff884fad37..2c6e65b3e7c47 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
@@ -29,6 +29,11 @@ class Container extends AbstractContainer
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->aliases = array();
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
index 644350a059fed..d85d8936dbe8a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->aliases = array();
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
index d6b407466721f..b6118a84a38fd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
@@ -30,6 +30,11 @@ public function __construct()
$this->parameters = $this->getDefaultParameters();
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'test' => 'getTestService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
index 0d1c526a795d4..973f8cd54ae8b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
@@ -34,6 +34,11 @@ public function __construct()
$this->parameters = $this->getDefaultParameters();
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'test' => 'getTestService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php
index c72e62e022535..2710f9b12d8ab 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'bar' => 'getBarService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
index b906f3c9f2173..9e5ff196334c6 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService',
'service_with_method_call_and_factory' => 'getServiceWithMethodCallAndFactoryService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php
index cefb180b9ab3a..db4b6defb3d36 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'foo' => 'getFooService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php
index 02c0257e515e5..dc46680572064 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php
@@ -30,6 +30,11 @@ public function __construct()
$this->parameters = $this->getDefaultParameters();
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'test' => 'getTestService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php
index bc2b2e302b639..cc4dccff8f072 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php
@@ -28,6 +28,11 @@ class Symfony_DI_PhpDumper_Test_Overriden_Getters extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'baz' => 'getBazService',
'foo' => 'getFooService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php
index ae8a1d72de8c6..e957125e64576 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'bar' => 'getBarService',
'foo' => 'getFooService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php
index 442c319e27b21..9a06d55f904de 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'bar' => 'getBarService',
'foo' => 'getFooService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php
index be3a7d684a36d..3eebf9508130f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php
@@ -29,6 +29,9 @@ public function __construct()
{
$this->services = array();
$this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
'symfony\\component\\dependencyinjection\\tests\\fixtures\\container33\\foo' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Container33\\Foo',
);
$this->methodMap = array(
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
index 40c83315f8d89..0127399ff1cd5 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
@@ -30,6 +30,11 @@ public function __construct()
$this->parameters = $this->getDefaultParameters();
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->aliases = array();
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
index 5126c5d6e687e..93fe0e5939fc1 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
@@ -28,6 +28,11 @@ class ProjectServiceContainer extends Container
public function __construct()
{
parent::__construct(new ParameterBag($this->getDefaultParameters()));
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'bar' => 'getBarService',
'baz' => 'getBazService',
@@ -64,6 +69,9 @@ public function __construct()
'new_factory' => true,
);
$this->aliases = array(
+ 'Psr\\Container\\ContainerInterface' => 'service_container',
+ 'Symfony\\Component\\DependencyInjection\\Container' => 'service_container',
+ 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => 'service_container',
'alias_for_alias' => 'foo',
'alias_for_foo' => 'foo',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
index 1fc6b8cea41f5..8c6d8a95355be 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
@@ -30,6 +30,11 @@ public function __construct()
$this->parameters = $this->getDefaultParameters();
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'bar' => 'getBarService',
'baz' => 'getBazService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php
index b2acbe01c970a..4329d9fdcdda0 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php
@@ -28,6 +28,11 @@ class Symfony_DI_PhpDumper_Test_Overriden_Getters_With_Constructor extends Conta
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'baz' => 'getBazService',
'foo' => 'getFooService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator_argument.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator_argument.php
index f7dd34fecf9a1..9859d372bd232 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator_argument.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator_argument.php
@@ -28,6 +28,11 @@ class Symfony_DI_PhpDumper_Test_Locator_Argument_Provide_Service_Locator extends
public function __construct()
{
$this->services = array();
+ $this->normalizedIds = array(
+ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
+ 'symfony\\component\\dependencyinjection\\container' => 'Symfony\\Component\\DependencyInjection\\Container',
+ 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
+ );
$this->methodMap = array(
'lazy_context' => 'getLazyContextService',
'lazy_referenced' => 'getLazyReferencedService',
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml
index 6aa5732f9afc7..a2a601b6e94e7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml
@@ -1,2 +1,9 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services21.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services21.xml
index 329bc3d72a25a..fc7d4a820ab52 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services21.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services21.xml
@@ -1,6 +1,7 @@
+
@@ -17,5 +18,8 @@
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services24.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services24.xml
index 9f01ead06783d..b8df053814b2b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services24.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services24.xml
@@ -1,6 +1,10 @@
+
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml
index b17e50043cd1b..bd6237f942d3d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml
@@ -19,4 +19,10 @@
null
+
+
+
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
index 001a91ecd775d..fee5a138ce1d7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
@@ -6,6 +6,7 @@
bar
+
@@ -143,6 +144,9 @@
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml
index 8b137891791fe..94ab237f3289b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml
@@ -1 +1,13 @@
-
+services:
+ service_container:
+ class: Symfony\Component\DependencyInjection\ContainerInterface
+ synthetic: true
+ Psr\Container\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\Container:
+ alias: service_container
+ public: false
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services24.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services24.yml
index 174bee32f8809..cf740d61b68db 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services24.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services24.yml
@@ -1,5 +1,17 @@
services:
+ service_container:
+ class: Symfony\Component\DependencyInjection\ContainerInterface
+ synthetic: true
foo:
class: Foo
autowire: true
+ Psr\Container\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\Container:
+ alias: service_container
+ public: false
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml
index a1fb59035855e..d2e1943bf0a65 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml
@@ -5,3 +5,16 @@ parameters:
escape: '@@escapeme'
values: [true, false, null, 0, 1000.3, 'true', 'false', 'null']
+services:
+ service_container:
+ class: Symfony\Component\DependencyInjection\ContainerInterface
+ synthetic: true
+ Psr\Container\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\Container:
+ alias: service_container
+ public: false
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
index 2f0c363ff4275..e7dcd28b6ab71 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
@@ -4,6 +4,9 @@ parameters:
foo: bar
services:
+ service_container:
+ class: Symfony\Component\DependencyInjection\ContainerInterface
+ synthetic: true
foo:
class: Bar\FooClass
tags:
@@ -121,3 +124,12 @@ services:
service_locator:
class: Bar
arguments: [!service_locator { bar: '@bar', invalid: '@?invalid', container: '@service_container' }]
+ Psr\Container\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\ContainerInterface:
+ alias: service_container
+ public: false
+ Symfony\Component\DependencyInjection\Container:
+ alias: service_container
+ public: false
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index 03391c938e614..118d6a9d87356 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -185,7 +185,7 @@ public function testLoadAnonymousServices()
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('services5.xml');
$services = $container->getDefinitions();
- $this->assertCount(6, $services, '->load() attributes unique ids to anonymous services');
+ $this->assertCount(7, $services, '->load() attributes unique ids to anonymous services');
// anonymous service as an argument
$args = $services['foo']->getArguments();
@@ -485,11 +485,11 @@ public function testNoNamingConflictsForAnonymousServices()
$loader1 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension1'));
$loader1->load('services.xml');
$services = $container->getDefinitions();
- $this->assertCount(2, $services, '->load() attributes unique ids to anonymous services');
+ $this->assertCount(3, $services, '->load() attributes unique ids to anonymous services');
$loader2 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension2'));
$loader2->load('services.xml');
$services = $container->getDefinitions();
- $this->assertCount(4, $services, '->load() attributes unique ids to anonymous services');
+ $this->assertCount(5, $services, '->load() attributes unique ids to anonymous services');
$services = $container->getDefinitions();
$args1 = $services['extension1.foo']->getArguments();
@@ -632,7 +632,7 @@ public function testPrototype()
$ids = array_keys($container->getDefinitions());
sort($ids);
- $this->assertSame(array(Prototype\Foo::class, Prototype\Sub\Bar::class), $ids);
+ $this->assertSame(array(Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'), $ids);
$resources = $container->getResources();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index fa734e75ecbc9..f73eca0111eed 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -397,7 +397,7 @@ public function testPrototype()
$ids = array_keys($container->getDefinitions());
sort($ids);
- $this->assertSame(array(Prototype\Foo::class, Prototype\Sub\Bar::class), $ids);
+ $this->assertSame(array(Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'), $ids);
$resources = $container->getResources();