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

ID: 19478
Updated by: shane.auckland@gmail.com
Reported By: shane dot auckland@gmail.com
-Summary: Incorrect indent detection
+Summary: Incorrect indent detection in PEAR standard
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Ubuntu 12.04
Package Version: 1.3.4
PHP Version: 5.3.10
Roadmap Versions:
New Comment:

-Summary: Incorrect indent detection
+Summary: Incorrect indent detection in PEAR standard



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

[2012-06-22 14:15:36] shanethehat

Description:
------------
There seems to be an error in the PEAR standard, in
PEAR.Functions.FunctionCallSignature.Indent. This incorrectly errors
with "Multi-line function call not indented correctly; expected (x)
spaces but found (x+4)" when presented with a multi-line function call
that contains nested object notation. The test should detect that there
is no comma after the first nested line, and that the second starts with
an object operator (->), and so not put out an error in this case.

Test script:
---------------
public function doSomething()
{
return $this->getFoo()
->doBar(
$this->getX() // no comma here
->doY() // this is still the first method argument
->doZ() // this is still the first method argument
);
}

// test using phpcs --standard=PEAR

Expected result:
----------------
Expected that this should pass the indent test

Actual result:
--------------
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
79 | ERROR | Multi-line function call not indented correctly; expected
16
spaces but found 20
80 | ERROR | Multi-line function call not indented correctly; expected
16
spaces but found 20
--------------------------------------------------------------------------------

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

Search Discussions

  • Shane Auckland at Jun 24, 2012 at 8:15 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19478&edit=1

    ID: 19478
    Comment by: shane.auckland@gmail.com
    Reported By: shane dot auckland@gmail.com
    Summary: Incorrect indent detection in PEAR standard
    Status: Open
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Ubuntu 12.04
    Package Version: 1.3.4
    PHP Version: 5.3.10
    Roadmap Versions:
    New Comment:

    Added a proposed patch. Please tell me if it is not in the correct
    format.


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

    [2012-06-24 10:19:32] shanethehat

    Added #patch
    bug:19478;patch:object-operator-indent-detection;revision:1340529572;.

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

    [2012-06-22 14:17:54] shanethehat

    -Summary: Incorrect indent detection
    +Summary: Incorrect indent detection in PEAR standard


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

    [2012-06-22 14:15:36] shanethehat

    Description:
    ------------
    There seems to be an error in the PEAR standard, in
    PEAR.Functions.FunctionCallSignature.Indent. This incorrectly errors
    with "Multi-line function call not indented correctly; expected (x)
    spaces but found (x+4)" when presented with a multi-line function call
    that contains nested object notation. The test should detect that there
    is no comma after the first nested line, and that the second starts with
    an object operator (->), and so not put out an error in this case.

    Test script:
    ---------------
    public function doSomething()
    {
    return $this->getFoo()
    ->doBar(
    $this->getX() // no comma here
    ->doY() // this is still the first method argument
    ->doZ() // this is still the first method argument
    );
    }

    // test using phpcs --standard=PEAR

    Expected result:
    ----------------
    Expected that this should pass the indent test

    Actual result:
    --------------
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
    79 | ERROR | Multi-line function call not indented correctly; expected
    16
    spaces but found 20
    80 | ERROR | Multi-line function call not indented correctly; expected
    16
    spaces but found 20
    --------------------------------------------------------------------------------

    ------------------------------------------------------------------------
  • Gsherwood at Jun 28, 2012 at 12:55 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19478&edit=1

    ID: 19478
    Updated by: gsherwood@squiz.net
    Reported By: shane dot auckland@gmail.com
    Summary: Incorrect indent detection in PEAR standard
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Ubuntu 12.04
    Package Version: 1.3.4
    PHP Version: 5.3.10
    -Assigned To:
    +Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    Patch worked great, thanks.

    Fix committed to github repo:
    https://github.com/squizlabs/PHP_CodeSniffer/commit/d269206f5fca287b277c832fd0
    2bcfcf55378b4a


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

    [2012-06-24 10:20:41] shanethehat

    Added a proposed patch. Please tell me if it is not in the correct
    format.

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

    [2012-06-24 10:19:32] shanethehat

    Added #patch
    bug:19478;patch:object-operator-indent-detection;revision:1340529572;.

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

    [2012-06-22 14:17:54] shanethehat

    -Summary: Incorrect indent detection
    +Summary: Incorrect indent detection in PEAR standard


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

    [2012-06-22 14:15:36] shanethehat

    Description:
    ------------
    There seems to be an error in the PEAR standard, in
    PEAR.Functions.FunctionCallSignature.Indent. This incorrectly errors
    with "Multi-line function call not indented correctly; expected (x)
    spaces but found (x+4)" when presented with a multi-line function call
    that contains nested object notation. The test should detect that there
    is no comma after the first nested line, and that the second starts with
    an object operator (->), and so not put out an error in this case.

    Test script:
    ---------------
    public function doSomething()
    {
    return $this->getFoo()
    ->doBar(
    $this->getX() // no comma here
    ->doY() // this is still the first method argument
    ->doZ() // this is still the first method argument
    );
    }

    // test using phpcs --standard=PEAR

    Expected result:
    ----------------
    Expected that this should pass the indent test

    Actual result:
    --------------
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
    79 | ERROR | Multi-line function call not indented correctly; expected
    16
    spaces but found 20
    80 | ERROR | Multi-line function call not indented correctly; expected
    16
    spaces but found 20
    --------------------------------------------------------------------------------

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJun 22, '12 at 12:12p
activeJun 28, '12 at 12:55a
posts3
users3
websitepear.php.net

People

Translate

site design / logo © 2022 Grokbase