1.2.467. Flexible Heredoc¶
Flexible syntax for Heredoc.
The new flexible syntax for heredoc and nowdoc enable the closing marker to be indented, and remove the new line requirement after the closing marker.
It was introduced in PHP 7.3. This syntax is backward incompatible : once adopted in the code, previous versions won’t compile it.
<?php
// PHP 7.3 and newer
foo($a = <<<END
flexible syntax
with extra indentation
END);
// All PHP versions
$a = <<<END
Normal syntax
END;
?>
See also Heredoc and Flexible Heredoc and Nowdoc Syntaxes.
1.2.467.1. Connex PHP features¶
1.2.467.1.1. Specs¶
Short name |
Php/FlexibleHeredoc |
Rulesets |
All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56, CompatibilityPHP70, CompatibilityPHP71, CompatibilityPHP72 |
Exakat since |
1.2.9 |
PHP Version |
With PHP 7.3 and more recent |
Severity |
Critical |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Available in |