On 19 September 2022 15:24:26 BST, "Olle Härstedt" 
<olle.haerst...@limesurvey.org> wrote:
>Hi internals!
>
>Some editors can guess the domain-specific language inside heredoc, e.g. if 
>you do
>
>$query = <<<MySQL
>SELECT * FROM foo
>MySQL;
>
>It would be nice if this feature could be used in single lines as well:
>
>$query = <<<MySQL SELECT * FROM foo MySQL;


While I can't immediately think of a practical problem with this, I'm hesitant 
at the idea of adding yet more ways of quoting strings; it means more for users 
to learn, more for third party parsers to implement (including exactly the 
syntax highlighting tools you're going to help), and in the worst case, more 
edge cases that can lead to security issues.

I don't know about other editors, but PhpStorm at least also recognises an 
in-line comment explicitly labelling any string, which if anything seems more 
explicit:

$query = /** @lang mysql */"SELECT * FROM foo";

Regards,

-- 
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to