diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index e4df83390b69..5ee28ec23ca8 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -229,27 +229,25 @@ private function processAnonymousServices(SimpleXMLElement $xml, $file) $count = 0; // anonymous services as arguments - if (false === $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]')) { - return; - } - foreach ($nodes as $node) { - // give it a unique name - $node['id'] = sprintf('%s_%d', md5($file), ++$count); + if (false !== $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]')) { + foreach ($nodes as $node) { + // give it a unique name + $node['id'] = sprintf('%s_%d', md5($file), ++$count); - $definitions[(string) $node['id']] = array($node->service, $file, false); - $node->service['id'] = (string) $node['id']; + $definitions[(string) $node['id']] = array($node->service, $file, false); + $node->service['id'] = (string) $node['id']; + } } // anonymous services "in the wild" - if (false === $nodes = $xml->xpath('//container:services/container:service[not(@id)]')) { - return; - } - foreach ($nodes as $node) { - // give it a unique name - $node['id'] = sprintf('%s_%d', md5($file), ++$count); + if (false !== $nodes = $xml->xpath('//container:services/container:service[not(@id)]')) { + foreach ($nodes as $node) { + // give it a unique name + $node['id'] = sprintf('%s_%d', md5($file), ++$count); - $definitions[(string) $node['id']] = array($node, $file, true); - $node->service['id'] = (string) $node['id']; + $definitions[(string) $node['id']] = array($node, $file, true); + $node->service['id'] = (string) $node['id']; + } } // resolve definitions