@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Custom types may hit this condition |
| 40 | 40 | // @codeCoverageIgnoreStart |
| 41 | - if (! $type instanceof ScalarType) { |
|
| 41 | + if (!$type instanceof ScalarType) { |
|
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | // Between is a special case filter. |
| 48 | 48 | // To avoid creating a new Between type for each field, |
| 49 | 49 | // check if the Between type exists and reuse it. |
| 50 | - if (! $fields[$filter->value]['type'] instanceof Between) { |
|
| 50 | + if (!$fields[$filter->value]['type'] instanceof Between) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (! $typeContainer->has('Between_' . $type->name())) { |
|
| 54 | + if (!$typeContainer->has('Between_' . $type->name())) { |
|
| 55 | 55 | $typeContainer->set('Between_' . $type->name(), new Between($type)); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -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 | |
@@ -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 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | 'cursor' => $cursors['last'], |
| 214 | 214 | ]; |
| 215 | 215 | |
| 216 | - if (! $cursors['first']) { |
|
| 216 | + if (!$cursors['first']) { |
|
| 217 | 217 | $cursors['first'] = $cursors['last']; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $limit = $associationLimit; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if (! $limit) { |
|
| 253 | + if (!$limit) { |
|
| 254 | 254 | $limit = $this->config->getLimit(); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $offset = 0; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ($paginationFields['last'] && ! $paginationFields['before']) { |
|
| 274 | + if ($paginationFields['last'] && !$paginationFields['before']) { |
|
| 275 | 275 | $offset = $itemCount - $paginationFields['last']; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -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 | |