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

ID: 19868
Updated by: gsherwood@squiz.net
Reported By: ryan@brodkinca.com
Summary: Anonymous Functions Break ML Function Sniff
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac OS X 10.8.3
Package Version: SVN
PHP Version: 5.4.11
Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Feedback
+Status: No Feedback



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

[2013-03-25 05:07:44] squiz

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
The only way I can replicate your problem is to revert PHP_CodeSniffer
to version
1.4.0. In version 1.4.1, bug #19655 was fixed, which looks to be the
exact same
problem as this report.

Are you sure you have the latest version of PHP_CodeSniffer? Run "phpcs
--version"
to find out. The latest stable version is 1.4.4.

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

[2013-03-24 22:01:39] brodkin

Description:
------------
Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterComma
improperly reports that "Commas in multi-line function
declarations must be the last content on a line." when commas
are used as part of an anonymous function declaration and the
anonymous function is utilized as a value.

Test script:
---------------
any_function_or_method_call(
"value",
function ($foo, $bar) {
// code
}
);

Expected result:
----------------
Sniff should pass. Anonymous function declaration is not multiline
and should be sniffed independent of its parent.

Actual result:
--------------
Sniff fails. The only way to pass the sniff is to force all child
functions of a multiline sniff to also appear as multiline:

any_function_or_method_call(
"value",
function (
$foo,
$bar
) {
// code
}
);

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

Search Discussions

  • Ryan at Apr 2, 2013 at 6:06 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19868&edit=1

    ID: 19868
    Updated by: ryan@brodkinca.com
    Reported By: ryan@brodkinca.com
    Summary: Anonymous Functions Break ML Function Sniff
    Status: No Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Mac OS X 10.8.3
    Package Version: SVN
    PHP Version: 5.4.11
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Greg,

    Sorry for the delay. I submitted a lot of bugs and code on the same day
    and am just
    catching up now. You are correct that the most recent stable release
    does not display
    this behavior. The behavior was encountered in
    a7e559728184560daa93462220d9bba1a66b97f0.


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

    [2013-04-02 02:43:06] squiz

    -Status: Feedback
    +Status: No Feedback


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

    [2013-03-25 05:07:44] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    The only way I can replicate your problem is to revert PHP_CodeSniffer
    to version
    1.4.0. In version 1.4.1, bug #19655 was fixed, which looks to be the
    exact same
    problem as this report.

    Are you sure you have the latest version of PHP_CodeSniffer? Run "phpcs
    --version"
    to find out. The latest stable version is 1.4.4.

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

    [2013-03-24 22:01:39] brodkin

    Description:
    ------------
    Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterComma
    improperly reports that "Commas in multi-line function
    declarations must be the last content on a line." when commas
    are used as part of an anonymous function declaration and the
    anonymous function is utilized as a value.

    Test script:
    ---------------
    any_function_or_method_call(
    "value",
    function ($foo, $bar) {
    // code
    }
    );

    Expected result:
    ----------------
    Sniff should pass. Anonymous function declaration is not multiline
    and should be sniffed independent of its parent.

    Actual result:
    --------------
    Sniff fails. The only way to pass the sniff is to force all child
    functions of a multiline sniff to also appear as multiline:

    any_function_or_method_call(
    "value",
    function (
    $foo,
    $bar
    ) {
    // code
    }
    );

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedApr 2, '13 at 12:42a
activeApr 2, '13 at 6:06p
posts2
users2
websitepear.php.net

2 users in discussion

Ryan: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase