minor #21354 [DependencyInjection] XML: optimize defaults parsing (dunglas)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[DependencyInjection] XML: optimize defaults parsing

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Defaults can be parsed only 1 time.

Commits
-------

dc115ab91b [DependencyInjection] XML: optimize defaults parsing
This commit is contained in:
Fabien Potencier 2017-01-20 07:02:14 -08:00
commit a81fc03d67

View File

@ -125,8 +125,9 @@ class XmlFileLoader extends FileLoader
return;
}
$defaults = $this->getServiceDefaults($xml, $file);
foreach ($services as $service) {
if (null !== $definition = $this->parseDefinition($service, $file, $this->getServiceDefaults($xml, $file))) {
if (null !== $definition = $this->parseDefinition($service, $file, $defaults)) {
$this->container->setDefinition((string) $service->getAttribute('id'), $definition);
}
}