From 6c8acdf228e049f17110cb41a984b54ef7a4f144 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 14 Mar 2026 11:06:07 +0100 Subject: [PATCH] Revert https://github.com/phpstan/phpstan-src/commit/d7ba1e3f1aa4976813ef37dd06fc00fc10cd3945 --- src/Analyser/ExprHandler/ArrayDimFetchHandler.php | 4 ---- tests/PHPStan/Analyser/data/bug-9307.php | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Analyser/ExprHandler/ArrayDimFetchHandler.php b/src/Analyser/ExprHandler/ArrayDimFetchHandler.php index 796a717a2a..baea95ddd5 100644 --- a/src/Analyser/ExprHandler/ArrayDimFetchHandler.php +++ b/src/Analyser/ExprHandler/ArrayDimFetchHandler.php @@ -42,10 +42,6 @@ public function resolveType(MutatingScope $scope, Expr $expr): Type } $offsetAccessibleType = $scope->getType($expr->var); - if ($offsetAccessibleType instanceof NeverType) { - return NullsafeShortCircuitingHelper::getType($scope, $expr->var, $offsetAccessibleType); - } - if ( !$offsetAccessibleType->isArray()->yes() && (new ObjectType(ArrayAccess::class))->isSuperTypeOf($offsetAccessibleType)->yes() diff --git a/tests/PHPStan/Analyser/data/bug-9307.php b/tests/PHPStan/Analyser/data/bug-9307.php index 0b6ce3becc..69158aa759 100644 --- a/tests/PHPStan/Analyser/data/bug-9307.php +++ b/tests/PHPStan/Analyser/data/bug-9307.php @@ -31,7 +31,7 @@ public function test(): void } } - assertType('array', $objects); + assertType('array<*ERROR*>', $objects); // could be array $this->acceptObjects($objects); }