@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $suggestions = Utils::suggestionList( |
99 | 99 | Utils::printSafe($value), |
100 | 100 | array_map( |
101 | - static function ($enumValue) { |
|
101 | + static function($enumValue) { |
|
102 | 102 | return $enumValue->name; |
103 | 103 | }, |
104 | 104 | $type->getValues() |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if ($type instanceof InputObjectType) { |
150 | - if (! is_object($value) && ! is_array($value) && ! $value instanceof Traversable) { |
|
150 | + if (!is_object($value) && !is_array($value) && !$value instanceof Traversable) { |
|
151 | 151 | return self::ofErrors([ |
152 | 152 | self::coercionError( |
153 | 153 | sprintf('Expected type %s to be an object', $type->name), |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $pathStr = ''; |
271 | 271 | $currentPath = $path; |
272 | 272 | while ($currentPath) { |
273 | - $pathStr = |
|
273 | + $pathStr = |
|
274 | 274 | (is_string($currentPath['key']) |
275 | 275 | ? '.' . $currentPath['key'] |
276 | 276 | : '[' . $currentPath['key'] . ']') . $pathStr; |
@@ -187,7 +187,7 @@ |
||
187 | 187 | $fields = []; |
188 | 188 | foreach ($selectionSet->selections as $selectionNode) { |
189 | 189 | if ($selectionNode instanceof FieldNode) { |
190 | - $fields[$selectionNode->name->value] = $descend > 0 && ! empty($selectionNode->selectionSet) |
|
190 | + $fields[$selectionNode->name->value] = $descend > 0 && !empty($selectionNode->selectionSet) |
|
191 | 191 | ? $this->foldSelectionSet($selectionNode->selectionSet, $descend - 1) |
192 | 192 | : true; |
193 | 193 | } elseif ($selectionNode instanceof FragmentSpreadNode) { |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | $totalFields = 0; |
35 | 35 | foreach ($schema->getTypeMap() as $type) { |
36 | - if (! ($type instanceof ObjectType)) { |
|
36 | + if (!($type instanceof ObjectType)) { |
|
37 | 37 | continue; |
38 | 38 | } |
39 | 39 |
@@ -67,7 +67,7 @@ |
||
67 | 67 | return new Schema( |
68 | 68 | SchemaConfig::create() |
69 | 69 | ->setQuery($this->schemaBuilder->buildQueryType()) |
70 | - ->setTypeLoader(function ($name) { |
|
70 | + ->setTypeLoader(function($name) { |
|
71 | 71 | return $this->schemaBuilder->loadType($name); |
72 | 72 | }) |
73 | 73 | ); |
@@ -88,7 +88,7 @@ |
||
88 | 88 | |
89 | 89 | // Some parameters could be provided as serialized JSON. |
90 | 90 | foreach (['extensions', 'variables'] as $param) { |
91 | - if (! is_string($params[$param])) { |
|
91 | + if (!is_string($params[$param])) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | if ($fieldType instanceof InputObjectType) { |
72 | 72 | $this->fieldPath[] = $field; |
73 | 73 | |
74 | - if (! isset($this->fieldPathIndexByTypeName[$fieldType->name])) { |
|
74 | + if (!isset($this->fieldPathIndexByTypeName[$fieldType->name])) { |
|
75 | 75 | $this->validate($fieldType); |
76 | 76 | } else { |
77 | 77 | $cycleIndex = $this->fieldPathIndexByTypeName[$fieldType->name]; |
78 | 78 | $cyclePath = array_slice($this->fieldPath, $cycleIndex); |
79 | 79 | $fieldNames = array_map( |
80 | - static function (InputObjectField $field) : string { |
|
80 | + static function(InputObjectField $field) : string { |
|
81 | 81 | return $field->name; |
82 | 82 | }, |
83 | 83 | $cyclePath |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'Cannot reference Input Object "' . $fieldType->name . '" within itself ' |
88 | 88 | . 'through a series of non-null fields: "' . implode('.', $fieldNames) . '".', |
89 | 89 | array_map( |
90 | - static function (InputObjectField $field) : ?InputValueDefinitionNode { |
|
90 | + static function(InputObjectField $field) : ?InputValueDefinitionNode { |
|
91 | 91 | return $field->astNode; |
92 | 92 | }, |
93 | 93 | $cyclePath |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | Visitor::visitWithTypeInfo( |
129 | 129 | $typeInfo, |
130 | 130 | [ |
131 | - NodeKind::VARIABLE_DEFINITION => static function () { |
|
131 | + NodeKind::VARIABLE_DEFINITION => static function() { |
|
132 | 132 | return false; |
133 | 133 | }, |
134 | - NodeKind::VARIABLE => static function (VariableNode $variable) use ( |
|
134 | + NodeKind::VARIABLE => static function(VariableNode $variable) use ( |
|
135 | 135 | &$newUsages, |
136 | 136 | $typeInfo |
137 | 137 | ) { |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | $fragments = []; |
159 | 159 | $collectedNames = []; |
160 | 160 | $nodesToVisit = [$operation]; |
161 | - while (! empty($nodesToVisit)) { |
|
161 | + while (!empty($nodesToVisit)) { |
|
162 | 162 | $node = array_pop($nodesToVisit); |
163 | 163 | $spreads = $this->getFragmentSpreads($node); |
164 | 164 | foreach ($spreads as $spread) { |
165 | 165 | $fragName = $spread->name->value; |
166 | 166 | |
167 | - if (! empty($collectedNames[$fragName])) { |
|
167 | + if (!empty($collectedNames[$fragName])) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | 170 | |
171 | 171 | $collectedNames[$fragName] = true; |
172 | 172 | $fragment = $this->getFragment($fragName); |
173 | - if (! $fragment) { |
|
173 | + if (!$fragment) { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $spreads = []; |
195 | 195 | /** @var SelectionSetNode[] $setsToVisit */ |
196 | 196 | $setsToVisit = [$node->selectionSet]; |
197 | - while (! empty($setsToVisit)) { |
|
197 | + while (!empty($setsToVisit)) { |
|
198 | 198 | $set = array_pop($setsToVisit); |
199 | 199 | |
200 | 200 | for ($i = 0, $selectionCount = count($set->selections); $i < $selectionCount; $i++) { |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function getFragment($name) |
221 | 221 | { |
222 | 222 | $fragments = $this->fragments; |
223 | - if (! $fragments) { |
|
223 | + if (!$fragments) { |
|
224 | 224 | $fragments = []; |
225 | 225 | foreach ($this->getDocument()->definitions as $statement) { |
226 | - if (! ($statement instanceof FragmentDefinitionNode)) { |
|
226 | + if (!($statement instanceof FragmentDefinitionNode)) { |
|
227 | 227 | continue; |
228 | 228 | } |
229 | 229 |
@@ -26,17 +26,17 @@ |
||
26 | 26 | $operationCount = 0; |
27 | 27 | |
28 | 28 | return [ |
29 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use (&$operationCount) { |
|
29 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use (&$operationCount) { |
|
30 | 30 | $tmp = Utils::filter( |
31 | 31 | $node->definitions, |
32 | - static function (Node $definition) { |
|
32 | + static function(Node $definition) { |
|
33 | 33 | return $definition instanceof OperationDefinitionNode; |
34 | 34 | } |
35 | 35 | ); |
36 | 36 | |
37 | 37 | $operationCount = count($tmp); |
38 | 38 | }, |
39 | - NodeKind::OPERATION_DEFINITION => static function (OperationDefinitionNode $node) use ( |
|
39 | + NodeKind::OPERATION_DEFINITION => static function(OperationDefinitionNode $node) use ( |
|
40 | 40 | &$operationCount, |
41 | 41 | $context |
42 | 42 | ) { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->collector = new Collector($this->schema, $this); |
185 | 185 | $this->collector->initialize($this->documentNode, $this->operationName); |
186 | 186 | |
187 | - if (! empty($this->errors)) { |
|
187 | + if (!empty($this->errors)) { |
|
188 | 188 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $this->errors)); |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $this->rawVariableValues ?: [] |
195 | 195 | ); |
196 | 196 | |
197 | - if (! empty($errors)) { |
|
197 | + if (!empty($errors)) { |
|
198 | 198 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $errors)); |
199 | 199 | } |
200 | 200 | |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | ); |
216 | 216 | |
217 | 217 | $fieldDefinition = $this->findFieldDefinition($ctx); |
218 | - if (! $fieldDefinition->getType() instanceof NonNull) { |
|
218 | + if (!$fieldDefinition->getType() instanceof NonNull) { |
|
219 | 219 | $ctx->nullFence = [$shared->resultName]; |
220 | 220 | } |
221 | 221 | |
222 | - if ($this->collector->operation->operation === 'mutation' && ! $this->queue->isEmpty()) { |
|
222 | + if ($this->collector->operation->operation === 'mutation' && !$this->queue->isEmpty()) { |
|
223 | 223 | $this->schedule->enqueue($ctx); |
224 | 224 | } else { |
225 | 225 | $this->queue->enqueue(new Strand($this->spawn($ctx))); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $this->run(); |
230 | 230 | |
231 | 231 | if ($this->pending > 0) { |
232 | - return $this->promiseAdapter->create(function (callable $resolve) { |
|
232 | + return $this->promiseAdapter->create(function(callable $resolve) { |
|
233 | 233 | $this->doResolve = $resolve; |
234 | 234 | }); |
235 | 235 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | private function run() |
280 | 280 | { |
281 | 281 | RUN: |
282 | - while (! $this->queue->isEmpty()) { |
|
282 | + while (!$this->queue->isEmpty()) { |
|
283 | 283 | /** @var Strand $strand */ |
284 | 284 | $strand = $this->queue->dequeue(); |
285 | 285 | |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | // !!! increment pending before calling ->then() as it may invoke the callback right away |
310 | 310 | ++$this->pending; |
311 | 311 | |
312 | - if (! $value instanceof Promise) { |
|
312 | + if (!$value instanceof Promise) { |
|
313 | 313 | $value = $this->promiseAdapter->convertThenable($value); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $this->promiseAdapter |
317 | 317 | ->then( |
318 | 318 | $value, |
319 | - function ($value) use ($strand) { |
|
319 | + function($value) use ($strand) { |
|
320 | 320 | $strand->success = true; |
321 | 321 | $strand->value = $value; |
322 | 322 | $this->queue->enqueue($strand); |
323 | 323 | $this->done(); |
324 | 324 | }, |
325 | - function (Throwable $throwable) use ($strand) { |
|
325 | + function(Throwable $throwable) use ($strand) { |
|
326 | 326 | $strand->success = false; |
327 | 327 | $strand->value = $throwable; |
328 | 328 | $this->queue->enqueue($strand); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | $value = $resolve($ctx->value, $arguments, $this->contextValue, $ctx->resolveInfo); |
436 | 436 | |
437 | - if (! $this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
437 | + if (!$this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
438 | 438 | $returnValue = yield $this->completeValue( |
439 | 439 | $ctx, |
440 | 440 | $returnType, |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | if ($returnValue !== self::$undefined) { |
457 | 457 | $ctx->result->{$ctx->shared->resultName} = $returnValue; |
458 | 458 | } elseif ($ctx->resolveInfo !== null && $ctx->resolveInfo->returnType instanceof NonNull) { // !!! $ctx->resolveInfo might not have been initialized yet |
459 | - $result =& $this->rootResult; |
|
459 | + $result = & $this->rootResult; |
|
460 | 460 | foreach ($ctx->nullFence ?? [] as $key) { |
461 | 461 | if (is_string($key)) { |
462 | - $result =& $result->{$key}; |
|
462 | + $result = & $result->{$key}; |
|
463 | 463 | } else { |
464 | - $result =& $result[$key]; |
|
464 | + $result = & $result[$key]; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | $result = null; |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $type = $type->getWrappedType(); |
504 | 504 | } |
505 | 505 | |
506 | - if (! $type instanceof LeafType) { |
|
506 | + if (!$type instanceof LeafType) { |
|
507 | 507 | return false; |
508 | 508 | } |
509 | 509 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $ctx->resolveInfo->path = $itemPath; |
637 | 637 | |
638 | 638 | try { |
639 | - if (! $this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
639 | + if (!$this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
640 | 640 | $itemReturnValue = yield $this->completeValue($ctx, $itemType, $itemValue, $itemPath, $nullFence); |
641 | 641 | } |
642 | 642 | } catch (Throwable $reason) { |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | |
728 | 728 | $returnValue = self::$undefined; |
729 | 729 | goto CHECKED_RETURN; |
730 | - } elseif (! $objectType instanceof ObjectType) { |
|
730 | + } elseif (!$objectType instanceof ObjectType) { |
|
731 | 731 | $this->addError(Error::createLocatedError( |
732 | 732 | new InvariantViolation(sprintf( |
733 | 733 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | |
748 | 748 | $returnValue = null; |
749 | 749 | goto CHECKED_RETURN; |
750 | - } elseif (! $this->schema->isPossibleType($type, $objectType)) { |
|
750 | + } elseif (!$this->schema->isPossibleType($type, $objectType)) { |
|
751 | 751 | $this->addError(Error::createLocatedError( |
752 | 752 | new InvariantViolation(sprintf( |
753 | 753 | 'Runtime Object type "%s" is not a possible type for "%s".', |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | if ($typeCheck !== null) { |
800 | 800 | // !!! $objectType->isTypeOf() might return promise, yield to resolve |
801 | 801 | $typeCheck = yield $typeCheck; |
802 | - if (! $typeCheck) { |
|
802 | + if (!$typeCheck) { |
|
803 | 803 | $this->addError(Error::createLocatedError( |
804 | 804 | sprintf('Expected value of type "%s" but got: %s.', $type->name, Utils::printSafe($value)), |
805 | 805 | $ctx->shared->fieldNodes, |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | $selectedType = null; |
951 | 951 | foreach ($possibleTypes as $type) { |
952 | 952 | $typeCheck = yield $type->isTypeOf($value, $this->contextValue, $ctx->resolveInfo); |
953 | - if ($selectedType !== null || ! $typeCheck) { |
|
953 | + if ($selectedType !== null || !$typeCheck) { |
|
954 | 954 | continue; |
955 | 955 | } |
956 | 956 |