Bug Report
| Subject |
Details |
| Rector version |
e.g. v2.3.1 (invoke vendor/bin/rector --version) |
| phpstan version |
e.g. v2.1.34 (invoke vendor/bin/rector --version) |
Rector 2.3.1 fails when used with PHPStan 2.1.34 due to several breaking API changes in PHPStan. The errors include:
- Removed Visitor Classes
PHP Warning: Undefined array key 0 in PHPStanContainerMemento.php on line 35
[ERROR] "Service name must be a non-empty string." On line: 291
Cause: PHPStan 2.1.34 removed VariadicFunctionsVisitor and VariadicMethodsVisitor
classes. Rector's PHPStanContainerMemento.php still references them.
- Changed
OptimizedSingleFileSourceLocator Constructor
[ERROR] Argument #2 ($cache) must be of type PHPStan\Cache\Cache, string given
Cause: OptimizedSingleFileSourceLocator::__construct() signature changed from
(FileNodesFetcher, string) to (FileNodesFetcher, Cache, PhpVersion, string).
FiberScope Introduction
[ERROR] "Cannot suspend outside of a fiber"
Cause: PHPStan 2.1.34 introduces FiberScope for scope resolution. The node
callback in PHPStanNodeScopeResolver.php expects MutatingScope but now receives
FiberScope.
Bug Report
vendor/bin/rector --version)vendor/bin/rector --version)Rector 2.3.1 fails when used with PHPStan 2.1.34 due to several breaking API changes in PHPStan. The errors include:
Cause: PHPStan 2.1.34 removed
VariadicFunctionsVisitorandVariadicMethodsVisitorclasses. Rector's
PHPStanContainerMemento.phpstill references them.OptimizedSingleFileSourceLocatorConstructorCause:
OptimizedSingleFileSourceLocator::__construct()signature changed from(FileNodesFetcher, string)to(FileNodesFetcher, Cache, PhpVersion, string).FiberScopeIntroductionCause: PHPStan 2.1.34 introduces
FiberScopefor scope resolution. The nodecallback in
PHPStanNodeScopeResolver.phpexpectsMutatingScopebut now receivesFiberScope.