Types & static analysis are good in PHP
summary
Types and static analysis reduce bugs by making concrete claims about values and APIs and by catching mismatches before deploy. Tools used include PHPStan, Psalm, Larastan and Rector and Vimeo’s Sam to infer generics and extra type info. A legacy run exposes ~10,000 static errors but baselines let teams enforce only new code. Rector automates many refactorings (add return types, convert singletons) and Sam finds collection/generic mismatches; CI integration prevents regressions. Slides: https://laracon.com.au/slides/2019/sam-greenwood.pdf
AI-written summary · about
chapters (13)
- 0:00Start
- 0:21SAM GREENWOOD @SAMTGREENWOOD
- 0:40WITH TYPES
- 1:34STATIC TYPES DEFINED BEFORE WE USE THEM
- 2:20STRONG TYPES CAN NEVER CHANGE
- 4:08TYPES SHOW INTENT
- 5:22TYPES MAKE YOUR CODE EASIER TO READ
- 8:04WHAT IS STATIC ANALYSIS?
- 8:39STATIC ANALYSIS IN
- 9:37STATIC ANALYSIS SUCKS UNLESS IT KNOWS ABOUT YOUR CODE
- 10:04PROVIDE TYPES WHERE YOU CAN
- 21:45DON'T USE UNNECESSARY DOC BLOCKS!
- 24:25THERE ARE NO SOLUTIONS ONLY TRADEOFFS.
related talks
50mPractical Advanced Static Analysis
55mSquash Bugs with Static Analysis
32mFrom Zero to Static Analysis Hero
53mStatic Analysis Saved My Code Tonight
47mStatic Code Analysis: Judging a Forest by Its Trees
45mTesting Strategy with the Help of a Static Analyzer
55mReview unknown code with static analysis
40mBullet-proof projects
