valu / wp-codesniffer-rules
PHP_CodeSniffer rules (sniffs) to enforce Valu WP coding conventions
Package info
github.com/valu-digital/wp-codesniffer-rules
Type:phpcodesniffer-standard
pkg:composer/valu/wp-codesniffer-rules
Requires
- php: >=7.2
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.2 || ^1.0
- squizlabs/php_codesniffer: ^3.13.6
- wp-coding-standards/wpcs: ^3.4.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-30 10:58:19 UTC
README
The Valu-WP-Rules standard for PHP_CodeSniffer: the WordPress Coding Standards (WPCS 3) security sniffs, plus a trailing comma after the last item of a multi-line array.
Install
Install it globally, as the Valu dev setup expects (CodeSniffer on docs.valu.pro):
composer global require "valu/wp-codesniffer-rules:dev-master" -W
Update with composer global update "valu/wp-codesniffer-rules" -W. The package has no tagged releases, so every update installs the latest master.
The package requires PHP_CodeSniffer 3.13.6 or later and WPCS 3.4.1 or later, because older versions have security vulnerabilities (CVE-2026-67434, CVE-2026-45293). The update command above brings both to these versions. Check the installed version with phpcs --version.
Run
In a theme or plugin directory:
phpcs --standard=Valu-WP-Rules
Always pass --standard. Without it, phpcs uses the first phpcs.xml it finds in the current directory or a parent directory, which may be a different ruleset.
To silence a false positive, use // phpcs:ignore <Sniff.Name> -- reason. The old whitelist comments (// XSS ok, // WPCS: XSS ok, // input var okay) are not recognised by WPCS 3.
Use as a project dependency
composer require --dev "valu/wp-codesniffer-rules:dev-master"
Add phpcs.xml to the project:
<?xml version="1.0"?> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Custom" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"> <rule ref="Valu-WP-Rules"/> </ruleset>
and run
./vendor/bin/phpcs src