haptiq / coding-standards
Haptiq Coding Standards
Package info
github.com/haptiq/coding-standards
Type:phpcodesniffer-standard
pkg:composer/haptiq/coding-standards
Requires
- php: ^7.4 || ^8.0
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpcompatibility/phpcompatibility-wp: ^2.1.8
- wp-coding-standards/wpcs: ^3.3.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
PHPCS ruleset for WordPress projects developed at Haptiq.
Combines WordPress Coding Standards with PHPCompatibilityWP to catch both style violations and WordPress/PHP version compatibility issues.
Installation
composer require --dev haptiq/coding-standards
The Composer installer plugin registers the standard automatically โ no manual PHPCS path configuration needed.
Usage
Run PHPCS with the HaptiqWordPress standard:
vendor/bin/phpcs --standard=HaptiqWordPress .
Or copy the provided phpcs.xml.dist to your project root as phpcs.xml and run:
vendor/bin/phpcs
If phpcs.xml configures the use of HaptiqWordPress, run:
vendor/bin/phpcs
What it checks
| Rule group | Default severity | What it covers |
|---|---|---|
WordPress-Core |
warning | WordPress coding style and conventions |
WordPress-Extra |
warning | Stricter WordPress best practices |
PHPCompatibilityWP |
warning | PHP and WP API version compatibility |
All violations are warnings by default โ they are reported but do not block CI. See Adjusting severity to promote specific groups to errors.
Targets: PHP 7.4โ8.4 ยท WordPress 6.8+
Adjusting severity
To promote a rule group to an error in your project's phpcs.xml:
<rule ref="HaptiqWordPress/WordPress-Core"> <type>error</type> </rule>
Excluding rules
<rule ref="HaptiqWordPress"> <exclude name="WordPress.Files.FileName"/> </rule>
Adding docblock enforcement
WordPress-Docs is available but not included by default. Add it to your phpcs.xml:
<rule ref="WordPress-Docs"/>