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

ID: 18140
Updated by: gsherwood@squiz.net
Reported By: office at mediaself dot pl
Summary: Generic scope indent in exact mode: strange
expected/found values for switch
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Ubuntu Linux 10.10
Package Version: 1.3.0RC1
PHP Version: 5.3.3
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Problem was caused by the sniff checking the semi-colon for indentation
rules when it should actually be ignored due to it being part of the
CASE's scope closer.


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

[2010-12-22 18:56:55] ryba

Description:
------------
When I go into exact mode with Generic WhiteSpace ScopeIndent sniff, I
get very strange expected values (13 instead of 4 or 8), as reported
below...

I removed all coments so that they don't incluence the exact mode, as
reported here: https://pear.php.net/bugs/bug.php?id=13813

Cheers,
Piotrek

Test script:
---------------
<?php
$x = 333;
switch ( $x )
{
case 666:
$y = 999;
break;
case 555:
$y = 444;
break;
}

Expected result:
----------------
No errors OR:

--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
7 | ERROR | Line indented incorrectly; expected 4 spaces, found 8
(Generic.WhiteSpace.ScopeIndent.IncorrectExact)
10 | ERROR | Line indented incorrectly; expected 4 spaces, found 8
(Generic.WhiteSpace.ScopeIndent.IncorrectExact)
--------------------------------------------------------------------------------

Actual result:
--------------
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
7 | ERROR | Line indented incorrectly; expected 4 spaces, found 13
(Generic.WhiteSpace.ScopeIndent.IncorrectExact)
10 | ERROR | Line indented incorrectly; expected 4 spaces, found 13
(Generic.WhiteSpace.ScopeIndent.IncorrectExact)
--------------------------------------------------------------------------------

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

Search Discussions

  • Office at Jan 12, 2011 at 6:38 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18140&edit=1

    ID: 18140
    Comment by: office@mediaself.pl
    Reported By: office at mediaself dot pl
    Summary: Generic scope indent in exact mode: strange
    expected/found values for switch
    Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Ubuntu Linux 10.10
    Package Version: 1.3.0RC1
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Seems OK now.


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

    [2011-01-11 06:35:58] squiz

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on pear.php.net
    by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

    Problem was caused by the sniff checking the semi-colon for indentation
    rules when it should actually be ignored due to it being part of the
    CASE's scope closer.

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

    [2010-12-22 18:56:55] ryba

    Description:
    ------------
    When I go into exact mode with Generic WhiteSpace ScopeIndent sniff, I
    get very strange expected values (13 instead of 4 or 8), as reported
    below...

    I removed all coments so that they don't incluence the exact mode, as
    reported here: https://pear.php.net/bugs/bug.php?id=13813

    Cheers,
    Piotrek

    Test script:
    ---------------
    <?php
    $x = 333;
    switch ( $x )
    {
    case 666:
    $y = 999;
    break;
    case 555:
    $y = 444;
    break;
    }

    Expected result:
    ----------------
    No errors OR:

    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
    7 | ERROR | Line indented incorrectly; expected 4 spaces, found 8
    (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
    10 | ERROR | Line indented incorrectly; expected 4 spaces, found 8
    (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
    --------------------------------------------------------------------------------

    Actual result:
    --------------
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
    7 | ERROR | Line indented incorrectly; expected 4 spaces, found 13
    (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
    10 | ERROR | Line indented incorrectly; expected 4 spaces, found 13
    (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
    --------------------------------------------------------------------------------

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 11, '11 at 5:34a
activeJan 12, '11 at 6:38a
posts2
users2
websitepear.php.net

2 users in discussion

Office: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase