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

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

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 29, '12 at 5:07a
activeOct 29, '12 at 5:07a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase