Skip to content

Commit ebc06ca

Browse files
committed
Fix orig node set on ChangeNestedForeachIfsToEarlyContinueRector
1 parent c0c4c25 commit ebc06ca

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

rules-tests/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector/Fixture/comment_inside_if_statement.php.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class CommentInsideIfStatement
3535
if ($value !== 5) {
3636
continue;
3737
}
38-
// why am I doing this?
3938
if ($value !== 10) {
4039
continue;
4140
}

rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ public function refactor(Node $node): ?Node
9696
return null;
9797
}
9898

99+
foreach ($nestedIfsWithOnlyNonReturn as $nestedIf) {
100+
$nestedIf->cond->setAttribute(AttributeKey::ORIGINAL_NODE, null);
101+
}
102+
99103
return $this->processNestedIfsWithNonBreaking($node, $nestedIfsWithOnlyNonReturn);
100104
}
101105

0 commit comments

Comments
 (0)