Skip to content

[DX] Make debugging typos in tags easier #11511

Closed
@wouterj

Description

@wouterj

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:

  • Tag name's not validated. If you tag with name: kenrel.event_listener, you get no indication that it is wrong.
  • Tag attributes are not validated. If you tag with 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)FrameworkBundle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions