Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2781480

Browse files
committed
[FrameworkBundle] Show injected services for Iterator and Array
1 parent 90326e6 commit 2781480

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,23 @@ protected function describeContainerDefinition(Definition $definition, array $op
345345
$argument = $argument->getValues()[0];
346346
}
347347
if ($argument instanceof Reference) {
348-
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument);
348+
$argumentsInformation[] = sprintf('Service (%s)', (string) $argument);
349349
} elseif ($argument instanceof IteratorArgument) {
350350
$argumentsInformation[] = sprintf('Iterator (%d element(s))', \count($argument->getValues()));
351+
foreach(array_map(function (Reference $value) {return (string)$value;}, $argument->getValues()) as $service) {
352+
$argumentsInformation[] = sprintf('- %s', $service);
353+
}
351354
} elseif ($argument instanceof ServiceLocatorArgument) {
352355
$argumentsInformation[] = sprintf('Service locator (%d element(s))', \count($argument->getValues()));
353356
} elseif ($argument instanceof Definition) {
354357
$argumentsInformation[] = 'Inlined Service';
355358
} else {
356359
$argumentsInformation[] = \is_array($argument) ? sprintf('Array (%d element(s))', \count($argument)) : $argument;
360+
if (\is_array($argument)) {
361+
foreach (array_keys($argument) as $service) {
362+
$argumentsInformation[] = sprintf('- %s', $service);
363+
}
364+
}
357365
}
358366
}
359367

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
Autoconfigured no
1414
Factory Class Full\Qualified\FactoryClass
1515
Factory Method get
16-
 Arguments Service(.definition_2) 
16+
 Arguments Service (.definition_2) 
1717
 %parameter% 
1818
 Inlined Service 
1919
 Array (3 element(s)) 
20-
 Iterator (2 element(s))
21-
---------------- -----------------------------
20+
 - 0 
21+
 - 1 
22+
 - 2 
23+
 Iterator (2 element(s)) 
24+
 - definition_1 
25+
 - .definition_2
26+
---------------- -----------------------------
2227

0 commit comments

Comments
 (0)