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

ID: 16778
Updated by: typo3-community@gmx.de
Reported By: typo3-community at gmx dot de
Summary: PHPCS can not deside how many spaces it wants (Zend
Coding Standard)
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Windows XP
Package Version: 1.2.0
PHP Version: 5.2.5
Roadmap Versions:
New Comment:

...wants 8 spaces for the first "}" (in line 36)...


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

[2009-11-10 09:46:31] daniela_waranie

Description:
------------
When validating the code (see test script) against the zend coding
standard, PHP CodeSniffer wants 8 spaces for the "}", after changing
from 12 to 8 it wants 12 spaces (loop).



Test script:
---------------
function isRelevantForAnalysis ($question)
{

switch ( $question['type'] ) {

//List
case 'L':
return true;
break;

//Yes/No
case 'Y':
return true;
break;

//Multiselect
case 'M':
return true;
break;

//Matix Field
case 'F':
return true;
break;

//Gender
case 'G':
return true;
break;

default:
//Date 'D'
//Short Text 'S'
return false;
break;
}
}

Expected result:
----------------
It works (8 spaces) when the "default:" block has a "break;". But note
"break;" is NOT mandatory. It should work without it!

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

Search Discussions

  • Gsherwood at Nov 10, 2009 at 8:56 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16778&edit=1

    ID: 16778
    Updated by: gsherwood@squiz.net
    Reported By: typo3-community at gmx dot de
    Summary: PHPCS can not deside how many spaces it wants (Zend
    Coding Standard)
    -Status: Open
    +Status: Duplicate
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows XP
    Package Version: 1.2.0
    PHP Version: 5.2.5
    -Assigned To:
    +Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Duplicate
    -Assigned To:
    +Assigned To: squiz
    This issue was reported as bug #16530 and has been fixed in SVN. You
    can install from SVN or wait for the next release (no date set).

    And yes, I am well aware that CASE and DEFAULT blocks do not require
    BREAK statements and PHP_CodeSniffer is specifically designed with this
    in mind.


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

    [2009-11-10 09:55:43] daniela_waranie

    ...wants 8 spaces for the first "}" (in line 36)...

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

    [2009-11-10 09:46:31] daniela_waranie

    Description:
    ------------
    When validating the code (see test script) against the zend coding
    standard, PHP CodeSniffer wants 8 spaces for the "}", after changing
    from 12 to 8 it wants 12 spaces (loop).



    Test script:
    ---------------
    function isRelevantForAnalysis ($question)
    {

    switch ( $question['type'] ) {

    //List
    case 'L':
    return true;
    break;

    //Yes/No
    case 'Y':
    return true;
    break;

    //Multiselect
    case 'M':
    return true;
    break;

    //Matix Field
    case 'F':
    return true;
    break;

    //Gender
    case 'G':
    return true;
    break;

    default:
    //Date 'D'
    //Short Text 'S'
    return false;
    break;
    }
    }

    Expected result:
    ----------------
    It works (8 spaces) when the "default:" block has a "break;". But note
    "break;" is NOT mandatory. It should work without it!

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 10, '09 at 8:56a
activeNov 10, '09 at 8:56a
posts2
users2
websitepear.php.net

2 users in discussion

Typo3-community: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase