From db5fb200ce739bd0fa7f2125e87568ac8a4be29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= Date: Wed, 1 May 2019 16:04:30 +0200 Subject: [PATCH] [FrameworkBundle] Show injected services for Iterator and Array --- .../Console/Descriptor/TextDescriptor.php | 8 ++++++++ .../Tests/Fixtures/Descriptor/definition_arguments_1.txt | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index f2040c8e248c..7ea8e39553ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -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); + } + } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt index b73eeedad61d..1551f96f575e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt @@ -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 + ---------------- -----------------------------