PHP ❤️ types
summary
Shows how PHP moves from loose typing to concrete safety using Psalm or PHPStan to emulate generics and union types, claiming immediate bug prevention and better domain models. Demonstrates a ValidationResult class with a single process method that forces handling of success and error branches, builds value objects for positive Age and other invariants, and uses phantom-typed Ids plus Psalm/PHPStan templates to keep a single generic repository type-safe, and mentions enum and immutability features coming to PHP.
AI-written summary · about
chapters (16)
- 0:00Intro
- 2:13Introduction
- 4:57What are types
- 8:50Why use types
- 12:20Types in PHP
- 16:20Type Checker
- 19:12Templates
- 22:11Validation
- 25:12Invariants
- 26:40Models
- 35:00Phantom types
- 39:52Questions
- 40:32My approach
- 44:12Laravel
- 45:12Primitive types in value objects
- 47:02Hardest part of introducing SAM








