LiteralValue
Read onlyYes
FinalYes
The closed {type, value} codec of a Literal's value: the type is what TypeDetector detects, the value is a JSON shape it decodes back from - never Type::cast(), which loses non-backed enums, float formatting and zone names.
Methods
Methods
decode()
public
decode(array<string|int, mixed> $encoded) : mixed
Parameters
- $encoded : array<string|int, mixed>
-
the shape encode() returns, after a JSON round trip
Tags
encode()
public
encode(mixed $value) : null|array{type: array, value: mixed}
Parameters
- $value : mixed
Return values
null|array{type: arraynull when $value has no encoding (a DOM node, any other object, a value TypeDetector refuses)