Re: One-line heredoc for better syntax highlightning

From: Date: Mon, 19 Sep 2022 15:33:19 +0000
Subject: Re: One-line heredoc for better syntax highlightning
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-118657@lists.php.net to get a copy of this message
On 19 September 2022 15:24:26 BST, "Olle Härstedt" <olle.haerstedt@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]

« previous php.internals (#118657) next »