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:
Nicolas Grekas 2016-05-06 11:19:28 +02:00
commit a53aba327e
2 changed files with 5 additions and 4 deletions

View File

@ -292,6 +292,10 @@ class XmlFileLoader extends FileLoader
if ($services = $this->getChildren($node, 'service')) {
$definitions[$id] = array($services[0], $file, false);
$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) {
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)) {
$this->container->setDefinition($id, $definition);

View File

@ -200,7 +200,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$service = $container->getDefinition($id);
}
$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
$container->compile();