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

Bug #8843 confusion on nested switch()
Submitted: 2006-10-03 16:48 UTC
From: hholzgra Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version CVS)
PHP Version: 5.2.0 RC4 OS: linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 7 + 27 = ?

 
 [2006-10-03 16:48 UTC] hholzgra (Hartmut Holzgraefe)
Description: ------------ strange things happen when analyzing a file with nested switch() statements ... Test script: --------------- <?php function foo($p1, $p2) { switch ($p1) { case 1: switch ($p2) { default: break; } case "2": break; } } function setOwnName($name) { echo "test"; } ?> Expected result: ---------------- success, no warnings Actual result: -------------- $ phpcs foo.php FILE: foo.php -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AND 0 WARNING(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- [LINE 17] ERROR: Line indented incorrectly. Expected 4 spaces but found 0. [LINE 19] ERROR: Line indented incorrectly. Expected at least 8 spaces, but found 4. -------------------------------------------------------------------------------- after removing the "case 2:" case: FILE: foo.php -------------------------------------------------------------------------------- FOUND 1 ERROR(S) AND 0 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- [LINE 6] ERROR: Line indented incorrectly. Expected 4 spaces but found 8. --------------------------------------------------------------------------------

Comments

 [2006-10-04 06:38 UTC] squiz at php dot net (Greg Sherwood)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.