[wp-trac] [WordPress Trac] #59444: Add language injection comments for embedded languages in PHP
WordPress Trac
noreply at wordpress.org
Mon Sep 25 20:58:34 UTC 2023
#59444: Add language injection comments for embedded languages in PHP
-------------------------+------------------------------------------------
Reporter: westonruter | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: javascript, css, coding-standards
-------------------------+------------------------------------------------
Comment (by dmsnell):
One benefit of using the HEREDOC strings is that it should be a trivial
update to indent them once the minimum supported version is 7.3, and they
will work in both IDEs until then. That's where my vote lies, because I'd
rather have syntax highlighting and IDE aids than avoid a dangling HEREDOC
closer.
That being said I think this is good either way so I wouldn't want to
block an update that has a positive impact. It would simply be a little
more difficult to change later when embedding the comments inside the PHP
strings.
There HEREDOC syntax has another benefit I personally like: it encourages
normal formatting of JS inside PHP, using newlines properly, and aligning
code. When a normal string is the example I feel like that puts pressure
on people to fit everything in a single long line; if they //do// need
multiple lines, then there are multiple ways they might approach that,
whereas the HEREDOC conveys a single straightforward way.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59444#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list