Rob Allen has posted a guide showing you how to make your code PSR-2 compliant with the help of some handy tools, both in and out of your editor/IDE.
Most of the projects that I work on follow the PSR-2 coding style guidelines. I prefer to ensure that my PRs pass before Travis or Jenkins tells me, so let's look at how to run PSR-2 checks locally.
He looks at three different methods - not the only ones out there but three quick to implement ones:
- Using the PSR-2 sniffs for PHP_CodeSniffer
- Automating the checks with Phing
- Editor integration (he shows VIM and Sublime Text)
There's links to the tools mentioned here and screenshots/configuration information showing how to get it set up too.