Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.1.0

Request #20313 Undefined offset when using --sniffs
Submitted: 2014-06-24 12:35 UTC Modified: 2014-07-03 11:29 UTC
From: bergmann Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.3)
PHP Version: 5.4.29 OS: Mac OS X 10.9
Roadmaps: (Not assigned)    
Subscription  


 [2014-06-24 12:35 UTC] bergmann (r. 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 ...

Comments

 [2014-06-26 09:48 UTC] bergmann (r. bergmann)
PS: installed phpcs via Homebrew (brew doctor is fine)
 [2014-06-30 05:02 UTC] squiz (Greg Sherwood)
-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-30 11:41 UTC] bergmann (r. bergmann)
Ah, thanks. It works correctly using --standard. phpcs should, however, provide some useful output when this error occurs.
 [2014-07-02 01:54 UTC] squiz (Greg Sherwood)
-Status: Feedback +Status: Closed -Type: Bug +Type: Feature/Change Request
I agree, and have committed a proper error message here: https://github.com/squizlabs/PHP_CodeSniffer/commit/813833b7c5955d68f4ab3479cc 14acbf9e3cde8b
 [2014-07-03 11:29 UTC] bergmann (r. bergmann)
Thank you very much.