Skip to content

Commit

Permalink
[FrameworkBundle] Show injected services for Iterator and Array
Browse files Browse the repository at this point in the history
  • Loading branch information
jschaedl committed May 5, 2019
1 parent 90326e6 commit db5fb20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Expand Up @@ -348,12 +348,20 @@ protected function describeContainerDefinition(Definition $definition, array $op
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument);
} elseif ($argument instanceof IteratorArgument) {
$argumentsInformation[] = sprintf('Iterator (%d element(s))', \count($argument->getValues()));
foreach (array_map(function (Reference $value) {return (string) $value; }, $argument->getValues()) as $service) {
$argumentsInformation[] = sprintf('- %s', $service);
}
} elseif ($argument instanceof ServiceLocatorArgument) {
$argumentsInformation[] = sprintf('Service locator (%d element(s))', \count($argument->getValues()));
} elseif ($argument instanceof Definition) {
$argumentsInformation[] = 'Inlined Service';
} else {
$argumentsInformation[] = \is_array($argument) ? sprintf('Array (%d element(s))', \count($argument)) : $argument;
if (\is_array($argument)) {
foreach (array_keys($argument) as $service) {
$argumentsInformation[] = sprintf('- %s', $service);
}
}
}
}

Expand Down
Expand Up @@ -17,6 +17,11 @@
 %parameter% 
 Inlined Service 
 Array (3 element(s)) 
 Iterator (2 element(s))
---------------- -----------------------------
 - 0 
 - 1 
 - 2 
 Iterator (2 element(s)) 
 - definition_1 
 - .definition_2
---------------- -----------------------------

0 comments on commit db5fb20

Please sign in to comment.