From 61100c116d5330ebb7d29fb787e07a43dd1d7cd1 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 26 Feb 2026 19:42:12 +0100 Subject: [PATCH] Prevent unnecessary $scope->getType() calls --- src/Analyser/MutatingScope.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 6391811a1a..4036f5ca72 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -1467,8 +1467,6 @@ private function resolveType(string $exprString, Expr $node): Type $node->var, $this->getTypeFromArrayDimFetch( $node, - $this->getType($node->dim), - $this->getType($node->var), ), ); } @@ -1845,14 +1843,13 @@ private function promoteNativeTypes(): self private function getTypeFromArrayDimFetch( Expr\ArrayDimFetch $arrayDimFetch, - Type $offsetType, - Type $offsetAccessibleType, ): Type { if ($arrayDimFetch->dim === null) { throw new ShouldNotHappenException(); } + $offsetAccessibleType = $this->getType($arrayDimFetch->var); if ($offsetAccessibleType instanceof NeverType) { return $offsetAccessibleType; } @@ -1872,6 +1869,7 @@ private function getTypeFromArrayDimFetch( ); } + $offsetType = $this->getType($arrayDimFetch->dim); return $offsetAccessibleType->getOffsetValueType($offsetType); }