-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
ContainerBuilder: removed support for ? (BC break) #93
base: master
Are you sure you want to change the base?
Conversation
So hypothetically... what should I use instead of ->addSetup('$service->methodA(?)->methodB(?)', ['a', 'b']); |
|
Yep, that's what I was afraid of. 👎 |
Why 👎? Is it forbidden to invent some syntactic sugar? Like |
First its a BC break that would force me to update quite a few of my extensions. Second the syntax using question marks is probably the best syntactic sugar you could come up with - the chain syntax from your last comment doesn't solve cases like By the way you didn't mention why you want to remove the question marks in the first place. Right now I fail to see any benefit, only BC break and uglier syntax. Thats why 👎 for now but you might be able to convince me. |
Because eval is evil. DI compiler is unable to understand what it means. It relies on internal implementation details, like name |
|
@dg I'm strongly against removing the ability to push custom code to the service creation. It's very handy and allows for hacking the container :) I've went through most of my code, and the main reason for using the $def->addSetup('$array[]', ["value"])
# converts to
$service->array[] = "value"; Imho it makes sense first to introduce new syntaxes to solve the causes for using the |
@dg "eval is evil" is a statement taugh to begginers because they can create a lot of damage by using it wrong and also create exploits. It's not evil, just dangerous. |
@dg I never figured the array in setup's statement, that's a nice one. |
I think it can be solved with current syntax ( |
@dg I get your point, but I hope I'm not the only one who considers this very ugly :) |
My use-cases for custom code in service creation
There is more, but this represents the most common ones for me. |
@dg please reconsider the BC Break effect of deprecating this on extensions. I'm 👍 on adding the new syntax for array append, but 👎 on removing the |
It may be interesting to use https://wiki.php.net/rfc/use_function#domain_specific_languages combined with https://wiki.php.net/rfc/group_use_declarations#rfc_impact instead of parsing magic strings. |
@JanTvrdik nice idea |
ba7b241
to
fb96e4f
Compare
231a29c
to
7f12a9f
Compare
9fbd1d4
to
a71f267
Compare
680bc12
to
5066242
Compare
b109822
to
7f11e6e
Compare
ef39d2d
to
f729b1e
Compare
a43bb2c
to
71a91be
Compare
51cfed7
to
9c4af52
Compare
0a1f0ab
to
8c392ab
Compare
96c09bc
to
7a40f39
Compare
8655bcb
to
59cf699
Compare
We should Identify all cases when
?
is used, resolve them and remove a question mark (it is like eval).