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

  ID: 20457
  Comment by: woody.gilk@gmail.com
  Reported By: woody dot gilk@gmail.com
  Summary: PHPCS no longer respects the --tab-width flag
  Status: Open
  Type: Bug
  Package: PHP_CodeSniffer
  Operating System: OSX
  Package Version: 2.0.0
  PHP Version: 5.5.19
  Roadmap Versions:
  New Comment:

Confirmed that the same test script works correctly with phpcs v1.5.6


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

[2014-12-05 19:04:57] shadowhand

Description:
------------
We use PSR2, but with tabs instead of spaces. After upgrading to
PHPCS 2.0, the --tab-width=4 setting no longer works.

Reproduce with:

phpcs --standard=PSR2 --tab-width=4 Widget.php

Test script:
---------------
<?php

namespace Acme;

class Widget
{
  /**
   * @return boolean
   */
  public function shouldBeNoError()
  {
   return true;
  }
}


Expected result:
----------------
no output, no errors

Actual result:
--------------
FILE: Widget.php
--------------------------------------------------------------------------
------
FOUND 7 ERRORS AFFECTING 7 LINES
--------------------------------------------------------------------------
------
   7 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
   8 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
   9 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
  10 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
  11 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
  12 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
  13 | ERROR | [x] Spaces must be used to indent lines; tabs are
not allowed
--------------------------------------------------------------------------
------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS
AUTOMATICALLY
--------------------------------------------------------------------------
------

Time: 19ms; Memory: 3Mb

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

Search Discussions

  • Gsherwood at Dec 5, 2014 at 7:56 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=20457&edit=1

      ID: 20457
      Updated by: gsherwood@squiz.net
      Reported By: woody dot gilk@gmail.com
      Summary: PHPCS no longer respects the --tab-width flag
    -Status: Open
    +Status: Closed
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: OSX
      Package Version: 2.0.0
      PHP Version: 5.5.19
    -Assigned To:
    +Assigned To: squiz
      Roadmap Versions:
      New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    Moved to: https://github.com/squizlabs/PHP_CodeSniffer/issues/340


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

    [2014-12-05 19:11:27] shadowhand

    Confirmed that the same test script works correctly with phpcs v1.5.6

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

    [2014-12-05 19:04:57] shadowhand

    Description:
    ------------
    We use PSR2, but with tabs instead of spaces. After upgrading to
    PHPCS 2.0, the --tab-width=4 setting no longer works.

    Reproduce with:

    phpcs --standard=PSR2 --tab-width=4 Widget.php

    Test script:
    ---------------
    <?php

    namespace Acme;

    class Widget
    {
      /**
       * @return boolean
       */
      public function shouldBeNoError()
      {
       return true;
      }
    }


    Expected result:
    ----------------
    no output, no errors

    Actual result:
    --------------
    FILE: Widget.php
    --------------------------------------------------------------------------
    ------
    FOUND 7 ERRORS AFFECTING 7 LINES
    --------------------------------------------------------------------------
    ------
       7 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
       8 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
       9 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
      10 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
      11 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
      12 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
      13 | ERROR | [x] Spaces must be used to indent lines; tabs are
    not allowed
    --------------------------------------------------------------------------
    ------
    PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS
    AUTOMATICALLY
    --------------------------------------------------------------------------
    ------

    Time: 19ms; Memory: 3Mb

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 5, '14 at 6:06p
activeDec 5, '14 at 7:56p
posts2
users2
websitepear.php.net

2 users in discussion

Woody Gilk: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase