-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Not very happy with how this code came into being, but does seem to have resulted in a pretty bad CBF fix while using Generic.ControlStructures.InlineControlStructure.NotAllowed. Can't really put it into words because it's so hairy, but here's what it starts out as:
class Clazz {
public function foo() {
$num = 0;
switch ($num) {
case 0:
if (1 > $num)
return bar(
baz(
"foobarbaz"
)
);
break;
default:
return bar("foobarbaz");
}
}
}
After running I get:
class Clazz {
public function foo() {
$num = 0;
switch ($num) {
case 0:
if (1 > $num) {
return;
} bar(
baz(
"foobarbaz"
)
);
break;
default:
return bar("foobarbaz");
}
}
}
Note, it's no longer returning the result of bar, which seems pretty bad. Given the code was awful to begin with, and noticed that making fine adjustments that would have made this code better makes it work right, but I'm surprised that CBF is sneaking in this semicolon in this case in particular.
Appreciate the consideration!