Bug #19675 [Com]: Improper indent of nested anonymous function bodies in a call
| From: | chris@relidy.net | Date: | Thu, 25 Oct 2012 16:53:57 +0000 |
| Subject: | Bug #19675 [Com]: 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-9238@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
Comment by: chris@relidy.net
Reported By: chris at relidy dot net
Summary: Improper indent of nested anonymous function bodies
in a call
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Gentoo
Package Version: 1.4.0
PHP Version: 5.3.17
Roadmap Versions:
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[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