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

Bug #17048 False positive in Squiz_WhiteSpace_ScopeKeywordSpacingSniff
Submitted: 2010-01-31 16:19 UTC
From: kukulich Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.2.2)
PHP Version: 5.3.1 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 : 47 - 44 = ?

 
 [2010-01-31 16:19 UTC] kukulich (Jaroslav HanslĂ­k)
Description: ------------ Patch: --- ScopeKeywordSpacingSniff.php +++ ScopeKeywordSpacingSniff.new.php @@ -68,6 +68,11 @@ return; } + if ($tokens[($stackPtr - 2)]['code'] === T_NEW) { + // new static(); + return; + } + if ($nextToken['code'] !== T_WHITESPACE || strlen($nextToken['content']) !== 1 || $nextToken['content'] === $phpcsFile->eolChar Test script: --------------- <?php abstract class Foo { public static function getInstance() { return new static(); } } Expected result: ---------------- No error Actual result: -------------- FOUND 1 ERROR(S) AND 0 WARNING(S) AFFECTING 1 LINE(S) ------------------------------------------------------------------------- 7 | ERROR | Scope keyword "static" must be followed by a single space -------------------------------------------------------------------------

Comments

 [2010-02-02 05:33 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.