The switch statement is already nicely formatted by default, break; is on the last line inside the case section most of the time.
I would like to be able to save some space and not bloat the easily readable code with an extra new line requirement we currently have in effect. So I propose to allow this:
switch( $foo ) {
case 'foo':
$bar = 1;
break;
case 'bar':
$bar = 2;
break;
case 'baz':
$bar = 3;
break;
case 'krya':
default:
$bar = 4;
}
Current Behavior
Right now wpforms-phpcs insists on having a new line before break, which looks like this:
switch( $foo ) {
case 'foo':
$bar = 1;
break;
case 'bar':
$bar = 2;
break;
case 'baz':
$bar = 3;
break;
case 'krya':
default:
$bar = 4;
}
It has been mentioned here #8, but not implemented.
Expected Behavior
The
switch
statement is already nicely formatted by default,break;
is on the last line inside thecase
section most of the time. I would like to be able to save some space and not bloat the easily readable code with an extra new line requirement we currently have in effect. So I propose to allow this:Current Behavior
Right now wpforms-phpcs insists on having a new line before break, which looks like this:
It has been mentioned here #8, but not implemented.