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

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)    

 [2014-03-02 15:08 UTC] aik099 (Alexander Obuhovich)
Description: ------------ The PSR1_Sniffs_Classes_ClassDeclarationSniff (see 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.


 [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: 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)