From c769d5208d2e4f36ecfd10ad166d2b508f7114ae Mon Sep 17 00:00:00 2001 From: bancer Date: Mon, 9 Nov 2026 14:12:05 +0100 Subject: [PATCH] Update to Rector 2.8.4 Rector 2.7.0 bundles an older phpstan/phpdoc-parser that conflicts with PHPStan 2.3.5, causing `rector process` to fail with a CallableTypeNode::__construct() type error. Rector 2.8 requires phpstan ^2.3.5 and works with it. * Bump rector/rector to ~2.8.4 in the rector-setup script. * Remove ObjectExplicitBoolCompareRector from skipped rules, as it is deprecated and no longer registered. * Apply ExplicitNullableObjectInstanceRector to AuthenticationMiddleware. --- composer.json | 2 +- rector.php | 2 -- src/Middleware/AuthenticationMiddleware.php | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index d409d212..fd46030b 100644 --- a/composer.json +++ b/composer.json @@ -75,7 +75,7 @@ "stan": "@phpstan", "stan-baseline": "tools/phpstan --generate-baseline", "stan-setup": "phive install", - "rector-setup": "cp composer.json composer.backup && composer require --dev rector/rector:\"~2.7.0\" && mv composer.backup composer.json", + "rector-setup": "cp composer.json composer.backup && composer require --dev rector/rector:\"~2.8.4\" && mv composer.backup composer.json", "rector-check": "vendor/bin/rector process --dry-run", "rector-fix": "vendor/bin/rector process", "test": "phpunit", diff --git a/rector.php b/rector.php index dfb22440..a35f9009 100644 --- a/rector.php +++ b/rector.php @@ -4,7 +4,6 @@ use Rector\Caching\ValueObject\Storage\FileCacheStorage; use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector; use Rector\CodeQuality\Rector\If_\ArrayExplicitBoolCompareRector; -use Rector\CodeQuality\Rector\If_\ObjectExplicitBoolCompareRector; use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector; use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector; use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; @@ -54,7 +53,6 @@ NewlineAfterStatementRector::class, TypedPropertyFromCreateMockAssignRector::class, ArrayExplicitBoolCompareRector::class, - ObjectExplicitBoolCompareRector::class, RemoveUselessUnionReturnDocblockRector::class, RemoveMixedDocblockOverruledByNativeTypeRector::class, ]); diff --git a/src/Middleware/AuthenticationMiddleware.php b/src/Middleware/AuthenticationMiddleware.php index 46d1870f..d2c9faa9 100644 --- a/src/Middleware/AuthenticationMiddleware.php +++ b/src/Middleware/AuthenticationMiddleware.php @@ -76,7 +76,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface if ($this->subject instanceof ContainerApplicationInterface) { $container = $this->subject->getContainer(); $container->add(AuthenticationService::class, $service); - } elseif ($this->container) { + } elseif ($this->container instanceof ContainerInterface) { $this->container->add(AuthenticationService::class, $service); }