Skip to content

Commit

Permalink
bug #18709 [DependencyInjection] top-level anonymous services must be…
Browse files Browse the repository at this point in the history
… public (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] top-level anonymous services must be public

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18703
| License       | MIT
| Doc PR        |

Commits
-------

13a47c3 top-level anonymous services must be public
  • Loading branch information
nicolas-grekas committed May 6, 2016
2 parents af4ca4f + 13a47c3 commit 9fabd83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -237,6 +237,9 @@ private function processAnonymousServices(SimpleXMLElement $xml, $file)

$definitions[(string) $node['id']] = array($node->service, $file, false);
$node->service['id'] = (string) $node['id'];

// anonymous services are always private
$node->service['public'] = false;
}
}

Expand All @@ -254,9 +257,6 @@ private function processAnonymousServices(SimpleXMLElement $xml, $file)
// resolve definitions
krsort($definitions);
foreach ($definitions as $id => $def) {
// anonymous services are always private
$def[0]['public'] = false;

$this->parseDefinition($id, $def[0], $def[1]);

$oNode = dom_import_simplexml($def[0]);
Expand Down
Expand Up @@ -158,7 +158,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 9fabd83

Please sign in to comment.