diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 504c2fdd5..01e8354bf 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -2229,24 +2229,17 @@ public function hasChildReturnStatementType(array $statement): bool } $statements = $statement['else_statements']; - foreach ($statements as $item) { - $type = $item['type'] ?? null; - if ('return' === $type || 'throw' === $type) { - return true; - } - - return $this->hasChildReturnStatementType($item); - } } else { $statements = $statement['statements']; - foreach ($statements as $item) { - $type = $item['type'] ?? null; - if ('return' === $type || 'throw' === $type) { - return true; - } + } - return $this->hasChildReturnStatementType($item); + foreach ($statements as $item) { + $type = $item['type'] ?? null; + if ('return' === $type || 'throw' === $type) { + return true; } + + return $this->hasChildReturnStatementType($item); } return false;