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

Request #20313 Undefined offset when using --sniffs
Submitted: 2014-06-24 17:35 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 17: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 14:48 UTC] bergmann (r. bergmann)
PS: installed phpcs via Homebrew (brew doctor is fine)
 [2014-06-30 10: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 16: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 06: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 16:29 UTC] bergmann (r. bergmann)
Thank you very much.