Rector moves the elseif part out of the foreach loop and breaks the code. It should stay in the loop.
<?php declare(strict_types=1);
final class DemoFile
{
public function run(array $list, bool $removeEmpty)
{
foreach ($list as $val => $label) {
if ($removeEmpty && empty($val) && empty($label)) {
continue;
} elseif (empty($label)) {
$label = $val;
}
}
}
}
The elseif part should stay in the foreach loop scope.
Current Behaviour
Rector moves the elseif part out of the foreach loop and breaks the code. It should stay in the loop.
Minimal PHP Code Causing Issue
Applied rules:
Expected Behaviour
The elseif part should stay in the foreach loop scope.