Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.15

Bug #19048 Switch without break causes all subsequent lines to be indented improperly
Submitted: 2011-11-16 07:04 UTC
From: spectre256 Assigned:
Status: Open Package: PHP_Beautifier (version 0.1.15)
PHP Version: 5.2.10 OS: CentOS Linux
Roadmaps: (Not assigned)    
Subscription  


 [2011-11-16 07:04 UTC] spectre256 (Julian Simioni)
Description: ------------ This may be related to many of the other switch related bugs, but when using the k&r style (but not the default style within the Pear filter), a switch statement in a class function where the default case does not have a break at the end will cause all subsequent functions to be unindented relative to the class they are contained within Test script: --------------- $ cat test.php <?php class Foo { function withASwitch($param) { switch($param) { case "a": echo "a\n"; default: } } function anotherFunction() { echo "hello\n"; } } $ cat testWorking.php <?php class Foo { function withASwitch($param) { switch($param) { case "a": echo "a\n"; default: break; } } function anotherFunction() { echo "hello\n"; } } Expected result: ---------------- $ php_beautifier -t --filters "IndentStyles(style=k&r)" testWorking.php <?php class Foo { function withASwitch($param) { switch ($param) { case "a": echo "a\n"; default: break; } } function anotherFunction() { echo "hello\n"; } } Actual result: -------------- $ php_beautifier -t --filters "IndentStyles(style=k&r)" test.php <?php class Foo { function withASwitch($param) { switch ($param) { case "a": echo "a\n"; default: } } function anotherFunction() { echo "hello\n"; } }

Comments