arts / wp-plugin-standards
Shared PHP coding standards (ArtsFramework PHPCS ruleset) and PHPStan base config for Arts WordPress plugins
Package info
github.com/artkrsk/wp-plugin-standards
Type:phpcodesniffer-standard
pkg:composer/arts/wp-plugin-standards
Requires
- php: >=8.0
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpcompatibility/phpcompatibility-wp: ^2.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- szepeviktor/phpstan-wordpress: ^2.0
- wp-coding-standards/wpcs: ^3.0
README
Shared PHP quality tooling for Arts WordPress plugins: the ArtsFramework PHPCS ruleset (WordPress-Core + PHPCompatibilityWP with a few deliberate exclusions) and a PHPStan base config (level max, WordPress-aware).
Before this package existed, every repo carried its own copy-pasted phpcs.xml — ~30 of them, already drifting (some named ArtsFramework, some ArtsBase). This is the single source of truth.
Install
composer require --dev arts/wp-plugin-standards
Composer will ask to allow two plugins — both are required:
"config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "phpstan/extension-installer": true } }
The first registers the ArtsFramework PHPCS standard; the second auto-registers the szepeviktor/phpstan-wordpress extension with PHPStan.
Use — PHPCS
phpcs.xml in your repo:
<?xml version="1.0"?> <ruleset name="Plugin"> <file>src/php</file> <rule ref="ArtsFramework"/> <arg value="ps"/> <arg name="colors"/> <arg name="extensions" value="php"/> <arg name="parallel" value="8"/> </ruleset>
Then vendor/bin/phpcs / vendor/bin/phpcbf.
The ruleset sets testVersion 8.0- (PHP cross-version sniffs via PHPCompatibilityWP) and minimum_supported_wp_version 6.0. Override either in your own ruleset with a <config> element if a plugin needs different floors.
Use — PHPStan
phpstan.neon in your repo:
includes: - vendor/arts/wp-plugin-standards/phpstan/base.neon parameters: paths: - src/php bootstrapFiles: - vendor/autoload.php - phpstan-bootstrap.php scanFiles: - vendor/arts/elementor-stubs/elementor-stubs.php
The base pins level max, PHP 8.0, and treatPhpDocTypesAsCertain: false (see the comment in phpstan/base.neon for why). Paths, bootstrap/stub files, and any ignoreErrors stay per-repo.
What's deliberately excluded from WordPress-Core
Generic.Arrays.DisallowShortArraySyntax, WordPress.Files.FileName, WordPress.PHP.YodaConditions, WordPress.NamingConventions.ValidHookName.UseUnderscores, and Universal.NamingConventions.NoReservedKeywordParameterNames — long-standing Arts house style, inherited from the original per-repo rulesets.