merged branch fabpot/fix-heredocs (PR #7417)
This PR was merged into the 2.2 branch.
Commits
-------
601da45
[ClassLoader] fixed heredocs handling
Discussion
----------
[ClassLoader] fixed heredocs handling
The end of an hereodc must have a newline to avoid PHP syntax errors.
This commit is contained in:
commit
d7fa84162b
@ -178,6 +178,7 @@ class ClassCollectionLoader
|
||||
$token = next($tokens);
|
||||
$output .= is_string($token) ? $token : $token[1];
|
||||
} while ($token[0] !== T_END_HEREDOC);
|
||||
$output .= "\n";
|
||||
$rawChunk = '';
|
||||
} elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) {
|
||||
$output .= self::compressCode($rawChunk).$token[1];
|
||||
|
@ -228,20 +228,22 @@ class WithComments
|
||||
public static \$loaded = true;
|
||||
}
|
||||
\$string ='string shoult not be modified {\$string}';
|
||||
\$heredoc =<<<HD
|
||||
\$heredoc = (<<<HD
|
||||
|
||||
|
||||
Heredoc should not be modified {\$string}
|
||||
|
||||
|
||||
HD;
|
||||
HD
|
||||
);
|
||||
\$nowdoc =<<<'ND'
|
||||
|
||||
|
||||
Nowdoc should not be modified {\$string}
|
||||
|
||||
|
||||
ND;
|
||||
ND
|
||||
;
|
||||
}
|
||||
namespace
|
||||
{
|
||||
|
@ -19,13 +19,14 @@ class WithComments
|
||||
|
||||
$string = 'string shoult not be modified {$string}';
|
||||
|
||||
$heredoc = <<<HD
|
||||
$heredoc = (<<<HD
|
||||
|
||||
|
||||
Heredoc should not be modified {$string}
|
||||
|
||||
|
||||
HD;
|
||||
HD
|
||||
);
|
||||
|
||||
$nowdoc = <<<'ND'
|
||||
|
||||
|
Reference in New Issue
Block a user