Shape Types
Each composite type can be rigidly described by a structural type called a " shape ".
Shape Keys
A shape within the PHP language can be applied to any array or object and contain either implicit or explicit keys.
Implicit Keys
An implicit field has no key at all: only its type is specified, and the field's position within the shape determines its (numeric) index.
Explicit Keys
An explicit field is prefixed with a key, followed by a colon (:) and then the field's type: key: Type. The simplest form of a key is an identifier, the same as used for a type name.
Numeric Keys
An explicit key may also be an integer literal.
String Keys
An explicit key may also be a string literal, which allows characters that are not permitted in an identifier, including escape sequences.
Constant Keys
In addition to identifiers, numbers and strings, a field key may also be a class constant.
Constant Mask Keys
A field key may also be a class constant mask or global constant mask, referring to a whole set of constants sharing a common prefix.
Optional Fields
Specifying fields (keys) allows the optionality of the presence of a field. Such fields are indicated by a question mark (?) before the colon (:) symbol: key?: Type.
Unsealed Shapes
Unsealed (unclosed) shapes mean that the composite type can contain additional fields beyond those described in the shape. Such types must be terminated with the " ... ".
Typed Shapes
In addition, such shapes can describe template arguments (types) for values or for keys and values, which are described after the ellipsis (...) char and contain syntax similar to generics.
Attributes
Each shape field allows you to define list of additional attributes. An attribute is additional metadata for a field.