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

Bug #16821 Bug in Squiz_Sniffs_WhiteSpace_OperatorSpacingSniff
Submitted: 2009-11-22 20:36 UTC
From: kukulich Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version CVS)
PHP Version: Irrelevant OS:
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 : 24 - 3 = ?

 
 [2009-11-22 20:36 UTC] kukulich (Jaroslav HanslĂ­k)
Description: ------------ Patch: @@ -151,7 +151,7 @@ } $number = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); - if ($tokens[$number]['code'] === T_LNUMBER) { + if (in_array($tokens[$number]['code'], array(T_LNUMBER, T_VARIABLE))) { $semi = $phpcsFile->findNext(T_WHITESPACE, ($number + 1), null, true); if ($tokens[$semi]['code'] === T_SEMICOLON) { if ($prev !== false && (in_array($tokens[$prev]['code'], PHP_CodeSniffer_Tokens::$assignme ntTokens) === true)) { Test script: --------------- <?php $foo = 1; $boo = -$foo; ?> Expected result: ---------------- No error. Actual result: -------------- FOUND 1 ERROR(S) AND 0 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------- 4 | ERROR | Expected 1 space after "-"; 0 found --------------------------------------------------------------------------

Comments

 [2009-11-23 08:15 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. Thanks for the patch.