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

ID: 17697
Updated by: gsherwood@squiz.net
Reported By: pear at sebastianmendel dot de
Summary: PEAR sniff FunctionCallSignature does not allow same
rules as MultiLineAssignme
-Status: Open
+Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Linux
Package Version: 1.2.2
PHP Version: 5.3.3
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
I really don't think this was the intention of the multi-line assignment
or function call statements in the standard. The intention is to make
code more readable, while allowing multi-line assignments inside
function calls does the opposite.

I personally believe the variable should be assigned outside the
function call and then used within it, either by reference or otherwise
(whatever the intention of the code). But I don't make the rules for
PEAR. I just try to interpret them.

If you strongly disagree, I suggest sending an email to the pear-dev or
pear-qa mailing list and asking for another interpretation. If the call
comes down to make the change, I certainly will.


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

[2010-08-13 09:31:51] cybot

Description:
------------
Sniff PEAR.Functions.FunctionCallSignature complains about intention in
multiline function class, but is wrong

PEAR.Functions.FunctionCallSignature should allow intention in multiline
assignments in function calls

Test script:
---------------
test.php
<?php
foo(
$bar
= "foobar"
. $foobar
);
foo(
$bar
= "foobar"
. $foobar
);
?>

phpcs --standard=PEAR -s test.php

Expected result:
----------------
9 | ERROR | Multi-line assignment not indented correctly; expected 8
spaces but found 4 (PEAR.Formatting.MultiLineAssignment)

Actual result:
--------------
4 | ERROR | Multi-line function call not indented correctly; expected 4
spaces but found 8 (PEAR.Functions.FunctionCallSignature)
5 | ERROR | Multi-line function call not indented correctly; expected 4
spaces but found 8 (PEAR.Functions.FunctionCallSignature)
9 | ERROR | Multi-line assignment not indented correctly; expected 8
spaces but found 4 (PEAR.Formatting.MultiLineAssignment)

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

Search Discussions

  • Pear at Aug 16, 2010 at 8:28 am
    Edit report at http://pear.php.net/bugs/bug.php?id=17697&edit=1

    ID: 17697
    Updated by: pear@sebastianmendel.de
    Reported By: pear at sebastianmendel dot de
    Summary: PEAR sniff FunctionCallSignature does not allow same
    rules as MultiLineAssignme
    Status: Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Linux
    Package Version: 1.2.2
    PHP Version: 5.3.3
    -Assigned To: squiz
    +Assigned To: cweiske
    Roadmap Versions:
    New Comment:

    -Assigned To: squiz
    +Assigned To: cweiske
    i sent Christian Weiske a notice, maybe he knows


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

    [2010-08-15 23:35:11] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    I really don't think this was the intention of the multi-line assignment
    or function call statements in the standard. The intention is to make
    code more readable, while allowing multi-line assignments inside
    function calls does the opposite.

    I personally believe the variable should be assigned outside the
    function call and then used within it, either by reference or otherwise
    (whatever the intention of the code). But I don't make the rules for
    PEAR. I just try to interpret them.

    If you strongly disagree, I suggest sending an email to the pear-dev or
    pear-qa mailing list and asking for another interpretation. If the call
    comes down to make the change, I certainly will.

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

    [2010-08-13 09:31:51] cybot

    Description:
    ------------
    Sniff PEAR.Functions.FunctionCallSignature complains about intention in
    multiline function class, but is wrong

    PEAR.Functions.FunctionCallSignature should allow intention in multiline
    assignments in function calls

    Test script:
    ---------------
    test.php
    <?php
    foo(
    $bar
    = "foobar"
    . $foobar
    );
    foo(
    $bar
    = "foobar"
    . $foobar
    );
    ?>

    phpcs --standard=PEAR -s test.php

    Expected result:
    ----------------
    9 | ERROR | Multi-line assignment not indented correctly; expected 8
    spaces but found 4 (PEAR.Formatting.MultiLineAssignment)

    Actual result:
    --------------
    4 | ERROR | Multi-line function call not indented correctly; expected 4
    spaces but found 8 (PEAR.Functions.FunctionCallSignature)
    5 | ERROR | Multi-line function call not indented correctly; expected 4
    spaces but found 8 (PEAR.Functions.FunctionCallSignature)
    9 | ERROR | Multi-line assignment not indented correctly; expected 8
    spaces but found 4 (PEAR.Formatting.MultiLineAssignment)

    ------------------------------------------------------------------------
  • Gsherwood at Aug 23, 2010 at 1:53 am
    Edit report at http://pear.php.net/bugs/bug.php?id=17697&edit=1

    ID: 17697
    Updated by: gsherwood@squiz.net
    Reported By: pear at sebastianmendel dot de
    Summary: PEAR sniff FunctionCallSignature does not allow same
    rules as MultiLineAssignme
    -Status: Feedback
    +Status: No Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Linux
    Package Version: 1.2.2
    PHP Version: 5.3.3
    Assigned To: cweiske
    Roadmap Versions:
    New Comment:

    -Status: Feedback
    +Status: No Feedback
    Please re-open if a decision is made. I haven't seen anything on the dev
    list yet.


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

    [2010-08-16 08:28:54] cybot

    -Assigned To: squiz
    +Assigned To: cweiske
    i sent Christian Weiske a notice, maybe he knows

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

    [2010-08-15 23:35:11] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    I really don't think this was the intention of the multi-line assignment
    or function call statements in the standard. The intention is to make
    code more readable, while allowing multi-line assignments inside
    function calls does the opposite.

    I personally believe the variable should be assigned outside the
    function call and then used within it, either by reference or otherwise
    (whatever the intention of the code). But I don't make the rules for
    PEAR. I just try to interpret them.

    If you strongly disagree, I suggest sending an email to the pear-dev or
    pear-qa mailing list and asking for another interpretation. If the call
    comes down to make the change, I certainly will.

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

    [2010-08-13 09:31:51] cybot

    Description:
    ------------
    Sniff PEAR.Functions.FunctionCallSignature complains about intention in
    multiline function class, but is wrong

    PEAR.Functions.FunctionCallSignature should allow intention in multiline
    assignments in function calls

    Test script:
    ---------------
    test.php
    <?php
    foo(
    $bar
    = "foobar"
    . $foobar
    );
    foo(
    $bar
    = "foobar"
    . $foobar
    );
    ?>

    phpcs --standard=PEAR -s test.php

    Expected result:
    ----------------
    9 | ERROR | Multi-line assignment not indented correctly; expected 8
    spaces but found 4 (PEAR.Formatting.MultiLineAssignment)

    Actual result:
    --------------
    4 | ERROR | Multi-line function call not indented correctly; expected 4
    spaces but found 8 (PEAR.Functions.FunctionCallSignature)
    5 | ERROR | Multi-line function call not indented correctly; expected 4
    spaces but found 8 (PEAR.Functions.FunctionCallSignature)
    9 | ERROR | Multi-line assignment not indented correctly; expected 8
    spaces but found 4 (PEAR.Formatting.MultiLineAssignment)

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 15, '10 at 11:35p
activeAug 23, '10 at 1:53a
posts3
users2
websitepear.php.net

2 users in discussion

Gsherwood: 2 posts Pear: 1 post

People

Translate

site design / logo © 2022 Grokbase