From 887061a0bbb1a4c421f6893d4ef67354c40255b0 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 14 Oct 2024 20:03:05 +0200 Subject: [PATCH] Reduce common control flows --- Dumper/PhpDumper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); }