[Solved] Error message CakePHP 4 upgrade tool: "cannot implement … it is not an interface"

According to [1] running

bin/cake upgrade rector --rules phpunit80 <path/to/app/tests>


Fatal error: PHPStan\Analyser\MutatingScope cannot implement PHPStan\Analyser\Scope - it is not an interface in phar:///usr/src/myapp/upgrade/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php on line 87

Extracting and looking into the phpstan.phar it shows:

// Scope.php
interface Scope extends \PHPStan\Reflection\ClassMemberAccessAnswerer

// MutatingScope.php line 87
class MutatingScope implements \PHPStan\Analyser\Scope

Tried on two different installations (PHP 7.3 and 7.4). Any ideas?

[1] https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html

OK, quick answer: remove any complex tooling not related to the actual app code (phpcs, psalm, phing, …) from vendor. It confuses rector.

1 Like