Fix switch formatting

The switch cases were not indented and fall-through cases had an
unnecessary additional newline.

Patch by @pscheit (PR #39).
This commit is contained in:
nikic
2012-10-31 17:46:48 +01:00
parent ac6f221c50
commit df17d62b40
2 changed files with 41 additions and 6 deletions

View File

@@ -0,0 +1,35 @@
switch/case/default
-----
<?php
switch ($expr) {
case 0:
echo 'First case, with a break';
break;
case 1:
echo 'Second case, which falls through';
case 2:
case 3:
case 4:
echo 'Third case, return instead of break';
return;
default:
echo 'Default case';
break;
}
-----
switch ($expr) {
case 0:
echo 'First case, with a break';
break;
case 1:
echo 'Second case, which falls through';
case 2:
case 3:
case 4:
echo 'Third case, return instead of break';
return;
default:
echo 'Default case';
break;
}