<?php
declare(strict_types=1);
function foo(array $bar): void
{
switch ($bar['type']) {
case 1:
case 2:
$positions = match ($bar['subtype']) {
0 => 1,
1 => 3,
default => 1,
};
for ($i = 1; ($positions + 1) > $i; ++$i) {
if (!isset($bar['val'][$i])) {
continue;
}
print $bar['val'][$i] . "\n";
}
break;
}
}
foo([
'type' => 1,
'subtype' => 1,
'val' => [
1 => 'asd',
3 => 'blub',
],
]);
The expected output is:
from following example:
But the
SwitchContinueToBreakFixerchanges thecontinueto abreakand thus the output is only