19declare(strict_types=1);
41 switch ($this->type) {
44 return fn() => yield
"Expected an integer.";
48 case ValueType::FLOAT:
49 if (!is_float(
$data)) {
50 return fn() => yield
"Expected a float.";
54 case ValueType::STRING:
55 if (!is_string(
$data)) {
56 return fn() => yield
"Expected a string.";
60 case ValueType::DATETIME:
61 if (!
$data instanceof \DateTimeImmutable) {
62 return fn() => yield
"Expected a \\DateTimeImmutable.";
67 if (!is_bool(
$data)) {
68 return fn() => yield
"Expected a bool.";
73 if (!is_null(
$data)) {
74 return fn() => yield
"Expected null.";
79 throw new \LogicException(
"Unmatch type.");
__construct(Text\SimpleDocumentMarkdown $description, protected ValueType $type,)
getPrimitiveRepresentation(mixed $data)
Each of the types that can be described has a canonical representation created from primitive PHP typ...
This describes some datastructure in terms of standard data structures such as primitives,...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc