diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 4afda9f73f..62ed96b7f0 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -2807,11 +2807,9 @@ private function getTypeFromArrayDimFetch( return $offsetAccessibleType->getOffsetValueType($offsetType); } - private function resolveExactName(Name $name): ?string + private function resolveExactName(string $name): ?string { - $originalClass = (string) $name; - - switch (strtolower($originalClass)) { + switch (strtolower($name)) { case 'self': if (!$this->isInClass()) { return null; @@ -2830,7 +2828,7 @@ private function resolveExactName(Name $name): ?string return null; } - return $originalClass; + return $name; } /** @api */ @@ -5764,7 +5762,7 @@ public function debug(): array */ private function exactInstantiation(New_ $node, string $className): ?Type { - $resolvedClassName = $this->resolveExactName(new Name($className)); + $resolvedClassName = $this->resolveExactName($className); $isStatic = false; if ($resolvedClassName === null) { if (strtolower($className) !== 'static') {