Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 284c216

Browse filesBrowse files
bug #31371 [DI] Removes number of elements information in debug mode (jschaedl)
This PR was squashed before being merged into the 3.4 branch (closes #31371). Discussion ---------- [DI] Removes number of elements information in debug mode | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31340 | License | MIT | Doc PR | - With this services config: ```yaml my_service: class: stdClass arguments: [!tagged my_tag] my_tagged_service_1: class: stdClass tags: [my_tag] my_tagged_service_2: class: stdClass tags: [my_tag] ``` Executing `./bin/console debug:container my_service --show-arguments --env=dev` resulted in ```bash Information for Service "my_service" ==================================== ---------------- ------------------------- Option Value ---------------- ------------------------- Service ID my_service Class stdClass Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Iterator (0 element(s)) ---------------- ------------------------- ``` With this fix the output changed to: ```bash Information for Service "my_service" ==================================== ---------------- ------------ Option Value ---------------- ------------ Service ID my_service Class stdClass Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Tagged Iterator for "my_tag" ---------------- ------------ ``` and with `./bin/console debug:container my_service --show-arguments --env=prod` ```bash Information for Service "my_service_tagged_iterator" ==================================================== ---------------- --------------------------------------------- Option Value ---------------- --------------------------------------------- Service ID my_service Class stdClass Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Tagged Iterator for "my_tag" (2 element(s)) ---------------- --------------------------------------------- ``` Commits ------- 0da4b83 [DI] Removes number of elements information in debug mode
2 parents 81b4157 + 0da4b83 commit 284c216
Copy full SHA for 284c216

File tree

Expand file treeCollapse file tree

3 files changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-1
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
137137
$options['show_arguments'] = $input->getOption('show-arguments');
138138
$options['raw_text'] = $input->getOption('raw');
139139
$options['output'] = $io;
140+
$options['is_debug'] = $this->getApplication()->getKernel()->isDebug();
140141
$helper->describe($io, $object, $options);
141142

142143
if (!$input->getArgument('name') && !$input->getOption('tag') && !$input->getOption('parameter') && $input->isInteractive()) {

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\DependencyInjection\Alias;
1818
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1919
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
20+
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
2021
use Symfony\Component\DependencyInjection\ContainerBuilder;
2122
use Symfony\Component\DependencyInjection\Definition;
2223
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -339,7 +340,11 @@ protected function describeContainerDefinition(Definition $definition, array $op
339340
if ($argument instanceof Reference) {
340341
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument);
341342
} elseif ($argument instanceof IteratorArgument) {
342-
$argumentsInformation[] = sprintf('Iterator (%d element(s))', \count($argument->getValues()));
343+
if ($argument instanceof TaggedIteratorArgument) {
344+
$argumentsInformation[] = sprintf('Tagged Iterator for "%s"%s', $argument->getTag(), $options['is_debug'] ? '' : sprintf(' (%d element(s))', \count($argument->getValues())));
345+
} else {
346+
$argumentsInformation[] = sprintf('Iterator (%d element(s))', \count($argument->getValues()));
347+
}
343348
} elseif ($argument instanceof Definition) {
344349
$argumentsInformation[] = 'Inlined Service';
345350
} else {

‎src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ abstract protected function getFormat();
182182

183183
private function assertDescription($expectedDescription, $describedObject, array $options = [])
184184
{
185+
$options['is_debug'] = false;
185186
$options['raw_output'] = true;
186187
$options['raw_text'] = true;
187188
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.