19 declare(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:
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.");
This describes some datastructure in terms of standard data structures such as primitives, lists, maps and objects and helpful (hopefully...) human readable texts.
getPrimitiveRepresentation(mixed $data)
__construct(Container $dic, ilPlugin $plugin)
__construct(Text\SimpleDocumentMarkdown $description, protected ValueType $type,)