-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Improved the validation of the service names for XML files #18855
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
Conversation
Added a regex constraint for the service id in the xsd
what is the reasonning for this regex ? Btw, I'm quite sure this forbids some values which are accepted today. |
@marcoalbarelli improving the XML validation is always a good thing, but I'd like to ask you to please provide a link to the code that restricts the service names to have these chars. I remember a recent discussion (https://github.com/symfony/symfony/pull/18028/files) where we tried to restrict the list of allowed characters but at the end we decided to not change anything. |
@stof the idea behind this is to enforce the service id naming convention at the xsd level. |
#18028 was deprecating some chars which prevented dumping the container to an optimized PHP file (and so making such ids unusable in the context of the fullstack framework which performs such dumping). And we indeed removed such limitation in the dumper. In Symfony 3.1+, any PHP string is allowed as service id (including weird ids, like the empty string or emojis) |
@javiereguiluz I proposed this PR because it would be very convenient to have IDE perform the validation of service ids on its own. I can expand on this but it's quite a long story :) |
@marcoalbarelli XML performing a broken validation is way worse than the current state, as it breaks existing projects. |
@stof define broken :) |
@marcoalbarelli a convention for the naming does not mean that using something else is forbidden. It just means that it is recommended to use such naming. Projects are free to use something else than the recommended naming convention even in 2.x versions (as long as they stick to chars compatible with the PhpDumper or avoid dumping their container). |
In any case I think #18167 makes this PR useless if not harmful |
Added a regex constraint for the service id in the xsd