diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 5a07151b15..6a88cb308d 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -4816,7 +4816,7 @@ public function isInFirstLevelStatement(): bool public function mergeWith(?self $otherScope): self { - if ($otherScope === null) { + if ($otherScope === null || $this === $otherScope) { return $this; } $ourExpressionTypes = $this->expressionTypes;