-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Wrap variables in {} for safer interpolation #3555
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
Wrap variables in {} for safer interpolation #3555
Conversation
Q | A |
---|---|
Doc fix? | yes |
New docs? | no |
Applies to | 2.3 |
Fixed tickets |
-1, this will properbly confuse people. It's not a common known feature of PHP. I prefer to put the variables outside the quotes instead |
does symfony avoid this syntax all the time on its source code? I never saw a discussion on this but interested in learning the reason. |
I personally like to wrap interpolated variables just to be on the safe side, but I agree that it might confuse people who are new to PHP as in most books/etc. I read/checked interpolation is actually quite a common reference. As someone who just recently read all the book, cookbook and most of the components, as far as I can remember I think is the only page I saw interpolated variables in the documentation. |
In the rest of the docs, we use |
Yes, most of code examples use concatenation. This PR should be closed then. |
well, if you can update this PR to change it to concatenation, it'll be better :) (otherwise, you can hit the close button yourself and create an issue, so someone else can do it) |
I also removed newline character on last echo statement as I could not thing of good reason why this one has a it and other foreach loops doesn't. |
I think the Symfony standard is to use single quotes instead of double quotes. |
Nice work guys 👍! |
This PR was merged into the 2.3 branch. Discussion ---------- Wrap variables in {} for safer interpolation | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets | Commits ------- 4046476 Replace double quotes with single quotes 0f7a189 Change interpolation to concatenation d3839ce Wrap variables in {} for safer interpolation