Alias Types

An alias type is a short name for several types at once. Under the hood, alias types are union type.

PHP offers several native alias types, such as iterable, which represents array | Traversable. Alias type are not available for customisation.

The same rules applies to alias types than other types : for example, array | iterable produces a ‘Duplicate type array is redundant’ error.

<?php

function foo(iterable $a) {
}

?>

Documentation

Related : Scalar Types, Union Type, Type System

Added in PHP 8.0