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

Request #13813 ScopeIndent with "exact" does not work properly
Submitted: 2008-04-30 15:50 UTC Modified: 2011-04-07 06:55 UTC
From: blacksheepkhan Assigned:
Status: Open Package: PHP_CodeSniffer (version 1.1.0a1)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2008-04-30 15:50 UTC] blacksheepkhan (Thomas Weidner)
Description: ------------ When the new ScopeIndentSniff is being extended to switch the "exact" boolean parameter on then it does not take in account doc indents. Reason: We want to have all indents fixed to 4 spaces, not more. But documentation (inline) lines should be ignored because they are checked elsewhere. Test script: --------------- class anything { /** * test */ public function xxxx Expected result: ---------------- No report expected because doc starts with 4 spaces and public also... The 1 space difference from within the doc (line * test and */) should be ignored. Actual result: -------------- Switching "exact" on throws error on "* test" and "*/" being 5 chars indent. Switching "exact" would not throw an error when indention is more than 4 for public or other lines.

Comments

 [2008-04-30 17:42 UTC] squiz (Greg Sherwood)
I'm marking this as a feature because that is exactly how the sniff was designed and also, as it happens, the reason I don't use that EXACT option. I'll add a new option to allow doc comments to be ignored. Then you can play around with the options to replicate the current functionality or ignore doc comments.
 [2008-05-02 15:30 UTC] blacksheepkhan (Thomas Weidner)
Within line 244 when I change it to be $column = ($contentLength - $trimmedContentLength); erasing the last + 1 all works as expected. But what I havn't seen before is that this sniff also tests within a multiline array scope. And I think also other multiline scopes. Maybe it would be better to have a option which allows to ignore defined scopes which are multiline.
 [2011-04-07 06:55 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Open
 [2011-07-14 15:29 UTC] mrhyde (Dariusz Czech)
When this fix from blacksheepkhan will be pushed in official package? I can confirm it is working.