Since the release of phpstan/phpstan 2.2.6 (2026-07-26), every Rector run aborts before any rule executes when PHPStan is installed as a project dependency:
PHP Fatal error: Uncaught Rector\Exception\Reflection\MissingPrivatePropertyException:
Property "$container" was not found in "PHPStan\Parser\RichParser" class
in vendor/rector/rector/src/Util/Reflection/PrivatesAccessor.php:82
#0 PrivatesAccessor.php(45): Rector\Util\Reflection\PrivatesAccessor->resolvePropertyReflection(Object(PHPStan\Parser\RichParser), 'container')
#1 DependencyInjection/PHPStan/PHPStanContainerMemento.php(24): PrivatesAccessor->getPrivateProperty(Object(PHPStan\Parser\RichParser), 'container')
#2 PhpParser/Parser/RectorParser.php(32): PHPStanContainerMemento::removeRichVisitors(Object(PHPStan\Parser\RichParser))
#3 [internal function]: Rector\PhpParser\Parser\RectorParser->__construct(Object(PHPStan\Parser\RichParser), Object(Rector\Util\Reflection\PrivatesAccessor))
PHPStanContainerMemento::removeRichVisitors() reads the private property PHPStan\Parser\RichParser::$container by reflection. That property is gone in PHPStan 2.2.6, so RectorParser cannot be constructed and the process dies.
Minimal reproduction
No rule sets, no phpstanConfig(), one empty class — the crash happens during container construction:
{
"require-dev": {
"rector/rector": "2.5.7",
"phpstan/phpstan": "2.2.6"
}
}
// rector.php
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([__DIR__ . '/src']);
$ composer install
$ vendor/bin/rector process --dry-run
PHP Fatal error: ... (as above), exit code 255
Version bisect
Same project, same container, only the PHPStan version changed:
phpstan/phpstan |
rector process --dry-run |
| 2.2.5 |
exit 0 |
| 2.2.6 |
exit 255, fatal as above |
Environment
rector/rector 2.5.7 (current release; requires phpstan/phpstan: ^2.2.2, which resolves to 2.2.6)
phpstan/phpstan 2.2.6
- PHP 8.5.8, Linux
Because 2.2.6 satisfies the ^2.2.2 constraint, a fresh composer install picks it up automatically — any project that installs phpstan/phpstan alongside Rector and does not have a pinned lock file is affected as of today.
Since the release of
phpstan/phpstan2.2.6 (2026-07-26), every Rector run aborts before any rule executes when PHPStan is installed as a project dependency:PHPStanContainerMemento::removeRichVisitors()reads the private propertyPHPStan\Parser\RichParser::$containerby reflection. That property is gone in PHPStan 2.2.6, soRectorParsercannot be constructed and the process dies.Minimal reproduction
No rule sets, no
phpstanConfig(), one empty class — the crash happens during container construction:{ "require-dev": { "rector/rector": "2.5.7", "phpstan/phpstan": "2.2.6" } }Version bisect
Same project, same container, only the PHPStan version changed:
phpstan/phpstanrector process --dry-runEnvironment
rector/rector2.5.7 (current release; requiresphpstan/phpstan: ^2.2.2, which resolves to 2.2.6)phpstan/phpstan2.2.6Because 2.2.6 satisfies the
^2.2.2constraint, a freshcomposer installpicks it up automatically — any project that installsphpstan/phpstanalongside Rector and does not have a pinned lock file is affected as of today.