Skip to content

Commit

Permalink
Reduce common control flows
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Oct 14, 2024
1 parent 0a0eb06 commit 887061a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Dumper/PhpDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1139,16 +1139,15 @@ 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];
}

return $return.$this->dumpValue(new ServiceLocatorArgument($arguments)).$tail;
}

$arguments = [];
foreach ($definition->getArguments() as $i => $value) {
$arguments[] = (\is_string($i) ? $i.': ' : '').$this->dumpValue($value);
}
Expand Down

0 comments on commit 887061a

Please sign in to comment.