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: Open
+Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac OS X 10.8.3
Package Version: SVN
PHP Version: 5.4.11
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-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.


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

[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
Discussion Overview
grouppear-bugs @
categoriesphp
postedMar 25, '13 at 4:07a
activeMar 25, '13 at 4:07a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase