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

Bug #19478 Incorrect indent detection in PEAR standard
Submitted: 2012-06-22 18:15 UTC
From: shanethehat Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.4)
PHP Version: 5.3.10 OS: Ubuntu 12.04
Roadmaps: (Not assigned)    
Subscription  


 [2012-06-22 18:15 UTC] shanethehat (Shane Auckland)
Description: ------------ There seems to be an error in the PEAR standard, in PEAR.Functions.FunctionCallSignature.Indent. This incorrectly errors with "Multi-line function call not indented correctly; expected (x) spaces but found (x+4)" when presented with a multi-line function call that contains nested object notation. The test should detect that there is no comma after the first nested line, and that the second starts with an object operator (->), and so not put out an error in this case. Test script: --------------- public function doSomething() { return $this->getFoo() ->doBar( $this->getX() // no comma here ->doY() // this is still the first method argument ->doZ() // this is still the first method argument ); } // test using phpcs --standard=PEAR Expected result: ---------------- Expected that this should pass the indent test Actual result: -------------- -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 79 | ERROR | Multi-line function call not indented correctly; expected 16 | | spaces but found 20 80 | ERROR | Multi-line function call not indented correctly; expected 16 | | spaces but found 20 --------------------------------------------------------------------------------

Comments

 [2012-06-22 18:17 UTC] shanethehat (Shane Auckland)
-Summary: Incorrect indent detection +Summary: Incorrect indent detection in PEAR standard
 [2012-06-24 14:19 UTC] shanethehat (Shane Auckland)
 [2012-06-24 14:20 UTC] shanethehat (Shane Auckland)
Added a proposed patch. Please tell me if it is not in the correct format.
 [2012-06-28 07:00 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Patch worked great, thanks. Fix committed to github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/d269206f5fca287b277c832fd0 2bcfcf55378b4a