TypeStatement
A TypeStatement is an AST node that represents a complete and independent description of a type. Each implementation of the type statement contains one $offset property meaning the offset in bytes from the beginning of the passed type definition string where the specified node is located.
Literals
Each literal implements class TypeLang\Parser\Node\Literal\LiteralNode and contains one public field $raw containing the string representation of the parsed data.
In addition, some literal nodes may contain parsed values of different types, which are located in the $value field.
Thus, if we parse, for example, TrUe string, the literal instance will contain:
BoolLiteralNode- Represents atrueorfalseliteral valuesFloatLiteralNode- Represents a float (i.e.,0.42,-1.2, etc.) literal valuesIntLiteralNode- Represents an integer (i.e.,42,-12, etc.) literal valuesAn integer values (
IntLiteralNode) additionally contain a$decimalproperty, which contains the string decimal value of the parsed string
NullLiteralNode- Representsnullliteral valueThis node does not contain
$valueproperty
StringLiteralNode- Represents any string (i.e.,'string',"str\ning", etc.) literal valuesVariableLiteralNode- Represents any PHP variable (i.e.,$var,$this, etc.) literal values
Named Types
Named types are a standalone type that contains a name. For example, a type declaration such as int is a named type, but int|bool is not, it is a union type of two named types.
Each named type contains one required property $name and two optional ones (can be null):
$arguments- List of type's template arguments$fields- List of type's shape fields