Bug #19655 [Com]: [PSR2] "Commas in multi-line function declaration..." error that should not be
| From: | triplepoint | Date: | Tue, 23 Oct 2012 04:41:16 +0000 |
| Subject: | Bug #19655 [Com]: [PSR2] "Commas in multi-line function declaration..." error that should not be | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9206@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=19655&edit=1
ID: 19655
Comment by: triplepoint
Reported By: triplepoint at gmail dot com
Summary: [PSR2] "Commas in multi-line function declaration..."
error that should not be
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Archlinux
Package Version: 1.4.0
PHP Version: Irrelevant
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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 http://pear.php.net/bugs/bug.php?id=19655&edit=1