wyrihaximus/phpstan-rules-wrapper
Meta package that bundles popular PHPStan rule sets via phpstan/extension-installer. Install once to enable strict, deprecation, PHPUnit/Mockery, dead-code detection, type-coverage, PSR-3, and more with minimal configuration.
phpstan/extension-installer).ergebnis.noPhpstanIgnore), which is critical for balancing strictness and practicality in large codebases.composer require wyrihaximus/phpstan-rules-wrapper), requiring no manual configuration beyond PHPStan’s baseline setup.symplify/phpstan-extensions, phpstan/phpunit), reducing maintenance overhead for the TPM.strict-rules, dead-code-detector) may flag legitimate patterns in Laravel-specific code (e.g., dynamic property access, magic methods). Mitigation: Requires custom rule exclusion in phpstan.neon.phpstan --parallel) should be tested.phpstan/phpstan-deprecation-rules) may change behavior with PHPStan updates. Mitigation: Monitor phpstan/extension-installer for compatibility warnings.phpstan/extension-installer (auto-loads rules).rector/rector (for automated refactoring based on PHPStan findings).pestphp/pest (if using Pest for testing).app() helper, dynamic properties).phpstan-phpunit, strict-rules).dead-code-detector, type-coverage).phpstan.neon to override defaults:
includes:
- vendor/wyrihaximus/phpstan-rules-wrapper/rules.neon
excludeFiles:
- 'tests/**/*' # Adjust as needed
phpstan analyze --generate-baseline to baseline existing issues.phpstan/extension-installer:
composer require --dev phpstan/extension-installer --dev
composer require --dev wyrihaximus/phpstan-rules-wrapper
phpstan.neon:
extends: vendor/wyrihaximus/phpstan-rules-wrapper/rules.neon
vendor/bin/phpstan analyze
- name: PHPStan
run: vendor/bin/phpstan analyze --level=max
symplify/phpstan-extensions).composer.json if stability is critical:
"extra": {
"phpstan-rules-wrapper": {
"symplify/phpstan-extensions": "1.20.0"
}
}
phpstan.neon:
disableRules:
- Rules\StrictRules\ForbiddenTodoCommentRule
--error-format=github for CI-friendly output.phpstan debug to troubleshoot rule loading.symplify/phpstan-extensions have active communities; others (e.g., ergebnis/phpstan-rules) may require custom fixes.composer require phpstan/phpstan-phpunit).--parallel for multi-core analysis.app()->make()).--level=5 (basic) before --level=max.| Failure Mode | Impact | Mitigation |
|---|---|---|
| PHPStan version conflict | Analysis fails | Pin PHPStan version in composer.json |
| Rule breaks CI pipeline | Blocked merges | Use --fix where possible; exclude files |
| False positives in Laravel code | Developer frustration | Custom phpstan.neon exclusions |
| Resource exhaustion | CI timeouts | Parallel analysis, caching |
| Rule deprecation | Broken analysis | Monitor updates; test new versions locally |
How can I help you explore Laravel packages today?