FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19675&edit=1

ID: 19675
Comment by: chris@relidy.net
Reported By: chris@relidy.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
--------------------------------------------------------------------------------

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 25, '12 at 4:54p
activeOct 25, '12 at 4:54p
posts1
users1
websitepear.php.net

1 user in discussion

Chris: 1 post

People

Translate

site design / logo © 2022 Grokbase