Stop Using Pseudo-Types
Summary
The article argues that PHP pseudo-types such as callable and iterable are not true types and can introduce ambiguity. It traces the history of these pseudo-types, explains how iterable changed from a pseudo-type to a union type in PHP 8.2, and argues for using explicit types (e.g., Closure, arrays or iterators) for clearer, more analyzable code. The piece also discusses defensive programming, static analysis tooling (PHPStan, Exakat), and practical guidance for properties, callables, and avoiding pseudo-types.