It’s been one busy day, cranking out features like no tomorrow (even issuing pull requests on github to fix Zend Framework 2 issues) and still finding time to improve my PHP toolbelt.
Today while issuing pull requests I came across PHP-CS-Fixer which was referenced as a way to fix some minor code formatting issues in my pull request. Basically run it on a project directory and it fixes “most” issues to make your code better adhere to PHP coding standards as defined in the PSR-1 and PSR-2 documents.
php-cs-fixer fix . -v --level=psr2
As an added check, I’m now using this script as a git pre-commit hook on my PHP projects to tell me of any issues.