Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/Analyser/ExprHandler/BooleanAndHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading