Skip to content

Commit

Permalink
Merge branch '2.3' into 2.7
Browse files Browse the repository at this point in the history
* 2.3:
  top-level anonymous services must be public

Conflicts:
	src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
  • Loading branch information
nicolas-grekas committed May 6, 2016
2 parents 591fc3a + 9fabd83 commit a53aba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -292,6 +292,10 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
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');
}
}
}
Expand All @@ -311,9 +315,6 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
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);
Expand Down
Expand Up @@ -200,7 +200,7 @@ public function testLoadAnonymousServices()
$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();
Expand Down

0 comments on commit a53aba3

Please sign in to comment.