slam/phpstan-extensions
PHPStan extensions with extra strict rules: unused variables, closure parameter typehints, enforce ::class notation, forbid goto, naming conventions, validate PHPUnit annotation FQCNs, and restrict access to globals/static properties in specific contexts.
Interface suffixes, Abstract prefixes).lcobucci/clock for time handling) by flagging legacy patterns.UnusedVariableRule) add static analysis overhead. Benchmark impact if running in CI/CD.phpstan/phpstan-doctrine may suffice."This package supercharges our PHP code quality by automating enforcement of best practices—like catching unused variables, preventing raw filesystem calls in Symfony, and discouraging anti-patterns like singletons in models. It’s a low-cost, high-impact way to reduce bugs, improve maintainability, and align with modern PHP frameworks. Think of it as a ‘linter on steroids’ that pays for itself by catching issues early, before they hit production. The setup is minimal (just a Composer install), and it integrates seamlessly with our existing PHPStan workflow."
*"We’re adding slam/phpstan-extensions to:
::class enforcement and singleton restrictions in models prevent future refactoring pain.--level 5 in CI, then enforce stricter levels as the team adapts.Why now?
Next steps:
composer.json (dev dependency).phpstan.neon (or use extension-installer).Impact: Fewer production bugs, faster onboarding, and code that’s easier to maintain."*
How can I help you explore Laravel packages today?