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

Bug #19629 PSR2 error for inline comments on multi-line argument lists
Submitted: 2012-10-01 20:13 UTC
From: finlay Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.0)
PHP Version: 5.4.7 OS: CentOS 6
Roadmaps: (Not assigned)    
Subscription  


 [2012-10-01 20:13 UTC] finlay (Olivier Finlay Beaton)
Description: ------------ I ran into a problem where PHPCS' handling of the following rule doesn't seem correct. Argument lists must be on their own line, and the parenthesis the last/first thing. https://github.com/php-fig/fig- standards/blob/master/accepted/PSR-2-coding-style- guide.md#44-method-arguments Inline comments are treated as multiplearguments per line I also ran into a problem with multi-line strings as a single argument, but pear shows me a bug where the standard seems to apply to something it really shouldn't. It agree with your interpretation of the standard, even if I don't think it was meant to apply to that. Test script: --------------- doError( 404, // status code 'Not Found', // error name 'Check your id' // fix ); Expected result: ---------------- No error, example above produces an error Actual result: -------------- Error saying you can only have 1 argument per line.

Comments

 [2012-10-02 05:34 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
This looks like a clear bug to me. The standard specifically states that commenting is ignored throughout, unless a part of the standard is very specific about it. In this case, commenting is not mentioned at all.
 [2012-10-02 05:41 UTC] squiz (Greg Sherwood)
-Summary: inline comments on multi-line argument lists +Summary: PSR2 error for inline comments on multi-line argument lists
 [2012-10-02 05:48 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fixed in github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/ab6a5a11f8960f527a0debba0 ae3e9e40d31a752