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

Request #20208 Improvements to "PSR1_Sniffs_Classes_ClassDeclarationSniff" sniff
Submitted: 2014-03-02 15:08 UTC
From: aik099 Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.2)
PHP Version: 5.4.20 OS: Slackware Linux
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 : 15 + 47 = ?

 
 [2014-03-02 15:08 UTC] aik099 (Alexander Obuhovich)
Description: ------------ The PSR1_Sniffs_Classes_ClassDeclarationSniff (see https://github.com/squizlabs/PHP_CodeSniffer/blob/5a329101781 8ffe81218747eaa47e049783aec62/CodeSniffer/Standards/PSR1/ Sniffs/Classes/ClassDeclarationSniff.php) doesn't support T_TRAIT (to report if not only trait, but also another class/interface/trait is declared in same file). Split this sniff into 2: * base one that just checks that single class/interface/trait exists in a file * extend one used in PSR1 to force "namespace ..." presence on top of each file.

Comments

 [2014-03-02 17:11 UTC] aik099 (Alexander Obuhovich)
Same issue with PEAR_Sniffs_Classes_ClassDeclarationSniff. Having base class to check "one class/interface/trait" per file to be extended by both PEAR_Sniffs_Classes_ClassDeclarationSniff and PSR1_Sniffs_Classes_ClassDeclarationSniff would be better.
 [2014-03-06 11:07 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
I'm not going to split up the checks into different files, but I have added trait support here: https://github.com/squizlabs/PHP_CodeSniffer/commit/8505439fa139c4853b140871e3 e14e2004883ab9 If you don't like one of the messages, you can mute it in a custom ruleset already.
 [2014-03-06 14:15 UTC] aik099 (Alexander Obuhovich)
Thanks.