PHP TypeLang Help

Logical Types

The TypeLang, like PHP, supports two types of composite (logical) types: Union and Intersection. The ability to specify a nullable type using a separate expression is also supported.

Union Types

Each union type is separated by a pipe character (|) and may contain any other type definition.

Intersection Types

Each intersection type is separated by an ampersand character (&) and may contain any other type definition.

Nullable Types

Nullable type is a shortened alias for union type T | null and is written as ?T.

Parentheses

Parentheses can be used to disambiguate types.

03 February 2025