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); }