Interface Segregation for PHP
summary
Argues that extracting tiny, named types makes PHP code more reasonable: replaces passing PSR-7 requests and raw arrays with a PSR-7 VariableMap adapter and a SearchOptions value object, plus an array-backed stub and an echo data source fake for tests. Results: controller drops conditionals, tests avoid heavy mocks and run faster, code becomes reusable (CLI possible) and less likely to leak bugs (e.g. accidental cache clears). Trade-offs: more classes and typing, but dependency injection and once-only extraction pay off.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:41Reasonable vs understandable
- 5:05Refactoring with interfaces
- 7:30Mocks and testing
- 13:14Unit testing limitations
- 16:01Type specialization
- 21:36Practical design challenges
- 23:44Strategic use of types
- 38:59Emotions and conclusion








