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

Bug #18974 Blank line causes "Multi-line function call not indented correctly"
Submitted: 2011-11-09 03:45 UTC
From: bkendig Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.1)
PHP Version: 5.3.8 OS: Mac OS X 10.6.8
Roadmaps: (Not assigned)    
Subscription  


 [2011-11-09 03:45 UTC] bkendig (Brian Kendig)
Description: ------------ Having a blank line (with or without whitespace) in a php object definition or function call generates a "Multi-line function call not indented correctly" error. Test script: --------------- $ cat foo.php <?php $foo = new stdClass( 1, 2, 3 ); $bar = new stdClass( 4, 5, 6 //bar ); Expected result: ---------------- Nothing. Actual result: -------------- $ phpcs foo.php FILE: /Users/brkendig/foo.php ------------------------------------------------------------------------ -------- FOUND 3 ERROR(S) AFFECTING 3 LINE(S) ------------------------------------------------------------------------ -------- 2 | ERROR | Missing file doc comment 6 | ERROR | Multi-line function call not indented correctly; expected 8 | | spaces but found 1 12 | ERROR | Multi-line function call not indented correctly; expected 8 | | spaces but found 12 ------------------------------------------------------------------------ -------- Time: 0 seconds, Memory: 3.00Mb

Comments

 [2011-11-09 03:50 UTC] bkendig (Brian Kendig)
And a slight twist on this: $bar = new stdClass( 4, 5, 6 ); The numbers are indented by four spaces each. Put no spaces on the blank line, and phpcs complains "expected 4 spaces but found 1". Put 4 spaces on the blank line, and phpcs complains "expected 4 spaces but found 5". Put 3 spaces on the blank line, and phpcs accepts it.
 [2011-11-11 04:32 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed. A new error is now thrown for empty lines in multi-line function calls, replacing the old incorrect indentation error.