Union and Intersection
UnionType
Section titled “UnionType”class UnionType implements Type{ /** * @param list<Type> $types */ public function __construct( public array $types, ) {}}Direct alternative of native reflection’s ReflectionUnionType. Represents any kind of unions:
int|string,string|int,string|int|float|bool\Generator<string, string>|iterable<string, string>string|(\Stringable & object)|(callable(): string)
IntersectionType
Section titled “IntersectionType”class IntersectionType implements Type{ /** * @param list<Type> $types */ public function __construct( public array $types, ) {}}Direct alternative of native reflection’s ReflectionIntersectionType. Represents any kind of intersections:
\Stringable & \JsonSerializable\IteratorAggregate<string, string> & \ArrayAccess<string, string>