-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RFC] Deprecate end() in config fluent interface #26351
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
Comments
Some more suggestion from my side:
|
I'm not sure the usage of nested closures to configure nested hierarchies is actually that much easier to use. |
Yes, it looks a bit more cluttered. Then again, it makes the current node scope also look more explicit IMHO 🤔 Eventually what convinced me to do the RFC is it could solve autocomplete/static analysis issues, considering custom node types (which is what im getting into currently :)). Depending on the use case i really started to like having those. Currently if you do a custom But now thinking about it.. im not sure closures / magic __call or so solve that 🤔 |
So basically this is about:
on
|
well, normal nodes would still not have a defining So your proposal would not solve anything for custom node types (as all methods in Symfony would still document NodeBuilder, not your custom child class) |
btw, your example is wrong. The argument passed to the |
^ correct. You'd get a builder :) just wrote that quickly.
I think you're right. It bugs me a bit though :) as technically it's working as expected/designed. But today that's not enough without proper autocompletion/static analysis IMHO. Defeating a useful thing... So ... put different; can we think of something clever? |
Yes, I can think of something clever: let's not change anything. I mean, I don't see why we should change the way it works today. I've never seem anybody complaining about the current syntax. And changing it to something means breaking all configs out there (at the minimum, people would have to remove all their |
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php Lines 369 to 374 in 1f7b9f0
would be solved with closures. Today i'd prefer that.. but i understand making the change now is not a top prio. if something could solve SA/autocompletion that be nice. With either end() or closures... but it's not possible AFAIK. Sorry for the noise :) |
I believe this was already proposed once when building the DI fluent config format. Moreover, i think it's possible in a way.. relying on something like what's currently also being proposed for DI config: #25650
However for Config component it would be required to do it that way, as without
end()
we dont know the scope of the node definition (meaning based on indentation things could either apply to a child- or parent node).Overall, i think it could be a cool step. Aiming for a bit more simplicity as well as better support for custom node types in the long run.
Im thinking something along the lines of:
Thoughts?
The text was updated successfully, but these errors were encountered: