diff --git a/Dumper/PhpDumper.php b/Dumper/PhpDumper.php index 2cab09e01..37793a1ee 100644 --- a/Dumper/PhpDumper.php +++ b/Dumper/PhpDumper.php @@ -1139,8 +1139,8 @@ private function addNewInstance(Definition $definition, string $return = '', ?st { $tail = $return ? str_repeat(')', substr_count($return, '(') - substr_count($return, ')')).";\n" : ''; + $arguments = []; if (BaseServiceLocator::class === $definition->getClass() && $definition->hasTag($this->serviceLocatorTag)) { - $arguments = []; foreach ($definition->getArgument(0) as $k => $argument) { $arguments[$k] = $argument->getValues()[0]; } @@ -1148,7 +1148,6 @@ private function addNewInstance(Definition $definition, string $return = '', ?st return $return.$this->dumpValue(new ServiceLocatorArgument($arguments)).$tail; } - $arguments = []; foreach ($definition->getArguments() as $i => $value) { $arguments[] = (\is_string($i) ? $i.': ' : '').$this->dumpValue($value); }