From c1f7c36eb380098fd5e31540380a467a8a73870e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 12 Nov 2025 23:37:57 +0700 Subject: [PATCH 1/2] Bump to PHPStan ^2.1.32 with fix ClassConstFetchReturnTypeResolver --- composer.json | 2 +- src/TypeResolver/ClassConstFetchReturnTypeResolver.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 210c4c87..c2d49a20 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php": ">=8.2", - "phpstan/phpstan": "^2.1" + "phpstan/phpstan": "^2.1.32" }, "require-dev": { "illuminate/container": "^11.0", diff --git a/src/TypeResolver/ClassConstFetchReturnTypeResolver.php b/src/TypeResolver/ClassConstFetchReturnTypeResolver.php index a17191ed..07276050 100644 --- a/src/TypeResolver/ClassConstFetchReturnTypeResolver.php +++ b/src/TypeResolver/ClassConstFetchReturnTypeResolver.php @@ -13,14 +13,13 @@ use PHPStan\Type\MixedType; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; -use Symplify\PHPStanExtensions\Exception\ShouldNotHappenException; final class ClassConstFetchReturnTypeResolver { public function resolve(MethodReflection $methodReflection, MethodCall $methodCall): ?Type { if (! isset($methodCall->args[0])) { - throw new ShouldNotHappenException('Not supported without argument'); + return null; } $firstArgOrVariadciPlaceholder = $methodCall->args[0]; From 7d64c3b0a91b6f84a9f619d0d2b45de00f4146c3 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 12 Nov 2025 23:41:47 +0700 Subject: [PATCH 2/2] rectify --- rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rector.php b/rector.php index f1508dcd..79558778 100644 --- a/rector.php +++ b/rector.php @@ -6,7 +6,7 @@ return RectorConfig::configure() ->withPaths([__DIR__ . '/src', __DIR__ . '/tests']) - ->withPreparedSets(codeQuality: true, deadCode: true, naming: true, privatization: true, earlyReturn: true, codingStyle: true) + ->withPreparedSets(deadCode: true, codeQuality: true, codingStyle: true, privatization: true, naming: true, earlyReturn: true) ->withRootFiles() ->withSkip([ '*/Source/*',