[FrameworkBundle] Show injected services for Iterator and Array

This commit is contained in:
Jan Schädlich 2019-05-01 16:04:30 +02:00
parent 90326e67d5
commit db5fb200ce
2 changed files with 15 additions and 2 deletions

View File

@ -348,12 +348,20 @@ class TextDescriptor extends Descriptor
$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);
}
}
}
}

View File

@ -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
---------------- -----------------------------