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

ID: 18974
Comment by: brian.kendig@disney.com
Reported By: brian dot kendig at disney dot com
Summary: Blank line causes "Multi-line function call not
indented correctly"
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac OS X 10.6.8
Package Version: 1.3.1
PHP Version: 5.3.8
Roadmap Versions:
New Comment:

And a slight twist on this:


$bar = new stdClass(
4,
5,
6

);

The numbers are indented by four spaces each.

Put no spaces on the blank line, and phpcs complains "expected 4 spaces
but found 1".

Put 4 spaces on the blank line, and phpcs complains "expected 4 spaces
but found 5".

Put 3 spaces on the blank line, and phpcs accepts it.


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

[2011-11-08 22:45:28] bkendig

Description:
------------
Having a blank line (with or without whitespace) in a php object
definition or function call generates a "Multi-line function call not
indented correctly" error.

Test script:
---------------
$ cat foo.php
<?php
$foo = new stdClass(
1,
2,
3

);
$bar = new stdClass(
4,
5,
6
//bar
);


Expected result:
----------------
Nothing.


Actual result:
--------------
$ phpcs foo.php

FILE: /Users/brkendig/foo.php
------------------------------------------------------------------------
--------
FOUND 3 ERROR(S) AFFECTING 3 LINE(S)
------------------------------------------------------------------------
--------
2 | ERROR | Missing file doc comment
6 | ERROR | Multi-line function call not indented correctly;
expected 8
spaces but found 1
12 | ERROR | Multi-line function call not indented correctly;
expected 8
spaces but found 12
------------------------------------------------------------------------
--------

Time: 0 seconds, Memory: 3.00Mb

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

Search Discussions

  • Gsherwood at Nov 10, 2011 at 10:33 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18974&edit=1

    ID: 18974
    Updated by: gsherwood@squiz.net
    Reported By: brian dot kendig at disney dot com
    Summary: Blank line causes "Multi-line function call not
    indented correctly"
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Mac OS X 10.6.8
    Package Version: 1.3.1
    PHP Version: 5.3.8
    -Assigned To:
    +Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    Fix committed. A new error is now thrown for empty lines in multi-line
    function calls,
    replacing the old incorrect indentation error.


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

    [2011-11-08 22:50:56] bkendig

    And a slight twist on this:


    $bar = new stdClass(
    4,
    5,
    6

    );

    The numbers are indented by four spaces each.

    Put no spaces on the blank line, and phpcs complains "expected 4 spaces
    but found 1".

    Put 4 spaces on the blank line, and phpcs complains "expected 4 spaces
    but found 5".

    Put 3 spaces on the blank line, and phpcs accepts it.

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

    [2011-11-08 22:45:28] bkendig

    Description:
    ------------
    Having a blank line (with or without whitespace) in a php object
    definition or function call generates a "Multi-line function call not
    indented correctly" error.

    Test script:
    ---------------
    $ cat foo.php
    <?php
    $foo = new stdClass(
    1,
    2,
    3

    );
    $bar = new stdClass(
    4,
    5,
    6
    //bar
    );


    Expected result:
    ----------------
    Nothing.


    Actual result:
    --------------
    $ phpcs foo.php

    FILE: /Users/brkendig/foo.php
    ------------------------------------------------------------------------
    --------
    FOUND 3 ERROR(S) AFFECTING 3 LINE(S)
    ------------------------------------------------------------------------
    --------
    2 | ERROR | Missing file doc comment
    6 | ERROR | Multi-line function call not indented correctly;
    expected 8
    spaces but found 1
    12 | ERROR | Multi-line function call not indented correctly;
    expected 8
    spaces but found 12
    ------------------------------------------------------------------------
    --------

    Time: 0 seconds, Memory: 3.00Mb

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 8, '11 at 9:52p
activeNov 10, '11 at 10:33p
posts2
users2
websitepear.php.net

2 users in discussion

Brian Kendig: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase