-
-
Save manuelpichler/1405317 to your computer and use it in GitHub Desktop.
<?php | |
class MyClass | |
{ | |
static function myMethod( | |
$x = <<<'FOO' | |
Hello | |
FOO | |
, $y = <<<'BAR' | |
PHP_Depend | |
BAR | |
) { | |
echo $x, $y; | |
} | |
} |
Maybe this is one of the consistent features in PHP, but in my totally personal opinion this language construct was/is already for simple variables an unreadable crap, and so I was more or less shocked, when I realized that you can use here-/nowdoc nearly everywhere.
It is an constant expression, why create an extra rule limiting this? This brings complexity to the parser etc. If people want to do bad things they always can, inventing arbitrary artificial unneeded limitations is bad and makes the language more complex. We have cases which look like arbitrary limitations in the syntax, and that's always a pain ...
I do not critizes this syntax consistency at all, but I hate/dislike the now- and heredoc syntax in general from the first day and so this usage looks so ugly for me.
At least one place where the language is consistent, no special rules on constant expressions in different places.