ArrayShape
class ArrayShape (View source)
The attribute specifies possible array keys and their types.
If applied, an IDE will suggest the specified array keys, infer the specified types, and highlight non-specified keys in array access expressions.
Array shapes should be specified with the required $shape parameter whose values should be array literals.
Example:
#[ArrayShape(["f" => "int", "string", "x" => "float"])]
This usage applied on an element effectively means that the array has 3 dimensions, the keys are "f", 1, and "x", and the corresponding types are "int", "string", and "float".
Methods
__construct(array $shape)
No description
Details
__construct(array $shape)
No description