mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-07-25 08:11:22 +02:00
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:
35
test/code/prettyPrinter/switch.test
Normal file
35
test/code/prettyPrinter/switch.test
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user