There was a fantastic CS helper package released at PEAR this week, PHP_CodeSniffer. The package, which requires PHP5 and is nicely coded, puts a phpcs script in your path so you can pass files or directories to it to get your CS validated.
The results are detailed and processing is surprisingly fast considering how many tokens are being parsed.
[demian@localhost lib]$ phpcs -v SGL.php
Registering sniffs… DONE
Processing SGL.php [2587 tokens in 425 lines]… DONE in < 1 second
Typical CS errors/warnings look like this, I just fixed the errors in this case 😉
PHP_CodeSniffer is a godsend when you’re in the position of having to explain what PHP coding standards are the newbies on average twice/week, and what the difference is between conditional and method bracing, etc, etc.
As we’ve seen ZDE and various other IDEs bundle other PEAR packages with their software like phpDocumentor, I hope this tool too becomes a standard IDE helper in the near future.
Hats off to Squiz for putting PHP_CodeSniffer together.