19 declare(strict_types=1);
31 protected DValue $key_type,
39 if (!is_array($data)) {
40 return fn() => yield
"Expected an array.";
46 foreach ($data as $k => $v) {
47 $key = $this->key_type->getPrimitiveRepresentation($k);
48 $value = $this->value_type->getPrimitiveRepresentation($v);
50 $key_is_error = $key instanceof \Closure;
51 $value_is_error = $value instanceof \Closure;
56 if ($value_is_error) {
60 if (!$key_is_error && !$value_is_error) {
66 return $this->mergeErrors($errors);
74 return $this->key_type;
79 return $this->value_type;
__construct(Text\SimpleDocumentMarkdown $description, protected DValue $key_type, protected Description $value_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)