8000 Wrap variables in {} for safer interpolation by ifdattic · Pull Request #3555 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 3 commits into from
Feb 16, 2014
Merged

Wrap variables in {} for safer interpolation #3555

merged 3 commits into from
Feb 16, 2014

Conversation

ifdattic
Copy link
Contributor
@ifdattic ifdattic commented Feb 8, 2014
Q A
Doc fix? yes
New docs? no
Applies to 2.3
Fixed tickets

@wouterj
Copy link
Member
wouterj commented Feb 8, 2014

-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

@cordoval
Copy link
Contributor
cordoval commented Feb 8, 2014

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.

@ifdattic
Copy link
Contributor Author
ifdattic commented Feb 8, 2014

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.

@wouterj
Copy link
Member
wouterj commented Feb 8, 2014

In the rest of the docs, we use "A string with a".$variable.", yeah!". Let's use it here too

@ifdattic
Copy link
Contributor Author
ifdattic commented Feb 8, 2014

Yes, most of code examples use concatenation. This PR should be closed then.

@wouterj
Copy link
Member
wouterj commented Feb 8, 2014

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)

@ifdattic
Copy link
Contributor Author
ifdattic commented Feb 8, 2014

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.

@xabbuh
Copy link
Member
xabbuh commented Feb 8, 2014

I think the Symfony standard is to use single quotes instead of double quotes.

@weaverryan
Copy link
Member

Nice work guys 👍!

weaverryan added a commit that referenced this pull request Feb 16, 2014
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
@weaverryan weaverryan merged commit 4046476 into symfony:2.3 Feb 16, 2014
@ifdattic ifdattic deleted the safer-variable-interpolation branch February 16, 2014 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0