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

Bug #16865 Two bugs in Squiz_Sniffs_WhiteSpace_OperatorSpacingSniff
Submitted: 2009-12-02 22:56 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 : 34 - 4 = ?

 
 [2009-12-02 22:56 UTC] kukulich (Jaroslav HanslĂ­k)
Description: ------------ Patch: @@ -137,12 +137,24 @@ return; } + // Skip default values in function declarations. + if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) { + $bracket = end($tokens[$stackPtr]['nested_parenthesis']); + if (isset($tokens[$bracket]['parenthesis_owner']) === true) { + $function = $tokens[$bracket]['parenthesis_owner']; + if ($tokens[$function]['code'] === T_FUNCTION) { + return; + } + } + } + // A list of tokens that indicate that the token is not // part of an arithmetic operation. $invalidTokens = array( T_COMMA, T_OPEN_PARENTHESIS, T_OPEN_SQUARE_BRACKET, + T_DOUBLE_ARROW, ); if (in_array($tokens[$prev]['code'], $invalidTokens) === true) { Test script: --------------- <?php function foo($boo = -1) {} $foo = array('boo' => -1); Expected result: ---------------- No error. Actual result: -------------- FOUND 2 ERROR(S) AND 0 WARNING(S) AFFECTING 2 LINE(S) ----------------------------------------------------------------------------- 3 | ERROR | Expected 1 space after "-"; 0 found 6 | ERROR | Expected 1 space after "-"; 0 found -----------------------------------------------------------------------------

Comments

 [2009-12-03 07:11 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.