Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a more helpful hint with the "autowiring services based on the types" deprecation message #22969

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
MetalArend opened this issue May 30, 2017 · 2 comments
Labels
Bug DependencyInjection DX DX = Developer eXperience (anything that improves the experience of using Symfony) Status: Needs Review
Milestone

Comments

@MetalArend
Copy link
Contributor

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3

While first trying to use the new autowiring functionality in 3.3, the following message started popping up:

Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "X" service to "X"

It tells me:

  • to rename (or alias) the "security.token_storage" service to "Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage" instead
  • to rename (or alias) the "form.factory" service to "Symfony\Component\Form\FormFactory" instead

But the actual solution was to replace the TokenStorage and FormFactory typehints in my controller class constructor with TokenStorageInterface and FormFactoryInterface typehints. Would it be helpful to somehow reflect this in the log message in such cases?

@xabbuh xabbuh added Bug DependencyInjection DX DX = Developer eXperience (anything that improves the experience of using Symfony) labels May 30, 2017
@xabbuh xabbuh added this to the 3.3 milestone May 30, 2017
@weaverryan
Copy link
Member

See #22951

@MetalArend
Copy link
Contributor Author

Nice, thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug DependencyInjection DX DX = Developer eXperience (anything that improves the experience of using Symfony) Status: Needs Review
Projects
None yet
Development

No branches or pull requests

4 participants