Bug #19675 [Opn->Csd]: Improper indent of nested anonymous function bodies in a call
| From: | gsherwood at squiz dot net | Date: | Mon, 29 Oct 2012 05:07:19 +0000 |
| Subject: | Bug #19675 [Opn->Csd]: Improper indent of nested anonymous function bodies in a call | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9264@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19675&edit=1
ID: 19675
Updated by: gsherwood@squiz.net
Reported By: chris at relidy dot net
Summary: Improper indent of nested anonymous function bodies
in a call
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Gentoo
Package Version: 1.4.0
PHP Version: 5.3.17
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
Fixed committed to github repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/920b8a6a3b1845a8e8d60325f
553d7d70a69672e
Really clear bug report. Thanks a lot.
Previous Comments:
------------------------------------------------------------------------
[2012-10-25 17:53:57] arlaneenalra
Config used to cause the odd behavior:
<?xml version="1.0"?>
<ruleset name="Scope Indent issue">
<description>Scope Indent issue</description>
<rule ref="Generic.WhiteSpace.ScopeIndent" />
</ruleset>
------------------------------------------------------------------------
[2012-10-25 17:49:11] arlaneenalra
Description:
------------
The Generic WhiteSpace Indent sniffer is giving some very strange
results
for the body of a nested anonymous function declared as an argument to a
function call.
Test script:
---------------
<?php
$var = call_user_func(
function () {
$a = 1;
$new_var = function () use (&$a) {
if ($a > 0 ) {
return $a++;
} else {
return $a--;
}
}
return $new_var
}
);
Expected result:
----------------
No errors
Actual result:
--------------
--------------------------------------------------------------------------------
FOUND 4 ERROR(S) AFFECTING 4 LINE(S)
--------------------------------------------------------------------------------
7 | ERROR | Line indented incorrectly; expected 23 spaces, found 12
8 | ERROR | Line indented incorrectly; expected at least 27 spaces,
found
16
9 | ERROR | Line indented incorrectly; expected 23 spaces, found 12
10 | ERROR | Line indented incorrectly; expected at least 27 spaces,
found 16
--------------------------------------------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19675&edit=1