8000 debug:autowiring doesn't show classes when run without --all · Issue #30493 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

debug:autowiring doesn't show classes when run without --all #30493

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

Closed
disider opened this issue Mar 8, 2019 · 2 comments
Closed

debug:autowiring doesn't show classes when run without --all #30493

disider opened this issue Mar 8, 2019 · 2 comments

Comments

@disider
Copy link
disider commented Mar 8, 2019

Symfony version(s) affected: 4.2.4

Description
When there is an autowirable class, that could be shown via debug:autowiring, an exception should be expected if the '--all' flag is not set and the passed argument doesn't match the alias.

How to reproduce
Create a new project:

  symfony new test
  cd test

Create a simple class Test.php in src. This is autowired.

Executing

  bin/console debug:autowiring Test

it doesn't show the class, nor it returns an exception. This is because, since the service has no alias, there is no text added to the output here: https://github.com/symfony/framework-bundle/blob/master/Command/DebugAutowiringCommand.php#L114

Possible Solutions
Throw an exception in the line above.
Print something that says "There are matching services but without that exact match".
Print the class anyway.

@dbrumann
Copy link
Contributor
dbrumann commented Mar 8, 2019

I can't reproduce the issue. What does the content of the file look like?

➜  issue30493 git:(master) ✗ bin/console debug:autowiring Test --all

Autowirable Types
=================

 The following classes & interfaces can be used as type-hints when autowiring:
 (only showing classes/interfaces matching Test)

 App\Test

edit: I just notice, you mean that bin/console debug:autowiring Test should also show the file. In that case, I can confirm this:

➜  issue30493 git:(master) ✗ bin/console debug:autowiring Test

Autowirable Types
=================

 The following classes & interfaces can be used as type-hints when autowiring:
 (only showing classes/interfaces matching Test)

➜  issue30493 git:(master) ✗

@soufianZantar
Copy link
Contributor

I confirm the bug the command must return exception or the no aliased service.

I suggested to return the aliased and no aliased when adding the search argument and i have added the PR.

nicolas-grekas added a commit that referenced this issue Apr 7, 2019
…open)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] fix search in debug autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://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 | #30493   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Taking #30522 and finishing it with @nicolas-grekas comments.
Is the sentence ok ?

Commits
-------

fec4bea fix debug:autowiringcommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
0