PHP allows scalar and class type hints on parameters and return types, e.g. function add(int $a, int $b): int. Declaring `declare(strict_types=1);` at the top of a file enforces strict type checking instead of coercion.
Nullable types are written with a leading question mark, such as ?string, allowing null in addition to the declared type.