@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | ); |
74 | 74 | |
75 | 75 | // Get the allowed filters |
76 | - $allowedFilters = array_udiff(Filters::cases(), $excludedFilters, static function ($a, $b) { |
|
76 | + $allowedFilters = array_udiff(Filters::cases(), $excludedFilters, static function($a, $b) { |
|
77 | 77 | return $a->value <=> $b->value; |
78 | 78 | }); |
79 | 79 | |
80 | 80 | // Limit association filters |
81 | 81 | if ($associationName) { |
82 | 82 | $excludeFilters = Filters::fromArray($associationMetadata['excludeFilters'] ?? []); |
83 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeFilters) { |
|
84 | - return ! in_array($value, $excludeFilters); |
|
83 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeFilters) { |
|
84 | + return !in_array($value, $excludeFilters); |
|
85 | 85 | }); |
86 | 86 | } |
87 | 87 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
117 | 117 | // Only process fields that are in the graphql metadata |
118 | - if (! in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
118 | + if (!in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
119 | 119 | continue; |
120 | 120 | } |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ->get($entityMetadata['fields'][$fieldName]['type']); |
124 | 124 | |
125 | 125 | // Custom types may hit this condition |
126 | - if (! $type instanceof ScalarType) { |
|
126 | + if (!$type instanceof ScalarType) { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | $fieldExcludeFilters = Filters::fromArray($entityMetadata['fields'][$fieldName]['excludeFilters']); |
141 | 141 | $allowedFilters = array_filter( |
142 | 142 | $allowedFilters, |
143 | - static function ($value) use ($fieldExcludeFilters) { |
|
144 | - return ! in_array($value, $fieldExcludeFilters); |
|
143 | + static function($value) use ($fieldExcludeFilters) { |
|
144 | + return !in_array($value, $fieldExcludeFilters); |
|
145 | 145 | }, |
146 | 146 | ); |
147 | 147 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // Add eq filter for to-one associations |
189 | 189 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
190 | 190 | // Only process fields which are in the graphql metadata |
191 | - if (! isset($entityMetadata['fields'][$associationName])) { |
|
191 | + if (!isset($entityMetadata['fields'][$associationName])) { |
|
192 | 192 | continue; |
193 | 193 | } |
194 | 194 | |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | ClassMetadata::MANY_TO_MANY, |
201 | 201 | ClassMetadata::ONE_TO_MANY, |
202 | 202 | ]) |
203 | - || ! in_array(Filters::EQ, $allowedFilters) |
|
203 | + || !in_array(Filters::EQ, $allowedFilters) |
|
204 | 204 | ) { |
205 | 205 | continue; |
206 | 206 | } |
207 | 207 | |
208 | 208 | $filterTypeName = 'Filters_ID_' . md5(serialize($allowedFilters)); |
209 | 209 | |
210 | - if (! $this->typeContainer->has($filterTypeName)) { |
|
210 | + if (!$this->typeContainer->has($filterTypeName)) { |
|
211 | 211 | $this->typeContainer->set($filterTypeName, new Association($this->typeContainer, Type::id(), [Filters::EQ])); |
212 | 212 | } |
213 | 213 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | /** |
11 | 11 | * Attribute to describe an association for GraphQL |
12 | 12 | */ |
13 | -#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
13 | +#[Attribute(Attribute::TARGET_PROPERTY|Attribute::IS_REPEATABLE)] |
|
14 | 14 | final class Association |
15 | 15 | { |
16 | 16 | use ExcludeFilters; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | /** |
11 | 11 | * Attribute to describe a field for GraphQL |
12 | 12 | */ |
13 | -#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
13 | +#[Attribute(Attribute::TARGET_PROPERTY|Attribute::IS_REPEATABLE)] |
|
14 | 14 | final class Field |
15 | 15 | { |
16 | 16 | use ExcludeFilters; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $filters = array_udiff( |
37 | 37 | Filters::cases(), |
38 | 38 | $this->includeFilters, |
39 | - static function (Filters $a1, Filters $a2) { |
|
39 | + static function(Filters $a1, Filters $a2) { |
|
40 | 40 | return $a1->value <=> $a2->value; |
41 | 41 | }, |
42 | 42 | ); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $filters = array_uintersect( |
45 | 45 | Filters::cases(), |
46 | 46 | $this->excludeFilters, |
47 | - static function (Filters $a1, Filters $a2) { |
|
47 | + static function(Filters $a1, Filters $a2) { |
|
48 | 48 | return $a1->value <=> $a2->value; |
49 | 49 | }, |
50 | 50 | ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->resolveCollectionFactory = $container->get(ResolveCollectionFactory::class); |
74 | 74 | $this->typeContainer = $container->get(TypeContainer::class); |
75 | 75 | |
76 | - if (! isset($container->get('metadata')[$typeName])) { |
|
76 | + if (!isset($container->get('metadata')[$typeName])) { |
|
77 | 77 | throw new Error( |
78 | 78 | 'Entity ' . $typeName . ' is not mapped in the GraphQL metadata', |
79 | 79 | ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | foreach ($this->metadata['fields'] as $fieldName => $fieldMetadata) { |
124 | - if (! isset($fieldMetadata['alias'])) { |
|
124 | + if (!isset($fieldMetadata['alias'])) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
198 | 198 | |
199 | 199 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
200 | - if (! in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
200 | + if (!in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
220 | 220 | |
221 | 221 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
222 | - if (! in_array($associationName, array_keys($this->metadata['fields']))) { |
|
222 | + if (!in_array($associationName, array_keys($this->metadata['fields']))) { |
|
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | ]) |
233 | 233 | ) { |
234 | 234 | $targetEntity = $associationMetadata['targetEntity']; |
235 | - $fields[$associationName] = function () use ($targetEntity) { |
|
235 | + $fields[$associationName] = function() use ($targetEntity) { |
|
236 | 236 | $entity = $this->entityTypeContainer->get($targetEntity); |
237 | 237 | |
238 | 238 | return [ |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | // Collections |
248 | 248 | $targetEntity = $associationMetadata['targetEntity']; |
249 | 249 | |
250 | - $fields[$this->getExtractionMap()[$associationName] ?? $associationName] = function () use ($targetEntity, $associationName) { |
|
250 | + $fields[$this->getExtractionMap()[$associationName] ?? $associationName] = function() use ($targetEntity, $associationName) { |
|
251 | 251 | $entity = $this->entityTypeContainer->get($targetEntity); |
252 | 252 | $shortName = $this->getTypeName() . '_' . ucwords($associationName); |
253 | 253 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $mergedConfig = array_merge($default, $config); |
100 | 100 | |
101 | 101 | foreach ($mergedConfig as $field => $value) { |
102 | - if (! property_exists($this, $field)) { |
|
102 | + if (!property_exists($this, $field)) { |
|
103 | 103 | throw new InvalidArgumentException('Invalid configuration setting: ' . $field); |
104 | 104 | } |
105 | 105 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string|null |
26 | 26 | { |
27 | 27 | // @codeCoverageIgnoreStart |
28 | - if (! $valueNode instanceof StringValueNode) { |
|
28 | + if (!$valueNode instanceof StringValueNode) { |
|
29 | 29 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
30 | 30 | } |
31 | 31 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function parseValue(mixed $value): PHPDateTime |
41 | 41 | { |
42 | - if (! is_string($value)) { |
|
42 | + if (!is_string($value)) { |
|
43 | 43 | throw new Error('Time is not a string: ' . $value); |
44 | 44 | } |
45 | 45 | |
46 | - if (! preg_match('/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])(\.\d{1,6})?$/', $value)) { |
|
46 | + if (!preg_match('/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])(\.\d{1,6})?$/', $value)) { |
|
47 | 47 | throw new Error('Time ' . $value . ' format does not match H:i:s.u e.g. 13:34:40.867530'); |
48 | 48 | } |
49 | 49 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
25 | 25 | { |
26 | 26 | // @codeCoverageIgnoreStart |
27 | - if (! $valueNode instanceof StringValueNode) { |
|
27 | + if (!$valueNode instanceof StringValueNode) { |
|
28 | 28 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
29 | 29 | } |
30 | 30 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function parseValue(mixed $value): array|null |
41 | 41 | { |
42 | - if (! is_string($value)) { |
|
42 | + if (!is_string($value)) { |
|
43 | 43 | throw new Error('JSON is not a string: ' . $value); |
44 | 44 | } |
45 | 45 | |
46 | 46 | $data = json_decode($value, true); |
47 | 47 | |
48 | - if (! $data) { |
|
48 | + if (!$data) { |
|
49 | 49 | throw new Error('Could not parse JSON data'); |
50 | 50 | } |
51 | 51 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function parseLiteral(ASTNode $valueNode, array|null $variables = null): string |
26 | 26 | { |
27 | 27 | // @codeCoverageIgnoreStart |
28 | - if (! $valueNode instanceof StringValueNode) { |
|
28 | + if (!$valueNode instanceof StringValueNode) { |
|
29 | 29 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
30 | 30 | } |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function parseValue(mixed $value): mixed |
38 | 38 | { |
39 | - if (! is_string($value)) { |
|
39 | + if (!is_string($value)) { |
|
40 | 40 | throw new Error('Blob field as base64 is not a string: ' . $value); |
41 | 41 | } |
42 | 42 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function serialize(mixed $value): mixed |
53 | 53 | { |
54 | - if (! $value) { |
|
54 | + if (!$value) { |
|
55 | 55 | return $value; |
56 | 56 | } |
57 | 57 |