Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] Show injected services for iterator and array arguments#31353
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[FrameworkBundle] Show injected services for iterator and array arguments#31353
Uh oh!
There was an error while loading.Please reload this page.
Conversation
2781480 to21f7c9aComparelinaori commentedMay 1, 2019
Should this be done on 3.4 instead? Currently 3.4 shows 0 instead of X in the iterator. This PR can be seen as a bug fix imo |
nicolas-grekas commentedMay 1, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
We're too lax currently merging features as bug fixes, introducing regressions actually. Let's be a bit stricter, this is for master to me too. |
linaori commentedMay 2, 2019
@nicolas-grekas for the value display, I can agree. The fact that this iterator is showing 0 instead of the actual amount is the initial bug I reported. Perhaps the PR could be split up to put the count fix in 3.4 and the list of services in the master? |
jschaedl commentedMay 2, 2019
@linaori The fact that this iterator is showing 0 in branch @nicolas-grekas Using a compiled container in the DebugContainerCommand was introduced in#27684 I think to fix this |
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
cc3c5d2 todb5fb20Comparefabpot commentedMay 6, 2019
Thank you@jschaedl. |
…and array arguments (jschaedl)This PR was merged into the 4.3-dev branch.Discussion----------[FrameworkBundle] Show injected services for iterator and array arguments| Q | A| ------------- | ---| Branch? | master| Bug fix? |no| New feature? | yes<!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? |no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets |#31340 <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | tbd.When I have the following service configuration:```yaml App\Word\Checker\StaticWordChecker: tags: [app.checker] App\Word\Checker\BannedWorldListChecker: tags: [app.checker] App\Word\WordCheckerTaggedIterator: arguments: [!tagged app.checker] App\Word\WordCheckerArray: arguments: - App\Word\Checker\StaticWordChecker: ~ App\Word\Checker\BannedWorldListChecker: ~```and I run:`./bin/console debug:container App\Word\WordCheckerArray --show-arguments````bashInformation for Service "App\Word\WordCheckerArray"=================================================== ---------------- ------------------------------------------- Option Value ---------------- ------------------------------------------- Service ID App\Word\WordCheckerArray Class App\Word\WordCheckerArray Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Array (2 element(s)) - App\Word\Checker\StaticWordChecker - App\Word\Checker\BannedWorldListChecker ---------------- -------------------------------------------```or`./bin/console debug:container App\Word\WordCheckerTaggedIterator --show-arguments````bashInformation for Service "App\Word\WordCheckerTaggedIterator"============================================================ ---------------- ------------------------------------------- Option Value ---------------- ------------------------------------------- Service ID App\Word\WordCheckerTaggedIterator Class App\Word\WordCheckerTaggedIterator Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Iterator (2 element(s)) - App\Word\Checker\BannedWorldListChecker - App\Word\Checker\StaticWordChecker ---------------- -------------------------------------------```I can now see the the objects injected into the iterator and array arguments.Commits-------db5fb20 [FrameworkBundle] Show injected services for Iterator and Array
| $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); |
nicolas-grekasMay 9, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
I reverted this part in7a53e8d as I don't see how listing keys can be useful.
| }elseif ($argumentinstanceof 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); |
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.
since this is a reference, it should be displayed asService(%s)
fixed in7a53e8d too
When I have the following service configuration:
and I run:
./bin/console debug:container App\Word\WordCheckerArray --show-argumentsor
./bin/console debug:container App\Word\WordCheckerTaggedIterator --show-argumentsI can now see the the objects injected into the iterator and array arguments.