PHP TypeLang Help

Constant Types

Unlike identifiers (type names), constants cannot contain the dash (-) character. However, the grammar of the type name and the constant are identical, so this conflict of semantics will have to be resolved independently during the implementation of a custom solution that uses the TypeLang grammar.

Namespaces specifying a reference to a constant are also allowed.

Given the complete identity of the grammar of constants with named type, they cannot contain case-insensitive names true, false and null of literals.

Class Constants

Class constants begin with any type name, then contain a double colon (::) character, and then the constant name.

Constant Masks

A reference to a certain set of constants can be defined using a mask: A sequence of name segments with an asterisk (*) standing wherever the name is left unsaid.

A mask is made of at least one asterisk, and its segments and asterisks alternate, so two asterisks in a row describe nothing a single one does not.

Prefixes on class constants can be omitted, so type will mean any class constant.

A global constant may be left unsaid from its very beginning as well, and the namespace it belongs to may be written in front of the mask. A name separated from the mask by a backslash is a namespace whole, so the mask then means any constant that namespace holds.

12 September 2026