Tuning PHPStan to Maximum Strictness
summary
Shows how to push PHPStan from level defaults into production-ready strictness by flipping configs and enabling packages so code becomes more predictable and readable. Demonstrates the rule levels 0–9, recommends running at least level 5 and explains level 9’s checks on mixed; generates a baseline file to ignore historical violations; uses the strict rules package to forbid ambiguous conditions, require parent constructors, and opt into checking uninitialized properties. Results: fewer runtime surprises and an incremental path to stricter typing.
AI-written summary · about
chapters (13)
- 0:00Start
- 8:58Rule Levels
- 11:41Partially wrong union type
- 15:28The Baseline
- 22:37PHPDoc type instead
- 25:12Fighting level 9 Untyped JSON data
- 25:51What does the function do?
- 27:06Conditional types
- 36:02Check uninitialized properties
- 41:53Exception categorization
- 44:45What does missing @throws mean?
- 47:38Always use the latest version
- 49:03Bleeding edge
related talks
44mTuning PHPStan to Maximum Strictness
57mTuning PHPStan to Maximum Strictness
54mCrafting Custom PHPStan Rules
33mCustom PHPStan Rules: Automate Standards and Save Time
38mWhy you should be using PHPStan in all your projects
32mFrom Zero to Static Analysis Hero
44mWhy PHP?
48mPHPStan: How the Sausage Is Made
