Flow PHP

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

decode()  : mixed
encode()  : null|array{type: array, value: mixed}

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
throws
InvalidArgumentException

on a shape encode() never writes

encode()

public encode(mixed $value) : null|array{type: array, value: mixed}
Parameters
$value : mixed
Return values
null|array{type: array, value: mixed} —

null when $value has no encoding (a DOM node, any other object, a value TypeDetector refuses)

On this page

Search results