Merge branch '2.7' into 2.8
* 2.7: top-level anonymous services must be public
This commit is contained in:
commit
8ca614dbc9
@ -315,6 +315,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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,9 +338,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