PHP type declaration milestones
The manual's type-declaration changelog distinguishes syntax availability from runtime behavior. Useful version boundaries include:
| Feature | Available since |
|---|---|
| Nullable declarations | PHP 7.1 |
| Typed properties | PHP 7.4 |
| Union types and mixed | PHP 8.0 |
| Intersection types and never | PHP 8.1 |
| DNF types; standalone null and false; literal true | PHP 8.2 |
| Typed class constants | PHP 8.3 |
A nullable declaration ?T is equivalent to T|null. Combining intersections with unions
requires DNF syntax in PHP 8.2 or newer. Implicitly nullable parameters through a null
default are deprecated as of PHP 8.4; use an explicit nullable declaration.
These are syntax/version facts, not a complete compatibility guide. Check the manual's detailed constraints and the migration guide for the target version.
Related: support windows, array shorthand proposal.