korbeil/phpstan-generic-rules
PHPStan extension that enforces and improves the use of PHP generics. Adds custom rules to catch missing or incorrect template types, invalid generic usages, and helps keep docblocks and type hints consistent for safer, more accurate static analysis.
Adopt if:
Look elsewhere if:
For Executives: "This package supercharges our PHP/Laravel code quality by adding advanced static analysis rules to PHPStan—catching type-related bugs early, reducing production incidents, and cutting debugging time. For a minimal investment (open-source, low maintenance), it aligns with our goals of scalability and reliability. Teams using Laravel 10+ or complex generics will see the biggest ROI."
For Engineering/DevOps: *"PHPStan already gives us static analysis, but korbeil/phpstan-generic-rules fills gaps in generic type safety—think stricter validation for collections, repositories, or custom DTOs. It’s a drop-in extension that:
For Developers: *"If you’ve ever fought with PHPStan’s default rules missing edge cases (e.g., generics, null in collections), this package adds 10+ custom rules to tighten your analysis. Example use cases:
Collection always contains User models, not mixed types.How can I help you explore Laravel packages today?