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 implicit keys, explicit keys, or both.
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: it may contain dashes, a namespace, and the words true, false and null are not literals here, but ordinary names.
Numeric Keys
An explicit key may also be an integer literal in any notation, including the signed ones (-1, 0x1F). A float cannot be a key.
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.
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.
The ellipsis is always the last element of a shape, and a trailing comma is allowed after any last element. A shape may consist of the ellipsis alone, and may be empty.