Total Complexity | 6 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class DateImmutable extends ScalarType |
||
16 | { |
||
17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
||
18 | public string|null $description = 'The `date_immutable` scalar type represents datetime data.' |
||
19 | . 'The format is e.g. 2004-02-12'; |
||
20 | |||
21 | public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
||
22 | { |
||
23 | // @codeCoverageIgnoreStart |
||
24 | if (! $valueNode instanceof StringValueNode) { |
||
25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
||
|
|||
26 | } |
||
27 | |||
28 | // @codeCoverageIgnoreEnd |
||
29 | |||
30 | return $valueNode->value; |
||
31 | } |
||
32 | |||
33 | public function parseValue(mixed $value): PHPDateTime|false |
||
40 | } |
||
41 | |||
42 | public function serialize(mixed $value): string|null |
||
51 |