@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | class Time extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `Time` scalar type represents time data.' |
|
18 | + public string | null $description = 'The `Time` scalar type represents time data.' |
|
19 | 19 | . 'The format is e.g. 24 hour:minutes:seconds'; |
20 | 20 | |
21 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
21 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
22 | 22 | { |
23 | 23 | // @codeCoverageIgnoreStart |
24 | - if (! $valueNode instanceof StringValueNode) { |
|
24 | + if (!$valueNode instanceof StringValueNode) { |
|
25 | 25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
26 | 26 | } |
27 | 27 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function parseValue(mixed $value): PHPDateTime |
34 | 34 | { |
35 | - if (! is_string($value)) { |
|
35 | + if (!is_string($value)) { |
|
36 | 36 | throw new Error('Time is not a string: ' . $value); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return PHPDateTime::createFromFormat('H:i:s.u', $value); |
40 | 40 | } |
41 | 41 | |
42 | - public function serialize(mixed $value): string|null |
|
42 | + public function serialize(mixed $value): string | null |
|
43 | 43 | { |
44 | 44 | if ($value instanceof PHPDateTime) { |
45 | 45 | $value = $value->format('H:i:s.u'); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | class DateImmutable extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `date_immutable` scalar type represents datetime data.' |
|
18 | + public string | null $description = 'The `date_immutable` scalar type represents datetime data.' |
|
19 | 19 | . 'The format is e.g. 2004-02-12'; |
20 | 20 | |
21 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
21 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
22 | 22 | { |
23 | 23 | // @codeCoverageIgnoreStart |
24 | - if (! $valueNode instanceof StringValueNode) { |
|
24 | + if (!$valueNode instanceof StringValueNode) { |
|
25 | 25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
26 | 26 | } |
27 | 27 | |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | return $valueNode->value; |
31 | 31 | } |
32 | 32 | |
33 | - public function parseValue(mixed $value): PHPDateTime|false |
|
33 | + public function parseValue(mixed $value): PHPDateTime | false |
|
34 | 34 | { |
35 | - if (! is_string($value)) { |
|
35 | + if (!is_string($value)) { |
|
36 | 36 | throw new Error('Date is not a string: ' . $value); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return PHPDateTime::createFromFormat('Y-m-d', $value); |
40 | 40 | } |
41 | 41 | |
42 | - public function serialize(mixed $value): string|null |
|
42 | + public function serialize(mixed $value): string | null |
|
43 | 43 | { |
44 | 44 | if ($value instanceof PHPDateTime) { |
45 | 45 | $value = $value->format('Y-m-d'); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | class DateTimeImmutable extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `datetime_immutable` scalar type represents datetime data.' |
|
18 | + public string | null $description = 'The `datetime_immutable` scalar type represents datetime data.' |
|
19 | 19 | . 'The format is ISO-8601 e.g. 2004-02-12T15:19:21+00:00'; |
20 | 20 | |
21 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
21 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
22 | 22 | { |
23 | 23 | // @codeCoverageIgnoreStart |
24 | - if (! $valueNode instanceof StringValueNode) { |
|
24 | + if (!$valueNode instanceof StringValueNode) { |
|
25 | 25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
26 | 26 | } |
27 | 27 | |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | return $valueNode->value; |
31 | 31 | } |
32 | 32 | |
33 | - public function parseValue(mixed $value): PHPDateTime|false |
|
33 | + public function parseValue(mixed $value): PHPDateTime | false |
|
34 | 34 | { |
35 | - if (! is_string($value)) { |
|
35 | + if (!is_string($value)) { |
|
36 | 36 | throw new Error('Date is not a string: ' . $value); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return PHPDateTime::createFromFormat('Y-m-d\TH:i:sP', $value); |
40 | 40 | } |
41 | 41 | |
42 | - public function serialize(mixed $value): string|null |
|
42 | + public function serialize(mixed $value): string | null |
|
43 | 43 | { |
44 | 44 | if ($value instanceof PHPDateTime) { |
45 | 45 | $value = $value->format('c'); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | class TimeImmutable extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `Time` scalar type represents time data.' |
|
18 | + public string | null $description = 'The `Time` scalar type represents time data.' |
|
19 | 19 | . 'The format is e.g. 24 hour:minutes:seconds'; |
20 | 20 | |
21 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
21 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
22 | 22 | { |
23 | 23 | // @codeCoverageIgnoreStart |
24 | - if (! $valueNode instanceof StringValueNode) { |
|
24 | + if (!$valueNode instanceof StringValueNode) { |
|
25 | 25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
26 | 26 | } |
27 | 27 | |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | return $valueNode->value; |
31 | 31 | } |
32 | 32 | |
33 | - public function parseValue(mixed $value): PHPDateTime|false |
|
33 | + public function parseValue(mixed $value): PHPDateTime | false |
|
34 | 34 | { |
35 | - if (! is_string($value)) { |
|
35 | + if (!is_string($value)) { |
|
36 | 36 | throw new Error('Time is not a string: ' . $value); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return PHPDateTime::createFromFormat('H:i:s.u', $value); |
40 | 40 | } |
41 | 41 | |
42 | - public function serialize(mixed $value): string|null |
|
42 | + public function serialize(mixed $value): string | null |
|
43 | 43 | { |
44 | 44 | if ($value instanceof PHPDateTime) { |
45 | 45 | $value = $value->format('H:i:s.u'); |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | class Json extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `JSON` scalar type represents json data.'; |
|
18 | + public string | null $description = 'The `JSON` scalar type represents json data.'; |
|
19 | 19 | |
20 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
20 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
21 | 21 | { |
22 | 22 | throw new Error('JSON fields are not searchable', $valueNode); |
23 | 23 | } |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @throws Error |
29 | 29 | */ |
30 | - public function parseValue(mixed $value): array|null |
|
30 | + public function parseValue(mixed $value): array | null |
|
31 | 31 | { |
32 | - if (! is_string($value)) { |
|
32 | + if (!is_string($value)) { |
|
33 | 33 | throw new Error('Json is not a string: ' . $value); |
34 | 34 | } |
35 | 35 | |
36 | 36 | return json_decode($value, true); |
37 | 37 | } |
38 | 38 | |
39 | - public function serialize(mixed $value): string|null |
|
39 | + public function serialize(mixed $value): string | null |
|
40 | 40 | { |
41 | 41 | return json_encode($value); |
42 | 42 | } |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | class DateTime extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `DateTime` scalar type represents datetime data.' |
|
18 | + public string | null $description = 'The `DateTime` scalar type represents datetime data.' |
|
19 | 19 | . 'The format is ISO-8601 e.g. 2004-02-12T15:19:21+00:00'; |
20 | 20 | |
21 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
21 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
22 | 22 | { |
23 | 23 | // @codeCoverageIgnoreStart |
24 | - if (! $valueNode instanceof StringValueNode) { |
|
24 | + if (!$valueNode instanceof StringValueNode) { |
|
25 | 25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
26 | 26 | } |
27 | 27 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function parseValue(mixed $value): PHPDateTime |
34 | 34 | { |
35 | - if (! is_string($value)) { |
|
35 | + if (!is_string($value)) { |
|
36 | 36 | throw new Error('Date is not a string: ' . $value); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return PHPDateTime::createFromFormat('Y-m-d\TH:i:sP', $value); |
40 | 40 | } |
41 | 41 | |
42 | - public function serialize(mixed $value): string|null |
|
42 | + public function serialize(mixed $value): string | null |
|
43 | 43 | { |
44 | 44 | if ($value instanceof PHPDateTime) { |
45 | 45 | $value = $value->format('c'); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | class Date extends ScalarType |
16 | 16 | { |
17 | 17 | // phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
18 | - public string|null $description = 'The `Date` scalar type represents datetime data.' |
|
18 | + public string | null $description = 'The `Date` scalar type represents datetime data.' |
|
19 | 19 | . 'The format is e.g. 2004-02-12'; |
20 | 20 | |
21 | - public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
|
21 | + public function parseLiteral(ASTNode $valueNode, array | null $variables = null): string |
|
22 | 22 | { |
23 | 23 | // @codeCoverageIgnoreStart |
24 | - if (! $valueNode instanceof StringValueNode) { |
|
24 | + if (!$valueNode instanceof StringValueNode) { |
|
25 | 25 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
26 | 26 | } |
27 | 27 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function parseValue(mixed $value): PHPDateTime |
34 | 34 | { |
35 | - if (! is_string($value)) { |
|
35 | + if (!is_string($value)) { |
|
36 | 36 | throw new Error('Date is not a string: ' . $value); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return PHPDateTime::createFromFormat('Y-m-d', $value); |
40 | 40 | } |
41 | 41 | |
42 | - public function serialize(mixed $value): string|null |
|
42 | + public function serialize(mixed $value): string | null |
|
43 | 43 | { |
44 | 44 | if ($value instanceof PHPDateTime) { |
45 | 45 | $value = $value->format('Y-m-d'); |
@@ -13,27 +13,27 @@ |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | protected ContainerInterface $container, |
16 | - protected array|null $metadataConfig, |
|
16 | + protected array | null $metadataConfig, |
|
17 | 17 | ) { |
18 | 18 | } |
19 | 19 | |
20 | 20 | /** @throws Error */ |
21 | 21 | public function get(string $id): Entity |
22 | 22 | { |
23 | - if (! isset($this->metadataConfig[$id])) { |
|
23 | + if (!isset($this->metadataConfig[$id])) { |
|
24 | 24 | throw new Error( |
25 | 25 | 'Entity ' . $id . ' is not mapped in the metadata', |
26 | 26 | ); |
27 | 27 | } |
28 | 28 | |
29 | - if (! $this->has($id)) { |
|
29 | + if (!$this->has($id)) { |
|
30 | 30 | $this->set($id, new Entity($this->container, $this->metadataConfig[$id])); |
31 | 31 | } |
32 | 32 | |
33 | 33 | return parent::get($id); |
34 | 34 | } |
35 | 35 | |
36 | - public function getMetadataConfig(): array|null |
|
36 | + public function getMetadataConfig(): array | null |
|
37 | 37 | { |
38 | 38 | return $this->metadataConfig; |
39 | 39 | } |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | /** @param mixed[]|null $associationMetadata */ |
34 | 34 | public function get( |
35 | 35 | Entity $targetEntity, |
36 | - Entity|null $owningEntity = null, |
|
37 | - string|null $associationName = null, |
|
38 | - array|null $associationMetadata = null, |
|
36 | + Entity | null $owningEntity = null, |
|
37 | + string | null $associationName = null, |
|
38 | + array | null $associationMetadata = null, |
|
39 | 39 | ): InputObjectType { |
40 | 40 | $typeName = $owningEntity ? |
41 | 41 | $owningEntity->getTypeName() . '_' . $associationName . '_filter' |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | // Limit entity filters |
54 | 54 | if ($entityMetadata['excludeCriteria']) { |
55 | 55 | $excludeCriteria = $entityMetadata['excludeCriteria']; |
56 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeCriteria) { |
|
57 | - return ! in_array($value, $excludeCriteria); |
|
56 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeCriteria) { |
|
57 | + return !in_array($value, $excludeCriteria); |
|
58 | 58 | }); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Limit association filters |
62 | 62 | if ($associationName) { |
63 | 63 | $excludeCriteria = $associationMetadata['excludeCriteria']; |
64 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeCriteria) { |
|
65 | - return ! in_array($value, $excludeCriteria); |
|
64 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeCriteria) { |
|
65 | + return !in_array($value, $excludeCriteria); |
|
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | 69 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
70 | 70 | // Only process fields that are in the graphql metadata |
71 | - if (! in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
71 | + if (!in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $fieldExcludeCriteria = $entityMetadata['fields'][$fieldName]['excludeCriteria']; |
93 | 93 | $allowedFilters = array_filter( |
94 | 94 | $allowedFilters, |
95 | - static function ($value) use ($fieldExcludeCriteria) { |
|
96 | - return ! in_array($value, $fieldExcludeCriteria); |
|
95 | + static function($value) use ($fieldExcludeCriteria) { |
|
96 | + return !in_array($value, $fieldExcludeCriteria); |
|
97 | 97 | }, |
98 | 98 | ); |
99 | 99 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // Add eq filter for to-one associations |
109 | 109 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
110 | 110 | // Only process fields which are in the graphql metadata |
111 | - if (! in_array($associationName, array_keys($entityMetadata['fields']))) { |
|
111 | + if (!in_array($associationName, array_keys($entityMetadata['fields']))) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 |