wyrihaximus/phpstan-rules-wrapper
Meta-package that bundles popular PHPStan rule sets and extensions for stricter static analysis. Install via Composer and it works automatically with phpstan/extension-installer, pulling in deprecation, PHPUnit/Mockery, strict rules, dead-code detection, and more.
Install the package via Composer — it automatically enables included PHPStan extensions using phpstan/extension-installer. No extra configuration needed to start analyzing code:
composer require --dev wyrihaximus/phpstan-rules-wrapper
Then run PHPStan as usual:
vendor/bin/phpstan analyse src tests
The wrapper bundles popular rulesets (e.g., phpstan-strict-rules, dead-code-detector, phpunit, mockery), so critical checks like type safety, dead code, deprecations, and test correctness run out of the box.
phpstan.neon — the wrapper’s extensions load first, then your custom rules apply. Example:
includes:
- vendor/wyrihaximus/phpstan-rules-wrapper/extension.neon
# Your overrides or additional rules below
parameters:
deadCode:
reportMembersUsedOnlyInTests: true # Overrides wrapper’s default for dead-code-detector
phpstan.neon: The wrapper may enable strict rules (e.g., ergebnis.noNamedArgument) that break existing code. Check its default config and override selectively in phpstan.neon (e.g., disable specific rules for legacy code). Releases show explicit disables — e.g., v12.1.0 disabled ergebnis.noPhpstanIgnore to prevent conflict with project-specific @phpstan-ignore annotations.10.x → 11.x) may introduce breaking changes in underlying rulesets — always run tests and review release notes before upgrading.^11.0).shipmonk/dead-code-detector included here reports class members used only in tests as dead. Enable it via config if you want stricter coverage — but verify test coverage is robust first.phpstan/extension-installer is installed (it’s auto-required by this package).vendor/bin/phpstan clear-result-cache — stale cache may hide new errors.vendor/bin/phpstan --debug.How can I help you explore Laravel packages today?