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
[DX] Make debugging typos in tags easier #11511
Comments
Validation in core is easy and would catch errors for attributes. Logging is also a good idea (probably with an error level). |
It might be possible to track any tags that are defined, but never queried during the building phase of the container, and list those in a profiler panel? |
An opt-in option in configuration might make it possible to add it in a "no-BC break" manner? |
👍 for the opt-in.
|
I think this could be integrated into symfony http://github.com/matthiasnoback/symfony-service-definition-validator since that already does a lot of checks, this could also be added there? |
This PR was merged into the 2.8 branch. Discussion ---------- added logging of unused tags | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #11511, #11744 | License | MIT | Doc PR | - This is the same as #11744 but with some minor tweaks and some unit tests for the compiler pass. Commits ------- 95c9f50 added some tests d3271e1 missing tags in whitelist f51fe4a [FrameworkBundle] [DependencyInjection] added logging of unused tags during container compilation
If you are in #symfony on IRC, you can see that at least 10 issues a day are caused by a simple typo. For some places, like
_controller
, console commands and bundles, exceptions reported by the framework make it very easy to discover these typos.However, the DependencyInjection tags are one big vague story when you're talking about typos. That's because:
name: kenrel.event_listener
, you get no indication that it is wrong.evnt: kernel.request
, you get no exception.How can we fix this in a BC way?
Let's discuss that in this issue. A very first shot I think of: You can't. But what we can do is adding validation for the attributes in the compiler passes of the core and also advertising this to other 3th party bundle developers.
Another solution might be to log on the DEBUG level if a tag isn't used in the container during the request. That would help too.
How can we fix this in 3.0
I also think we have to find a fix for this in a non-BC manner. How can we officially integrate better support for tags in the container? Or don't we want to do that?
The text was updated successfully, but these errors were encountered: