New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DI] Removes number of elements information in debug mode #31371
Conversation
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
Outdated
Show resolved
Hide resolved
249920f
to
7e71b96
Compare
if ($argument instanceof TaggedIteratorArgument) { | ||
$argumentsInformation[] = sprintf('Tagged Iterator for "%s" %s', $argument->getTag(), !$options['is_debug'] ? sprintf('(%d element(s))', \count($argument->getValues())) : ''); | ||
} else { | ||
$argumentsInformation[] = $options['is_debug'] ? 'Iterator' : sprintf('Iterator (%d element(s))', \count($argument->getValues())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We maybe want to be consistent wether we handle the debug or the non-debug case first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
displaying useful info is more important than "consistency" here to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
displaying useful info is more important than "consistency" here to me
@@ -337,9 +338,13 @@ protected function describeContainerDefinition(Definition $definition, array $op | |||
$argument = $argument->getValues()[0]; | |||
} | |||
if ($argument instanceof Reference) { | |||
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument); | |||
$argumentsInformation[] = sprintf('Service (%s)', (string) $argument); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unrelated and should be reverted - it can break scripts that parse the output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully, such script should use the json or XML output, but yes, I still vote for reverting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
if ($argument instanceof TaggedIteratorArgument) { | ||
$argumentsInformation[] = sprintf('Tagged Iterator for "%s"%s', $argument->getTag(), $options['is_debug'] ? '': sprintf(' (%d element(s))', \count($argument->getValues()))); | ||
} else { | ||
$argumentsInformation[] = sprintf('Iterator%s', $options['is_debug'] ? '' : sprintf(' (%d element(s))', \count($argument->getValues()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need the ternary on this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right we don't need the ternary. The array of services given for the Iterator is always filled. Will revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful when merging this to master due to #31353.
The is_debug option to the can be remove again I guess.
fb53604
to
0da4b83
Compare
Thank you @jschaedl. |
…(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
With this services config:
Executing
./bin/console debug:container my_service --show-arguments --env=dev
resulted inWith this fix the output changed to:
and with
./bin/console debug:container my_service --show-arguments --env=prod