@@ -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 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function get(Entity $entity): Closure |
46 | 46 | { |
47 | - return function ($source, array $args, $context, ResolveInfo $info) use ($entity) { |
|
47 | + return function($source, array $args, $context, ResolveInfo $info) use ($entity) { |
|
48 | 48 | $fieldResolver = $this->fieldResolver; |
49 | 49 | $collection = $fieldResolver($source, $args, $context, $info); |
50 | 50 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - if (! empty($orderBy)) { |
|
109 | + if (!empty($orderBy)) { |
|
110 | 110 | $criteria->orderBy($orderBy); |
111 | 111 | } |
112 | 112 | |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | 'cursor' => $cursors['last'], |
224 | 224 | ]; |
225 | 225 | |
226 | - if (! $startCursor) { |
|
226 | + if (!$startCursor) { |
|
227 | 227 | $startCursor = $cursors['last']; |
228 | 228 | } |
229 | 229 | |
230 | - if (! $cursors['first']) { |
|
230 | + if (!$cursors['first']) { |
|
231 | 231 | $cursors['first'] = $cursors['last']; |
232 | 232 | } |
233 | 233 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $limit = $associationLimit; |
266 | 266 | } |
267 | 267 | |
268 | - if (! $limit) { |
|
268 | + if (!$limit) { |
|
269 | 269 | $limit = $this->config->getLimit(); |
270 | 270 | } |
271 | 271 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $offset = 0; |
287 | 287 | } |
288 | 288 | |
289 | - if ($paginationFields['last'] && ! $paginationFields['before']) { |
|
289 | + if ($paginationFields['last'] && !$paginationFields['before']) { |
|
290 | 290 | $offset = $itemCount - $paginationFields['last']; |
291 | 291 | } |
292 | 292 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function get(Entity $entity, string|null $eventName): Closure |
36 | 36 | { |
37 | - return function ($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) { |
|
37 | + return function($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) { |
|
38 | 38 | $entityClass = $entity->getEntityClass(); |
39 | 39 | $queryBuilderFilter = new QueryBuilderFilter(); |
40 | 40 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $itemCount = $paginator->count(); |
149 | 149 | |
150 | 150 | // Rebuild paginator if needed |
151 | - if ($paginationFields['last'] && ! $paginationFields['before']) { |
|
151 | + if ($paginationFields['last'] && !$paginationFields['before']) { |
|
152 | 152 | $offsetAndLimit['offset'] = $itemCount - $paginationFields['last']; |
153 | 153 | $queryBuilder->setFirstResult($offsetAndLimit['offset']); |
154 | 154 | $paginator = new Paginator($queryBuilder->getQuery()); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | 'cursor' => $cursors['last'], |
164 | 164 | ]; |
165 | 165 | |
166 | - if (! $startCursor) { |
|
166 | + if (!$startCursor) { |
|
167 | 167 | $startCursor = $cursors['last']; |
168 | 168 | } |
169 | 169 | |
170 | - if (! $cursors['first']) { |
|
170 | + if (!$cursors['first']) { |
|
171 | 171 | $cursors['first'] = $cursors['last']; |
172 | 172 | } |
173 | 173 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $limit = $this->metadata[$entity->getEntityClass()]['limit']; |
198 | 198 | |
199 | - if (! $limit) { |
|
199 | + if (!$limit) { |
|
200 | 200 | $limit = $this->config->getLimit(); |
201 | 201 | } |
202 | 202 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function parseLiteral(ASTNode $valueNode, array|null $variables = null): PHPDateTimeTZImmutable |
27 | 27 | { |
28 | 28 | // @codeCoverageIgnoreStart |
29 | - if (! $valueNode instanceof StringValueNode) { |
|
29 | + if (!$valueNode instanceof StringValueNode) { |
|
30 | 30 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
31 | 31 | } |
32 | 32 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | #[Override] |
39 | 39 | public function parseValue(mixed $value): PHPDateTimeTZImmutable |
40 | 40 | { |
41 | - if (! is_string($value)) { |
|
41 | + if (!is_string($value)) { |
|
42 | 42 | throw new Error('datetimetz_immutable is not a string: ' . $value); |
43 | 43 | } |
44 | 44 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function parseLiteral(ASTNode $valueNode, array|null $variables = null): DateTimeImmutable|false |
27 | 27 | { |
28 | 28 | // @codeCoverageIgnoreStart |
29 | - if (! $valueNode instanceof StringValueNode) { |
|
29 | + if (!$valueNode instanceof StringValueNode) { |
|
30 | 30 | throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode); |
31 | 31 | } |
32 | 32 | |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | #[Override] |
39 | 39 | public function parseValue(mixed $value): DateTimeImmutable|false |
40 | 40 | { |
41 | - if (! is_string($value)) { |
|
41 | + if (!is_string($value)) { |
|
42 | 42 | throw new Error('Date is not a string: ' . $value); |
43 | 43 | } |
44 | 44 | |
45 | - if (! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $value)) { |
|
45 | + if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $value)) { |
|
46 | 46 | throw new Error('Date format does not match Y-m-d e.g. 2004-02-12.'); |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | throw new Error('Expected DateTimeImmutable object. Got string.'); |
57 | 57 | } |
58 | 58 | |
59 | - if (! $value instanceof DateTimeImmutable) { |
|
59 | + if (!$value instanceof DateTimeImmutable) { |
|
60 | 60 | throw new Error('Expected DateTimeImmutable object. Got ' . $value::class); |
61 | 61 | } |
62 | 62 |