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

Request #11561 equal sign alignment and long lines
Submitted: 2007-07-08 09:28 UTC
From: cweiske Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 0.7.0)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2007-07-08 09:28 UTC] cweiske (Christian Weiske)
Description: ------------ Suppose the following code: $variable = 12; $var = a_very(long_line('that', 'contains'), a_bunch('of long', 'parameters'), 'that_need to be aligned with the equal sign'); $var2 = 12; I get the error that I should align $var = equal sign. When aligning, the line gets longer than 85 chars and I get the message that the line is too long. Now I wrap the line into: $variable = 12; $var = a_very(long_line('that', 'contains'), a_bunch('of long', 'parameters'), 'that_need to be aligned with the equal sign'); $var2 = 12; and now $var2 may not be aligned anymore. Maybe in this case alignment shall be allowed.

Comments

 [2007-07-08 09:38 UTC] squiz (Greg Sherwood)
Both the alignment and line length sniffs produce warnings only. PEAR does not require you to meet either of these standards; they just suggest sticking to these guidelines where you can. I can add an option to check the line length before suggesting the alignment, but I wont change the default settings of the PEAR standard without the PEAR CS being modified.
 [2007-07-11 23:01 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 Generic MultipleStatementAlignment sniff can now handle blocks of assignments where some of them may span multiple lines. Previously, assignments all had to be defined on a single line for them to be counted as a block. So the following code no longer produces errors: $variable = 12; $var = 'a very long line of text that contains ' .$someVar .' and some other stuff that is too long to fit on one line'; $var2 = 12;