Here's how you can quickly get started with linting your PHP code using the CodeSniffer library.
First, install the dependency:
composer require "squizlabs/php_codesniffer=*"
Then, create a file at the root of your repo:
<?xml version="1.0"?> <ruleset name="Standard"> <rule ref="PSR2"> <exclude name="PSR1.Methods.CamelCapsMethodName"/> </rule> </ruleset>
This file tells CodeSniffer which ruleset and rules you want to use. The above will use the PSR2 ruleset, while excluding the
CamelCapsMethodName rule (I prefer the
it_does_something method name formatting for tests).