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

Bug #20136 Squiz_Sniffs_WhiteSpace_ScopeKeywordSpacingSniff and Traits
Submitted: 2013-11-28 15:09 UTC
From: schmkr Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.0)
PHP Version: 5.4.21 OS: OSX
Roadmaps: (Not assigned)    
Subscription  


 [2013-11-28 15:09 UTC] schmkr (Alwin Schoemaker)
Description: ------------ If you import Traits into a class and change its visibility, like this: ---- <?php trait HelloWorld { public function sayHello() { echo 'Hello World!'; } } // Change visibility of sayHello class MyClass1 { use HelloWorld { sayHello as private; } } --- You get an error from the PSR2_Sniffs_Classes_PropertyDeclarationSniff that the scope keyword must be followed by a single space. But I don't think this should not be the case for traits. Expected result: ---------------- No errors Actual result: -------------- ERROR | Scope keyword "private" must be followed by a single space

Comments

 [2013-11-29 09:44 UTC] squiz (Greg Sherwood)
-Summary: PSR2_Sniffs_Classes_PropertyDeclarationSniff and Traits +Summary: Squiz_Sniffs_WhiteSpace_ScopeKeywordSpacingSniff and Traits -Assigned To: +Assigned To: squiz
That errors actually comes from the Squiz_Sniffs_WhiteSpace_ScopeKeywordSpacingSniff class, but I can replicate it easily.
 [2013-11-29 09:46 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fix committed to github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/0622b323c598b44f498df843ac d9d16f63494ac4