diff --git a/src/Analyser/ExprHandler/BooleanAndHandler.php b/src/Analyser/ExprHandler/BooleanAndHandler.php index 383b03c7d6..085fc8190d 100644 --- a/src/Analyser/ExprHandler/BooleanAndHandler.php +++ b/src/Analyser/ExprHandler/BooleanAndHandler.php @@ -162,17 +162,18 @@ public function specifyTypes(TypeSpecifier $typeSpecifier, Scope $scope, Expr $e return $types; } - public static function getBooleanExpressionDepth(Expr $expr, int $depth = 0): int + public static function getBooleanExpressionDepth(Expr $expr): int { + $depth = 0; while ( - $expr instanceof BooleanOr - || $expr instanceof LogicalOr - || $expr instanceof BooleanAnd - || $expr instanceof LogicalAnd + $expr instanceof BooleanOr || + $expr instanceof LogicalOr || + $expr instanceof BooleanAnd || + $expr instanceof LogicalAnd ) { - return self::getBooleanExpressionDepth($expr->left, $depth + 1); + $depth++; + $expr = $expr->left; } - return $depth; }