Skip to content

Commit

Permalink
disable creating conditional expression when entering foreach if poll…
Browse files Browse the repository at this point in the history
…uteScopeWithAlwaysIterableForeach: false
  • Loading branch information
rajyan committed Dec 7, 2022
1 parent 8e03374 commit 93b2a8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ private function processStmtNode(
$inForeachScope = $this->processVarAnnotation($scope, [$stmt->expr->name], $stmt);
}
$nodeCallback(new InForeachNode($stmt), $inForeachScope);
$bodyScope = $this->enterForeach($scope->filterByTruthyValue($arrayComparisonExpr), $stmt);
$bodyScope = $this->polluteScopeWithAlwaysIterableForeach ? $this->enterForeach($scope->filterByTruthyValue($arrayComparisonExpr), $stmt) : $this->enterForeach($scope, $stmt);
$count = 0;
do {
$prevScope = $bodyScope;
Expand Down

0 comments on commit 93b2a8a

Please sign in to comment.