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

Bug #8841 comments taken as whitespace
Submitted: 2006-10-03 15:40 UTC
From: hholzgra Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version CVS)
PHP Version: 5.2.0 RC4 OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-10-03 15:40 UTC] hholzgra (Hartmut Holzgraefe)
Description: ------------ Comments on paramters in a function call are interpreted as whitespace (probably in other places, too?) Test script: --------------- <?php puts("hallo" /*test*/); puts("hallo"/*test*/); ?> Expected result: ---------------- success at least for the second code line Actual result: -------------- $ phpcs test1.php FILE: test1.php -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AND 0 WARNING(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- [LINE 2] ERROR: Space before closing parenthesis of function call prohibited [LINE 3] ERROR: Space before closing parenthesis of function call prohibited --------------------------------------------------------------------------------

Comments

 [2006-10-03 23:23 UTC] squiz at php dot net (Greg Sherwood)
I think this is against the PEAR coding standard: http://pear.php.net/manual/en/standards.funcalls.php
 [2006-10-03 23:38 UTC] hholzgra (Hartmut Holzgraefe)
Why? That page doesn't mention comments at all ... Maybe i've oversimplified my example, i actualy ran into this with: $wrapped = wordwrap($line, 27, "\n", true /*wrap long words*/); I don't see how this would violate http://pear.php.net/manual/en/standards.funcalls.php but i think its in good compliance with http://pear.php.net/manual/en/standards.comments.php
 [2006-10-03 23:44 UTC] squiz at php dot net (Greg Sherwood)
I'm referring to this: Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon. It doesn't mention comments, but it does show an example of how the function call should look and is pretty specific. I think I'll ask on the QA list to clear it up.
 [2006-10-04 06:41 UTC] squiz at php dot net (Greg Sherwood)
PEAR QA says no standard, so comments should be allowed inline. I'll make the change to ignore comments from within function calls.
 [2006-10-04 07:25 UTC] squiz at php dot net (Greg Sherwood)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.