| @@ 89-100 (lines=12) @@ | ||
| 86 | */ |
|
| 87 | private function valueOfList(TypeHint $type, ValueInterface $value): \Traversable |
|
| 88 | { |
|
| 89 | if ($value instanceof NullValueNode) { |
|
| 90 | /** |
|
| 91 | * @validation <name: Type! = null> |
|
| 92 | */ |
|
| 93 | if ($type->isNonNull()) { |
|
| 94 | $error = 'Non-Null type %s can not accept null value'; |
|
| 95 | throw (new TypeConflictException(\sprintf($error, $type)))->throwsIn($type->getFile(), |
|
| 96 | $value->getOffset()); |
|
| 97 | } |
|
| 98 | ||
| 99 | return $value->toPrimitive(); |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * @validation <name: [Type] = Value> |
|
| @@ 273-281 (lines=9) @@ | ||
| 270 | /** |
|
| 271 | * @validation <name: TypeHint! = null> |
|
| 272 | */ |
|
| 273 | if ($value instanceof NullValueNode) { |
|
| 274 | if ($type->isNonNull()) { |
|
| 275 | $error = 'Non-Null type %s can not accept null value'; |
|
| 276 | throw (new TypeConflictException(\sprintf($error, $type)))->throwsIn($type->getFile(), |
|
| 277 | $value->getOffset()); |
|
| 278 | } |
|
| 279 | ||
| 280 | return $value->toPrimitive(); |
|
| 281 | } |
|
| 282 | ||
| 283 | return $this->extractValue($type, $value); |
|
| 284 | } |
|