Merge branch '2.3' into 2.7
* 2.3: top-level anonymous services must be public Conflicts: src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
This commit is contained in:
commit
a53aba327e
@ -292,6 +292,10 @@ class XmlFileLoader extends FileLoader
|
|||||||
if ($services = $this->getChildren($node, 'service')) {
|
if ($services = $this->getChildren($node, 'service')) {
|
||||||
$definitions[$id] = array($services[0], $file, false);
|
$definitions[$id] = array($services[0], $file, false);
|
||||||
$services[0]->setAttribute('id', $id);
|
$services[0]->setAttribute('id', $id);
|
||||||
|
|
||||||
|
// anonymous services are always private
|
||||||
|
// we could not use the constant false here, because of XML parsing
|
||||||
|
$services[0]->setAttribute('public', 'false');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,9 +315,6 @@ class XmlFileLoader extends FileLoader
|
|||||||
foreach ($definitions as $id => $def) {
|
foreach ($definitions as $id => $def) {
|
||||||
list($domElement, $file, $wild) = $def;
|
list($domElement, $file, $wild) = $def;
|
||||||
|
|
||||||
// anonymous services are always private
|
|
||||||
// we could not use the constant false here, because of XML parsing
|
|
||||||
$domElement->setAttribute('public', 'false');
|
|
||||||
|
|
||||||
if (null !== $definition = $this->parseDefinition($domElement, $file)) {
|
if (null !== $definition = $this->parseDefinition($domElement, $file)) {
|
||||||
$this->container->setDefinition($id, $definition);
|
$this->container->setDefinition($id, $definition);
|
||||||
|
@ -200,7 +200,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$service = $container->getDefinition($id);
|
$service = $container->getDefinition($id);
|
||||||
}
|
}
|
||||||
$this->assertEquals('BizClass', $service->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
$this->assertEquals('BizClass', $service->getClass(), '->load() uses the same configuration as for the anonymous ones');
|
||||||
$this->assertFalse($service->isPublic());
|
$this->assertTrue($service->isPublic());
|
||||||
|
|
||||||
// anonymous services are shared when using decoration definitions
|
// anonymous services are shared when using decoration definitions
|
||||||
$container->compile();
|
$container->compile();
|
||||||
|
Reference in New Issue
Block a user