Closed vyshkant closed 6 years ago
Moreover: symfony/maker-bundle v1.5.0 requires nikic/php-parser ^4.0
.
symfony/maker-bundle
is provided by default with Symfony 4.0.
In other words, phpparser
task is incompatible with Symfony 4, so https://github.com/phpro/grumphp/issues/423 need to be reopened.
Fixed
@Landerstraeten can you please release this fix?
GrumPHP 0.14.0
I have one case of incompatibility with PhpParser 4, but there could be more.
The type of
\PhpParser\Node\Stmt\DeclareDeclare::$key
has been changed since4.0.0
version ofPHP-Parser
.We expect this property to be string: https://github.com/phpro/grumphp/blob/60ed6970d432c889aba6316bfd223b22b139cb5b/src/Parser/Php/Visitor/DeclareStrictTypesVisitor.php#L26
but in
^4.0
version it isPhpParser\Node\Identifier
: https://github.com/nikic/PHP-Parser/blob/9c18e3db49fa469f5feffe40dbd7b1ec2b61e41f/lib/PhpParser/Node/Stmt/DeclareDeclare.php#L9-L10So strict comparison will always return
false
, which leads to unexpected behavior.A quick-fix of my single case is to cast
$declare->key
to string (PhpParser\Node\Identifier::__toString()
will return expected value):