[PEAR-BUG] Bug #20354 [Fbk->Csd]: Scope indentation sniff doesn't assert too deep indentation

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=20354&edit=1

 ID:               20354
 Updated by:       [email protected]
 Reported By:      aik dot bold at gmail dot com
 Summary:          Scope indentation sniff doesn't assert too deep
                    indentation
-Status:           Feedback
+Status:           Closed
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: Linux
 Package Version:  1.5.3
 PHP Version:      5.4.20
 Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Status: Feedback
+Status: Closed



Previous Comments:
------------------------------------------------------------------------

[2014-08-05 09:28:11] aik099

Yes, I've witnessed that exact option reports multi-line array
declarations and maybe function calls as error.

Probably it's for the best to keep it disabled as you suggested.

------------------------------------------------------------------------

[2014-08-04 02:36:49] squiz

-Status:      Open
+Status:      Feedback
-Assigned To:
+Assigned To: squiz
This is by design. A lot of code is indented at least X spaces but it is
allowed to be 
indented more than that. For this reason, the sniff contains a setting
"exact" which is 
false by default. But you can use a custom ruleset to turn this flag on.
However, it is 
likely to generate a lot of false positives when you do things like
indent array 
elements, comments etc.

Just to clarify, this doesn't have anything to do with nested FOREACH
statements. 
Every type of statement is evaluated independently, as you suspected.

------------------------------------------------------------------------

[2014-07-30 12:12:29] aik099

Description:
------------
Example code:

foreach ( $sqls as $sql ) {
		$sql .= PHP_EOL;
}

As you can see I have 2 TABs instead of 1 to indent code inside 
foreach. Such case (where there are more whitepsaces, then 
needed) isn't reported as error.

I suspect that it was done to solve nested foreach problem, but I 
bet each foreach checks it's own scope only and doesn't traverse 
deep into different scopes.

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20354&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.