wpdesk / phpstan-rules
Meta package with PHPStan configuration for WP Desk projects
Package info
github.com/WP-Desk/phpstan-rules
Type:phpstan-extension
pkg:composer/wpdesk/phpstan-rules
1.2.1
2024-12-05 10:50 UTC
Requires
- php-stubs/woocommerce-stubs: *
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10 || ^2
- phpstan/phpstan-deprecation-rules: ^1.1 || ^2
- phpstan/phpstan-strict-rules: ^1.5 || ^2
- szepeviktor/phpstan-wordpress: ^1.3 || ^2
README
Shared PHPStan configuration for WordPress/WooCommerce projects.
Includes:
- PHPStan WordPress extension
- WooCommerce stubs
- PHPStan deprecation rules
- selected PHPStan strict rules
- default analysis level
5 - default path
src
Installation
composer require --dev wpdesk/phpstan-rules
If Composer asks about phpstan/extension-installer, allow it.
Usage
Run PHPStan:
vendor/bin/phpstan analyse
To override defaults, add phpstan.neon in your project:
includes: - vendor/wpdesk/phpstan-rules/rules.neon parameters: paths: - src - tests
Plugin dependency stubs
When analysing a plugin that depends on another plugin, generate stubs for the dependency:
composer global require php-stubs/generator generate-stubs --out=.stubs/dependency.stub -- /path/to/dependency/src
Then include them:
parameters: scanFiles: - .stubs/dependency.stub