You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With PHPStan 2.3.4, Rector 2.8.2 fails on any file where PHPStan has to describe a closure type that came from a docblock. With PHPStan 2.3.3 the same file passes.
[ERROR] Could not process "src/Repro.php" file, due to:
"PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::__construct(): Argument #1 ($identifier) must be of type
PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode, PHPStan\PhpDocParser\Ast\Type\FullyQualifiedNameNode given,
called in phar://vendor/phpstan/phpstan/phpstan.phar/src/Type/ClosureType.php:759"
The cause seems to be packaging, not a rule. PHPStan 2.3.4 updated its phpdoc-parser to 2.4.0, which adds FullyQualifiedNameNode and accepts it in CallableTypeNode (phpstan/phpdoc-parser#339). ClosureType::toPhpDocNode() in the phar now builds a CallableTypeNode with one. Rector 2.8.2 ships its own unprefixed phpstan/phpdoc-parser2.3.11 in vendor/rector/rector/vendor, and that copy is the one autoloaded. So PHPStan's code ends up calling the old 2.3.11 constructor.
vendor/bin/rector process --dry-run → the error above. With "phpstan/phpstan": "2.3.3" → [OK] Rector is done!
Expected Behaviour
The file is processed with no error. The bundled phpdoc-parser probably needs bumping to 2.4.0, or Rector should declare conflict: phpstan/phpstan >=2.3.4 until it is, so Composer doesn't install a combination that breaks.
Reacted by Sebastian Mendel, Rodrigo, Alexander Dmitryuk and muro3r
Activity
samsonasik commentedon Oct 29, 2026
wait for:
you can temporary uses:
in your composer.json for now.
samsonasik commentedon Oct 29, 2026
Released rector 2.8.3 for it https://github.com/rectorphp/rector/releases/tag/2.8.3
chore(deps): require rector 2.8.3 and drop the phpstan hold