-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(php) detect newer more flexible HEREdoc syntax (#2658)
- separate tests along purpose + support of indented heredoc + heredoc as string variant - share subst with double quoted string
- Loading branch information
Showing
6 changed files
with
80 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<span class="hljs-meta"><?php</span> | ||
|
||
<span class="hljs-comment">// variable substitution</span> | ||
|
||
<span class="hljs-keyword">echo</span> (<span class="hljs-string">'Hello {$person->name}! Welcome to $company!'</span>); | ||
|
||
<span class="hljs-keyword">echo</span> (<span class="hljs-string">"Hello <span class="hljs-subst">{$person->name}</span>! Welcome to <span class="hljs-subst">$company</span>!"</span>); | ||
|
||
<span class="hljs-keyword">echo</span> (<span class="hljs-string"><<<MSG | ||
Hello <span class="hljs-subst">{$person->name}</span>! Welcome to <span class="hljs-subst">$company</span>! | ||
MSG</span>); | ||
|
||
<span class="hljs-comment">// heredoc syntax</span> | ||
|
||
var_dump(<span class="hljs-string"><<<SQL | ||
SELECT * | ||
FROM table | ||
SQL</span>); | ||
|
||
var_dump(<span class="hljs-string"><<<SQL | ||
SELECT * | ||
FROM table | ||
SQL</span>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
// variable substitution | ||
|
||
echo ('Hello {$person->name}! Welcome to $company!'); | ||
|
||
echo ("Hello {$person->name}! Welcome to $company!"); | ||
|
||
echo (<<<MSG | ||
Hello {$person->name}! Welcome to $company! | ||
MSG); | ||
|
||
// heredoc syntax | ||
|
||
var_dump(<<<SQL | ||
SELECT * | ||
FROM table | ||
SQL); | ||
|
||
var_dump(<<<SQL | ||
SELECT * | ||
FROM table | ||
SQL); |