This is a superset of the NeutronStandard and PSR12 with some modifications.
composer require --dev squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer
composer require --dev lipsia/phpcs-wp-plugin-standard
In your project's ruleset file, enable this ruleset by setting the <rule>
tag.
Minimal phpcs.xml.dist:
<?xml version="1.0"?>
<ruleset>
<rule ref="LDWordPressPlugin"/>
</ruleset>
Or without a file:
./vendor/bin/phpcs --standard=LDWordPressPlugin .
This ruleset is opinionated and that is a good thing.
- main plugin file is in ./plugin.php
- all other plugin files are autoloaded from ./src/
- composer dependencies are in ./vendor/
- convert tabs to 4 spaces
- use colors in report
- look into all files with extension php
- check 8 files in parallel