PhpStorm and PHPCodeSniffer on Windows
I've been wanting to get onto PHPCS for quite some time now. While reading a blog post discussing it, I decided it was now or never. I should have started using PHPCS a while ago anyway...
So, in order to get things up and running, I did a quick Google search and ended up finding a pretty good tutorial, except that it is slightly outdated. Some of the instructions did not match the latest version of PhpStorm.
The article is How to Setup PHP Code Sniffer in Phpstorm on a Windows Machine from W3Guy.com.
NOTE: At the time of writing this article, I was running PhpStorm version 2016.2.1.
Most of the instructions are correct, except for a couple of them. Here is an updated version of the outdated steps. Also, you'll need to have PEAR installed on your local machine beforehand.
You will actually need to copy all the WordPress-xxx directories in CodeSniffer's Standards directory as they rely on one another (otherwise you'll get errors in PhpStorm).
Also, because I'm only using standard PHP on my local machine (no XAMPP or any pre-packaged web server), PHPCS was located in C:\php\pear\PHP\CodeSniffer.
The setting you're looking for is now located in Languages & Frameworks | PHP | Code Sniffer.
Again, because I'm using "raw" PHP, the path to PHPCS was actually C:\php\phpcs.bat.
The Inspection settings are now in Editor | Inspections | PHP Code Sniffer validation.
That's it. The rest of W3Guy's tutorial worked perfectly. Time to deal with those extra warnings now!