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

ID: 19926
Updated by: daniel@danielgimenes.com.br
Reported By: daniel@danielgimenes.com dot br
Summary: PSR2 - Incorrect sniff inherited from PEAR
Status: Bogus
Type: Bug
Package: PHP_CodeSniffer
Operating System: Ubuntu 12.10 Quantal Quetzal
Package Version: 1.4.5
PHP Version: 5.4.14
Assigned To: squiz
Roadmap Versions:
New Comment:

Oh! Now I got it, thanks!


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

[2013-05-02 00:23:34] squiz

If you visited the link I provided, you'll see that it points to section
4.6. Method and
Function Calls of the PSR-2 standard. We're talking about the same
thing.

What you have is not valid as per that part of the standard.

It clearly states that you MAY split your call over multiple lines
(obviously when you
arg list makes it necessary) and that if you do, you MUST start the
first item on the
next line.

Please note that there is a section in the standard about method
declarations which
defines the exact same rule. These are different rules, but use almost
the same
text.

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

[2013-05-01 23:12:47] danizord

I'm not talking about method declaration, but function call. See:

$this->myFunction(array(
'test1',
'test2',
));

OR

throw new InvalidArgumentException(sprintf(
'%s is invalid',
$param
));

This is valid in PSR-2

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

[2013-05-01 06:06:26] squiz

Yes, it is part of the PSR-2 standard.

https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-
guide.md#46-method-and-function-calls

"Argument lists MAY be split across multiple lines, where each
subsequent line is
indented once. When doing so, the first item in the list MUST be on the
next line,
and there MUST be only one argument per line."

Also look at the example code under that text.

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

[2013-05-01 03:09:28] danizord

I got it, but this rule is not part of PSR-2 Standard. So this sniff
need to be removed.

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

[2013-05-01 02:38:04] squiz

-Status: Open
+Status: Bogus
-Assigned To:
+Assigned To: squiz
The sniff was not inherited from the PEAR standard; it was specifically
selected so
that it could implement part of the PSR2 standard. See the ruleset here:

https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/
PSR2/ruleset.xml#L133

Standards grab sniffs from other standards so they don't duplicate code.
It's a core
feature of PHP_CodeSniffer's standard implementation. The code may refer
to
PEAR, but that is only to allow you to see where the sniff exists and to
let you
override the error messages globally.

If you want to see where all the sniffs are coming from to generate the
PSR2
standard, run: phpcs -e --standard=PSR2

Only 9 of the 40 sniffs are actually PSR2-specific.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=19926

