Skip to content

haptiq/coding-standards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haptiq Coding Standards

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"/>

About

Haptiq coding standards

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors