xwp / WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
MIT License
29 stars 3 forks source link

Error using Wordpress sniffer in Sublime Text #29

Open lamakun opened 11 years ago

lamakun commented 11 years ago

I have tried to use this sniffer in Sublime Text, through plugin PHP CodeSniffer plugin. I pasted the code in CodeSniffer/Standrads folder (where some other standrads have already been copied).

Then in plugin configuration I set "WordPress-Coding-Standards-master" as standard to be checked against. When executing itI get the error:

Fatal error: Cannot redeclare class WordPress_Sniffs_Arrays_ArrayDeclarationSniff in D:\Dropbox\apps\EasyPHP-5.3.5.0\php\PEAR\pear\PHP\CodeSniffer\Standards\WordPress-Coding-Standards-master\Sniffs\Arrays\ArrayDeclarationSniff.php on line 23

Apparently it gets the Wordpress Standard code, but for some reason it does not execute well. I know this might be related to the plugin, but just in case, does anybody know why it happens??

Thanks!!

lamakun commented 11 years ago

Well, I just changed the name of the folder from "WordPress-Coding-Standards-master" to "Wordpress" and changed in PHP_CodeSniffer Sublime Text plugin and started working properly. Not sure this was the reason of the error but the point is it is now fine. Any reason or comment on that?

Thanks!!

Edit: Since it is working and I have found hundreds of error, I realize how useful a fixer would be (kind of http://cs.sensiolabs.org/ for PSR-1 and PSR-2). Is there anything like this for Wordpress standard? Thanks again.