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

Bug #20310 PSR2 does not check for space after function name
Submitted: 2014-06-24 02:01 UTC
From: ak Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.3)
PHP Version: 5.5.12 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2014-06-24 02:01 UTC] ak (Atul Kulkarni)
Description: ------------ 1. Method names MUST NOT be declared with a space after the method name. Example: // There should not be space between foo and opening parenthesis '(' protected static function foo () { } Code sniffer does not detect it. 2. There MUST be one space before & after comparison or logical operands (1 == 1 || $var != "foo") Example: if ($a===$b||1===1) { } Code sniffer does not detect it. Test script: --------------- <?php class bar { // Method names MUST NOT be declared with a space after the method name. protected static function foo ($a, $b) { if ($a===$b||1===1) { } } } On command line: >./phpcs --standard=PSR2 C:\Bar.php > Expected result: ---------------- Error should be shown for the above 2 rules. Actual result: -------------- No error. Passes sucessfully.

Comments

 [2014-06-24 02:21 UTC] ak (Atul Kulkarni)
-Summary: Sniffs does not detect to 2 PSR2 standards +Summary: Sniffs does not detect to 1 PSR2 standard
Please consider only point 1 in the description. Point 2 is not part of PSR2 standard. Thanks.
 [2014-06-24 06:07 UTC] squiz (Greg Sherwood)
-Summary: Sniffs does not detect to 1 PSR2 standard +Summary: PSR2 does not check for space after function name -Type: Feature/Change Request +Type: Bug -Assigned To: +Assigned To: squiz
 [2014-06-24 06:09 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fixed in Github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/7867133054f698ec14f945a560 0e495310ecfc9b Thanks for picking that up.