Search Discussions

  • Daniel at May 2, 2013 at 2:19 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19926&edit=1

    ID: 19926
    Updated by: daniel@danielgimenes.com.br
    Reported By: daniel@danielgimenes.com dot br
    Summary: PSR2 - Incorrect sniff inherited from PEAR
    -Status: Bogus
    +Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Ubuntu 12.10 Quantal Quetzal
    Package Version: 1.4.5
    PHP Version: 5.4.14
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Bogus
    +Status: Closed



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

    [2013-05-02 16:19:55] danizord

    Oh! Now I got it, thanks!

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

    [2013-05-02 00:23:34] squiz

    If you visited the link I provided, you'll see that it points to section
    4.6. Method and
    Function Calls of the PSR-2 standard. We're talking about the same
    thing.

    What you have is not valid as per that part of the standard.

    It clearly states that you MAY split your call over multiple lines
    (obviously when you
    arg list makes it necessary) and that if you do, you MUST start the
    first item on the
    next line.

    Please note that there is a section in the standard about method
    declarations which
    defines the exact same rule. These are different rules, but use almost
    the same
    text.

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

    [2013-05-01 23:12:47] danizord

    I'm not talking about method declaration, but function call. See:

    $this->myFunction(array(
    'test1',
    'test2',
    ));

    OR

    throw new InvalidArgumentException(sprintf(
    '%s is invalid',
    $param
    ));

    This is valid in PSR-2

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

    [2013-05-01 06:06:26] squiz

    Yes, it is part of the PSR-2 standard.

    https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-
    guide.md#46-method-and-function-calls

    "Argument lists MAY be split across multiple lines, where each
    subsequent line is
    indented once. When doing so, the first item in the list MUST be on the
    next line,
    and there MUST be only one argument per line."

    Also look at the example code under that text.

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

    [2013-05-01 03:09:28] danizord

    I got it, but this rule is not part of PSR-2 Standard. So this sniff
    need to be removed.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=19926
  • Daniel at May 2, 2013 at 4:59 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19926&edit=1

    ID: 19926
    Updated by: daniel@danielgimenes.com.br
    Reported By: daniel@danielgimenes.com dot br
    Summary: PSR2 - Incorrect sniff inherited from PEAR
    -Status: Closed
    +Status: Open
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Ubuntu 12.10 Quantal Quetzal
    Package Version: 1.4.5
    PHP Version: 5.4.14
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Closed
    +Status: Open
    See https://github.com/zendframework/zf2/issues/4390


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

    [2013-05-02 16:20:57] danizord

    -Status: Bogus
    +Status: Closed


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

    [2013-05-02 16:19:55] danizord

    Oh! Now I got it, thanks!

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

    [2013-05-02 00:23:34] squiz

    If you visited the link I provided, you'll see that it points to section
    4.6. Method and
    Function Calls of the PSR-2 standard. We're talking about the same
    thing.

    What you have is not valid as per that part of the standard.

    It clearly states that you MAY split your call over multiple lines
    (obviously when you
    arg list makes it necessary) and that if you do, you MUST start the
    first item on the
    next line.

    Please note that there is a section in the standard about method
    declarations which
    defines the exact same rule. These are different rules, but use almost
    the same
    text.

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

    [2013-05-01 23:12:47] danizord

    I'm not talking about method declaration, but function call. See:

    $this->myFunction(array(
    'test1',
    'test2',
    ));

    OR

    throw new InvalidArgumentException(sprintf(
    '%s is invalid',
    $param
    ));

    This is valid in PSR-2

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

    [2013-05-01 06:06:26] squiz

    Yes, it is part of the PSR-2 standard.

    https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-
    guide.md#46-method-and-function-calls

    "Argument lists MAY be split across multiple lines, where each
    subsequent line is
    indented once. When doing so, the first item in the list MUST be on the
    next line,
    and there MUST be only one argument per line."

    Also look at the example code under that text.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=19926
  • Gsherwood at May 2, 2013 at 11:08 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19926&edit=1

    ID: 19926
    Updated by: gsherwood@squiz.net
    Reported By: daniel@danielgimenes.com dot br
    Summary: PSR2 - Incorrect sniff inherited from PEAR
    -Status: Assigned
    +Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Ubuntu 12.10 Quantal Quetzal
    Package Version: 1.4.5
    PHP Version: 5.4.14
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Assigned
    +Status: Closed
    I've commented on the issue you submitted.

    There is no need to reopen this report. If the standard is clarified, I
    will make the
    changes to PHP_CodeSniffer without prompting.

    Thanks for linking the issue. It gave me a chance to comment somewhere
    it might be
    discussed more widely.


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

    [2013-05-02 19:01:15] danizord

    -Status: Closed
    +Status: Open
    See https://github.com/zendframework/zf2/issues/4390

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

    [2013-05-02 16:20:57] danizord

    -Status: Bogus
    +Status: Closed


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

    [2013-05-02 16:19:55] danizord

    Oh! Now I got it, thanks!

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

    [2013-05-02 00:23:34] squiz

    If you visited the link I provided, you'll see that it points to section
    4.6. Method and
    Function Calls of the PSR-2 standard. We're talking about the same
    thing.

    What you have is not valid as per that part of the standard.

    It clearly states that you MAY split your call over multiple lines
    (obviously when you
    arg list makes it necessary) and that if you do, you MUST start the
    first item on the
    next line.

    Please note that there is a section in the standard about method
    declarations which
    defines the exact same rule. These are different rules, but use almost
    the same
    text.

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

    [2013-05-01 23:12:47] danizord

    I'm not talking about method declaration, but function call. See:

    $this->myFunction(array(
    'test1',
    'test2',
    ));

    OR

    throw new InvalidArgumentException(sprintf(
    '%s is invalid',
    $param
    ));

    This is valid in PSR-2

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=19926

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMay 2, '13 at 2:18p
activeMay 2, '13 at 11:08p
posts4
users2
websitepear.php.net

2 users in discussion

Daniel: 3 posts Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase