shipmonk/phpstan-rules
40 super-strict PHPStan rules from ShipMonk to plug gaps in extra-strict setups. Install via Composer, include rules.neon, then enable/disable or tune rules per-project. Targets tricky PHP edge cases like unsafe comparisons, casts, arrays, enums and more.
readonly, match, generics) to future-proof codebases, aligning with ShipMonk’s own strict PHPStan configurations.enforceNativeReturnTypehint, forbidCast) to migrate older codebases.forbidCheckedExceptionInCallable).classSuffixNaming for class hierarchies).Adopt if:
forbidCast blacklists or classSuffixNaming mappings).Look Elsewhere if:
enforceReadonlyPublicProperty may break legacy classes).readonly, are PHP 8.1+ only)."This package lets us catch critical bugs at development time—like unsafe type comparisons or unhandled exceptions—using ShipMonk’s battle-tested PHPStan rules. By adopting it, we’ll reduce production incidents from PHP edge cases (e.g., null comparisons, mutable public properties) while future-proofing our codebase for PHP 8+. The upfront effort to configure it pays off in long-term maintainability and faster onboarding for new engineers. Think of it as a ‘PHP linter on steroids’—no runtime surprises."
*"This gives us ShipMonk’s strict PHPStan rules (used in their high-scale system) to:
array casts, arithmetic on strings) early.readonly, match for enums) without manual audits.enforceReadonlyPublicProperty for legacy code).
Example: The forbidCheckedExceptionInCallable rule alone would’ve caught X production bugs in our last release by flagging unhandled exceptions in closures. Zero false positives—just stricter defaults we control.*Ask: "Which of these rules align with our top technical debts? We can start with a pilot module."
How can I help you explore Laravel packages today?