I'm trying to install PHP_CodeSniffer with Netbeans in my computer with Windows 7 64 bits.
So far...
1) I've downloaded from https://github.com/beberlei/netbeans-php-enhancements/downloads the file de-wh开发者_如何学运维itewashing-php-cs-1.1.1.nbm,
2)installed the plugin,
but when I go to Tools->Options it request Code Sniffer Script with a browse button, I don't know what that file is, and if a select phpcs.bat then in the next Standard drop down list nothing shows up. The menu item Show Code Standard Violation is disabled. How can I install this? Thanks! Guillermo.
The CodeSniffer script field is looking for the batch file that runs PHP CodeSniffer. The implication is that you should already have installed PHPCS before you get to that point.
If you were not already aware, the module written by Mr. Eberlei integrates PHPCS into Netbeans through PHPCS's API, not by provding the code sniffer functionality within the module itself.
If not installed already, get PEAR working on your XAMPP installation. After that's ready, then you can follow the instructions on the PHP_CodeSniffer page to install PHPCS itself.
Once that is installed, then you should have a ...path-to-PHP-installation-in-xampp...
/PEAR/PHP/CodeSniffer
directory, and under that, a Standards
directory with the default set of standards. That is what populates the Standard combo box. I vaguely remember having to restart Netbeans after setting the CodeSniffer script field in order for the module to populate the combo box properly. Once it is populated, then you choose from that list in the combo box which standard you want PHPCS to apply to your code.
I had the problem and I could fix it by adding the path containing the phpcs.bat to the windows system PATH variable. For a strange reason, the plugin also needs the environnement variable to be set ...
精彩评论