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

  ID: 20313
  Updated by: gsherwood@squiz.net
  Reported By: bergmann at berlitec dot de
  Summary: Undefined offset when using --sniffs
-Status: Open
+Status: Feedback
  Type: Bug
  Package: PHP_CodeSniffer
  Operating System: Mac OS X 10.9
  Package Version: 1.5.3
  PHP Version: 5.4.29
-Assigned To:
+Assigned To: squiz
  Roadmap Versions:
  New Comment:

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
The --sniffs argument requires a list of sniff codes but you've
specified an entire
standard.

If you want to limit the check to the PSR1 standard, you'd use:
phpcs --standard=PSR1 someFile.php

If you want to further limit this to a specific set of sniffs, you use
something like:
phpcs --standard=PSR1 --
sniffs=PSR1.Classes.ClassDeclaration,PSR1.Files.SideEffects
someFile.php

More docs here:
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-
Usage#limiting-results-to-specific-sniffs


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

[2014-06-26 10:48:06] bergmann

PS: installed phpcs via Homebrew (brew doctor is fine)

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

[2014-06-24 13:35:32] bergmann

Description:
------------
When running phpcs with --sniffs option I get the following error:
PHP Notice: Undefined offset: 2 in
/usr/local/Cellar/php-code-sniffer/1.5.3/CodeSniffer.php on line 441

Test script:
---------------
$ phpcs --sniffs=PSR1 someFile.php

Expected result:
----------------
phpcs report

Actual result:
--------------
PHP Notice: Undefined offset: 2 in
/usr/local/Cellar/php-code-sniffer/1.5.3/CodeSniffer.php on line 441

...

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

Search Discussions

  • Bergmann at Jun 30, 2014 at 10:26 am
    Edit report at https://pear.php.net/bugs/bug.php?id=20313&edit=1

      ID: 20313
      Updated by: bergmann@berlitec.de
      Reported By: bergmann at berlitec dot de
      Summary: Undefined offset when using --sniffs
      Status: Feedback
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: Mac OS X 10.9
      Package Version: 1.5.3
      PHP Version: 5.4.29
      Assigned To: squiz
      Roadmap Versions:
      New Comment:

    Ah, thanks. It works correctly using --standard.
    phpcs should, however, provide some useful output when this error
    occurs.


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

    [2014-06-30 06:02:48] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    The --sniffs argument requires a list of sniff codes but you've
    specified an entire
    standard.

    If you want to limit the check to the PSR1 standard, you'd use:
    phpcs --standard=PSR1 someFile.php

    If you want to further limit this to a specific set of sniffs, you use
    something like:
    phpcs --standard=PSR1 --
    sniffs=PSR1.Classes.ClassDeclaration,PSR1.Files.SideEffects
    someFile.php

    More docs here:
    https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-
    Usage#limiting-results-to-specific-sniffs

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

    [2014-06-26 10:48:06] bergmann

    PS: installed phpcs via Homebrew (brew doctor is fine)

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

    [2014-06-24 13:35:32] bergmann

    Description:
    ------------
    When running phpcs with --sniffs option I get the following error:
    PHP Notice: Undefined offset: 2 in
    /usr/local/Cellar/php-code-sniffer/1.5.3/CodeSniffer.php on line 441

    Test script:
    ---------------
    $ phpcs --sniffs=PSR1 someFile.php

    Expected result:
    ----------------
    phpcs report

    Actual result:
    --------------
    PHP Notice: Undefined offset: 2 in
    /usr/local/Cellar/php-code-sniffer/1.5.3/CodeSniffer.php on line 441

    ...

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJun 30, '14 at 3:47a
activeJun 30, '14 at 10:26a
posts2
users2
websitepear.php.net

2 users in discussion

Gsherwood: 1 post Bergmann: 1 post

People

Translate

site design / logo © 2022 Grokbase