Bug #19655 [Com]: Closures reporting as multi-line when they are not
| From: | gnutix@gmail.com | Date: | Fri, 26 Oct 2012 06:40:34 +0000 |
| Subject: | Bug #19655 [Com]: Closures reporting as multi-line when they are not | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9249@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19655&edit=1
ID: 19655
Comment by: gnutix@gmail.com
Reported By: gnutix at gmail dot com
Summary: Closures reporting as multi-line when they are not
Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Archlinux
Package Version: 1.4.0
PHP Version: Irrelevant
Assigned To: squiz
Roadmap Versions:
New Comment:
Thanks a lot for your hard work guys ! :)
Previous Comments:
------------------------------------------------------------------------
[2012-10-26 04:17:27] squiz
-Status: Assigned
+Status: Closed
Fixed in github repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/53696950ac850628d90c217a0
5ba2565dd380b0f
------------------------------------------------------------------------
[2012-10-26 04:02:46] squiz
-Summary: [PSR2] "Commas in multi-line function
declaration..." error that should not be
+Summary: Closures reporting as multi-line when they
are not
-Assigned To:
+Assigned To: squiz
------------------------------------------------------------------------
[2012-10-23 05:39:42] triplepoint
I've got a fix prepared for this bug:
https://github.com/squizlabs/PHP_CodeSniffer/pull/64
Not sure how this project is managing pull requests (github vs pear).
Feel free to offer guidance.
------------------------------------------------------------------------
[2012-10-17 14:32:06] gnutix
Description:
------------
When using for example a callback function with multiple
parameters in a "function call on multiple lines", the comma
used to separate
the callback function parameters is interpreted as a "main
function parameter separator".
This produce the error "Commas in multi-line function
declarations must be the last content on a line", even though it
should not.
Test script:
---------------
<?php // foo.php
$data = array('foo', 'bar', 'baz');
usort(
$data,
function ($a, $b) {
// body
}
);
Expected result:
----------------
$ phpcs foo.php --standard=PSR2
Time: 0 seconds, Memory: 4.25Mb
Actual result:
--------------
$ phpcs foo.php --standard=PSR2
FILE: /home/lamp/foo.php
------------------------------------------------------------------------
--------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
------------------------------------------------------------------------
--------
5 | ERROR | Commas in multi-line function declarations must
be the last
content on a line
------------------------------------------------------------------------
--------
Time: 0 seconds, Memory: 4.25Mb
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19655&edit=1