FAQ
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
+Status: Open
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: No Feedback
+Status: Open



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

[2013-04-02 20:07:27] brodkin

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.

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

[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
}
);

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedApr 26, '13 at 7:01p
activeApr 26, '13 at 7:01p
posts1
users1
websitepear.php.net

1 user in discussion

Ryan: 1 post

People

Translate

site design / logo © 2022 Grokbase