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

Bug #21005 Incorrect indent detection when multiple properties are initialized to arrays
Submitted: 2015-12-17 22:46 UTC
From: h3xx Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 2.5.0)
PHP Version: 5.6.15 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2015-12-17 22:46 UTC] h3xx (Dan Church)
Description: ------------ Using an array (either short or long) in an instance property causes Generic.WhiteSpace.ScopeIndent.IncorrectExact to expect lines below it to have +1 indent. Run phpcs on the script attached: phpcs -s --sniffs=Generic.WhiteSpace.ScopeIndent test.php Test script: --------------- <?php class Test { public $foo ,$bar ,$baz = [ ] ; public function wtfindent() { } } Expected result: ---------------- No output Actual result: -------------- FILE: ...urch@dev/public_html/code/smartco/ec/php/eclib/d atabase/test.php ------------------------------------------------------------ ---------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------ ---------- 11 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found | | 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) ------------------------------------------------------------ ---------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------ ---------- Time: 98ms; Memory: 2.5Mb

Comments

 [2015-12-20 23:40 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Thanks for reporting. A fix has been committed: https://github.com/squizlabs/PHP_CodeSniffer/commit/84d9ecb136a36e2f93a4b3420d6df48979f566f d