Skip to content
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

replace occurrences of <?php echo with <?= #6664

Closed
wants to merge 1 commit into from

Conversation

dr-matt-smith
Copy link
Contributor

<?= now a first class citizen of PHP code
<?= nicely equates to {{ }} in Twig - i.e. output string casting of expression

leaving <?php logic blocks to equate to Twig {%

.. matt ..

<?= now a first class citizen of PHP code
<?= nicely equates to {{ }} in Twig - i.e. output string casting of expression

leaving <?php logic blocks to equate to Twig {%

.. matt ..
@javiereguiluz
Copy link
Member

I'm divided about this proposal. I like it and I think it's better ... but it would require us to change lots of PHP examples in the entire documentation and this <?= is only "always available" since PHP 5.4:

php_short_tag

However, Symfony 2.7 and 2.8 still require PHP >= 5.3.9, so this would require us to introduce a lot of differences between the doc versions. I don't know if it's worth it.

@xabbuh
Copy link
Member

xabbuh commented Jun 21, 2016

As the examples you change here are examples of how you might have written code before using Symfony I think we can still stick with the old syntax.

@wouterj
Copy link
Member

wouterj commented Jun 21, 2016

I'm 👍 on this PR. I think we should also do it in the rest of the docs:

  • It's a simple search & replace for <?php echo to <?=, so the amount of required changes is not a blocker
  • PHP 5.4 has reached end of life for almost a year
  • It makes PHP templates a bit nicer
  • When applying this to the 2.7 branch, we avoid any merge conflicts

@dr-matt-smith
Copy link
Contributor Author

okay .. matt ..

On Jun 21, 2016, at 07:58 AM, Christian Flothmann notifications@github.com wrote:

As the examples you change here are examples of how you might have written code before using Symfony I think we can still stick with the old syntax.

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@wouterj
Copy link
Member

wouterj commented Jul 9, 2016

ping @xabbuh @javiereguiluz @weaverryan can we please decide what we do with this?

@javiereguiluz
Copy link
Member

I change my vote from -1 to +0 😄

@xabbuh
Copy link
Member

xabbuh commented Jul 9, 2016

I don't care too much. So this gets a +0 from me. Feel free to merge, Wouter. :)

@javiereguiluz
Copy link
Member

Status: reviewed

@wouterj
Copy link
Member

wouterj commented Jul 9, 2016

Thanks Matt!

wouterj added a commit that referenced this pull request Jul 9, 2016
This PR was submitted for the 3.1 branch but it was merged into the 2.7 branch instead (closes #6664).

Discussion
----------

replace occurrences of <?php echo with <?=

```<?=``` now a first class citizen of PHP code
```<?=``` nicely equates to ```{{ }}``` in Twig - i.e. output string casting of expression

leaving ```<?php``` logic blocks to equate to Twig ```{%```

.. matt ..

Commits
-------

198ab4a replace occurrences of <?php echo with <?=
@wouterj wouterj closed this Jul 9, 2016
javiereguiluz added a commit that referenced this pull request Sep 24, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[Syntax] Change to short php echo tags

Changed occurrences of `<?php echo` to `<?=`, see discussion about this topic here: #6664

Targeted 3.4 because 2.8 requires PHP 5.3.9 at minimum while the short PHP echo tags are enabled by default at PHP 5.4.

Commits
-------

e3cc3de Change to short php echo tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants