8000 Merge branch '2.3' into 2.7 · symfony/symfony@a53aba3 · GitHub
[go: up one dir, main page]

Skip to content

Commit a53aba3

Browse files
Merge branch '2.3' into 2.7
* 2.3: top-level anonymous services must be public Conflicts: src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
2 parents 591fc3a + 9fabd83 commit a53aba3

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
@@ -292,6 +292,10 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
292292
if ($services = $this->getChildren($node, 'service')) {
293293
$definitions[$id] = array($services[0], $file, false);
294294
$services[0]->setAttribute('id', $id);
295+
296+
// anonymous services are always private
297+
// we could not use the constant false here, because of XML parsing
298+
$services[0]->setAttribute('public', 'false');
295299
}
296300
}
297301
}
@@ -311,9 +315,6 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
311315
foreach ($definitions as $id => $def) {
312316
list($domElement, $file, $wild) = $def;
313317

314-
// anonymous services are always private
315-
// we could not use the constant false here, because of XML parsing
316-
$domElement->setAttribute('public', 'false');
317318

318319
if (null !== $definition = $this->parseDefinition($domElement, $file)) {
319320
$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