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

Bug #15188 PHPCS vs HEREDOC strings
Submitted: 2008-11-30 02:43 UTC
From: doconnor Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version CVS)
PHP Version: 5.2.6 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-11-30 02:43 UTC] doconnor (Daniel O'Connor)
Description: ------------ PHPCS (pear standard) recommends creating parse errors. Test script: --------------- <?php method_call( <<<EOH Anyone want to recomment parse errors? EOH ); Expected result: ---------------- PHPCS ignores the extra whitespace before closing bracket in this case. clockwerx@clockwerx-desktop:~/pear/MDB2_Schema/MDB2/Schema$ phpcs parse.php FILE: /home/clockwerx/pear/MDB2_Schema/MDB2/Schema/parse.php -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AND 0 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 2 | ERROR | Missing file doc comment 2 | ERROR | Space after opening parenthesis of function call prohibited -------------------------------------------------------------------------------- Actual result: -------------- clockwerx@clockwerx-desktop:~/pear/MDB2_Schema/MDB2/Schema$ phpcs parse.php FILE: /home/clockwerx/pear/MDB2_Schema/MDB2/Schema/parse.php -------------------------------------------------------------------------------- FOUND 3 ERROR(S) AND 0 WARNING(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 2 | ERROR | Missing file doc comment 2 | ERROR | Space after opening parenthesis of function call prohibited 6 | ERROR | Space before closing parenthesis of function call prohibited --------------------------------------------------------------------------------

Comments

 [2008-11-30 22:08 UTC] squiz (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. The errors from the CVS version are not exactly the same as the ones you have listed here as the CVS version has the new multi-line function call checks in it. So instead, you are asked to move the HEREDOC to the line after the function call (as per the standard) and then you are asked to indent each line of the HEREDOC. I've kept the first error as the standard is very clear, but removed the indentation errors. The closing brace of a multi-line function call always needs to be on a line by itself, so there is no problem there any more.