PHP to Hack, an incrementally typed Adventure at Slack
summary
Slack migrates a multi‑million‑line PHP codebase to Hack starting in 2016, runs static checking with HH client via LSP, and finds thousands of real bugs during the one‑file‑at‑a‑time migration. Types come from generated shapes (parsing CREATE TABLE) and an async MySQL client that returns typed rows, plus inferred return types; a CI enforces HHVM checks, a coverage leaderboard drives adoption, strict mode reaches about 75% of files, vendor PHP gets removed, and the process enables safer refactors and fewer runtime surprises.
AI-written summary · about
chapters (25)
- 0:00Intro
- 2:11Overview
- 3:20Static Type Checking
- 6:02Inferred Generics
- 6:25Inferred Union Types
- 7:04Two kinds of Arrays
- 7:17Arrays with Generics
- 9:00Hack Arrays
- 9:25Arrays with mixed types
- 11:47Using Optional Fields
- 12:03Type Refinement
- 13:06PHP Standard Library
- 13:24Composing PHP functions
- 14:08Hack Standard Library
- 14:25Hack Pipeline with HSL
- 15:18Type Checked Regex
- 16:16XHP: Type safe HTML
- 18:06Fix with automation
- 19:53Move code into functions
- 21:54DB Types: Before
- 23:11Inferred Return Types
- 24:05Untyped code
- 26:54Eliminate PHP Dependencies
- 27:06HHVM 4.0 Upgrade
- 28:18Lessons Learned








