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

Bug #18140 Generic scope indent in exact mode: strange expected/found values for switch
Submitted: 2010-12-22 23:56 UTC
From: ryba Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.0RC1)
PHP Version: 5.3.3 OS: Ubuntu Linux 10.10
Roadmaps: (Not assigned)    
Subscription  


 [2010-12-22 23:56 UTC] ryba (Piotr Karas)
Description: ------------ When I go into exact mode with Generic WhiteSpace ScopeIndent sniff, I get very strange expected values (13 instead of 4 or 8), as reported below... I removed all coments so that they don't incluence the exact mode, as reported here: https://pear.php.net/bugs/bug.php?id=13813 Cheers, Piotrek Test script: --------------- <?php $x = 333; switch ( $x ) { case 666: $y = 999; break; case 555: $y = 444; break; } Expected result: ---------------- No errors OR: -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 7 | ERROR | Line indented incorrectly; expected 4 spaces, found 8 | | (Generic.WhiteSpace.ScopeIndent.IncorrectExact) 10 | ERROR | Line indented incorrectly; expected 4 spaces, found 8 | | (Generic.WhiteSpace.ScopeIndent.IncorrectExact) -------------------------------------------------------------------------------- Actual result: -------------- -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 7 | ERROR | Line indented incorrectly; expected 4 spaces, found 13 | | (Generic.WhiteSpace.ScopeIndent.IncorrectExact) 10 | ERROR | Line indented incorrectly; expected 4 spaces, found 13 | | (Generic.WhiteSpace.ScopeIndent.IncorrectExact) --------------------------------------------------------------------------------

Comments

 [2011-01-11 11:35 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
This bug has been fixed in SVN. 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. Problem was caused by the sniff checking the semi-colon for indentation rules when it should actually be ignored due to it being part of the CASE's scope closer.
 [2011-01-12 12:40 UTC] ryba (Piotr Karas)
Seems OK now.