10000 Merge branch '2.7' into 2.8 · symfony/symfony@8ca614d · GitHub
[go: up one dir, main page]

Skip to content

Commit 8ca614d

Browse files
Merge branch '2.7' into 2.8
* 2.7: top-level anonymous services must be public
2 parents 7b35ed3 + a53aba3 commit 8ca614d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
315315
if ($services = $this->getChildren($node, 'service')) {
316316
$definitions[$id] = array($services[0], $file, false);
317317
$services[0]->setAttribute('id', $id);
318+
319+
// anonymous services are always private
320+
// we could not use the constant false here, because of XML parsing
321+
$services[0]->setAttribute('public', 'false');
318322
}
319323
}
320324
}
@@ -334,9 +338,6 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
334338
foreach ($definitions as $id => $def) {
335339
list($domElement, $file, $wild) = $def;
336340

337-
// anonymous services are always private
338-
// we could not use the constant false here, because of XML parsing
339-
$domElement->setAttribute('public', 'false');
340341

341342
if (null !== $definition = $this->parseDefinition($domElement, $file)) {
342343
$this->container->setDefinition($id, $definition);

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function testLoadAnonymousServices()
200200
$service = $container->getDefinition($id);
201201
}
202202
$this->assertEquals('BizClass', $service->getClass(), '->load() uses the same configuration as for the anonymous ones');
203-
$this->assertFalse($service->isPublic());
203+
$this->assertTrue($service->isPublic());
204204

205205
// anonymous services are shared when using decoration definitions
206206
$container->compile();

0 commit comments

Comments
 (0)
0