@@ -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 | ); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | public static function runQueue() : void |
40 | 40 | { |
41 | 41 | $queue = self::getQueue(); |
42 | - while (! $queue->isEmpty()) { |
|
42 | + while (!$queue->isEmpty()) { |
|
43 | 43 | /** @var self $dequeuedNodeValue */ |
44 | 44 | $dequeuedNodeValue = $queue->dequeue(); |
45 | 45 | $dequeuedNodeValue->run(); |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | { |
139 | 139 | $result = []; |
140 | 140 | |
141 | - if (! empty($this->errors)) { |
|
142 | - $errorsHandler = $this->errorsHandler ?: static function (array $errors, callable $formatter) { |
|
141 | + if (!empty($this->errors)) { |
|
142 | + $errorsHandler = $this->errorsHandler ?: static function(array $errors, callable $formatter) { |
|
143 | 143 | return array_map($formatter, $errors); |
144 | 144 | }; |
145 | 145 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $result['data'] = $this->data; |
154 | 154 | } |
155 | 155 | |
156 | - if (! empty($this->extensions)) { |
|
156 | + if (!empty($this->extensions)) { |
|
157 | 157 | $result['extensions'] = $this->extensions; |
158 | 158 | } |
159 | 159 |
@@ -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 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $fieldName = $fieldNode->name->value; |
119 | 119 | |
120 | 120 | $argumentValueMap = null; |
121 | - if (! empty($fieldNode->arguments)) { |
|
121 | + if (!empty($fieldNode->arguments)) { |
|
122 | 122 | foreach ($fieldNode->arguments as $argumentNode) { |
123 | 123 | $argumentValueMap = $argumentValueMap ?? []; |
124 | 124 | $argumentValueMap[$argumentNode->name->value] = $argumentNode->value; |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($fieldName !== Introspection::TYPE_NAME_FIELD_NAME && |
129 | - ! ($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
130 | - ! $runtimeType->hasField($fieldName) |
|
129 | + !($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
130 | + !$runtimeType->hasField($fieldName) |
|
131 | 131 | ) { |
132 | 132 | // do not emit error |
133 | 133 | continue; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | foreach ($selectionSet->selections as $selection) { |
147 | 147 | /** @var FieldNode|FragmentSpreadNode|InlineFragmentNode $selection */ |
148 | - if (! empty($selection->directives)) { |
|
148 | + if (!empty($selection->directives)) { |
|
149 | 149 | foreach ($selection->directives as $directiveNode) { |
150 | 150 | if ($directiveNode->name->value === Directive::SKIP_NAME) { |
151 | 151 | /** @var VariableNode|NullValueNode|IntValueNode|FloatValueNode|StringValueNode|BooleanValueNode|EnumValueNode|ListValueNode|ObjectValueNode|null $condition */ |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($selection instanceof FieldNode) { |
195 | 195 | $resultName = $selection->alias === null ? $selection->name->value : $selection->alias->value; |
196 | 196 | |
197 | - if (! isset($this->fields[$resultName])) { |
|
197 | + if (!isset($this->fields[$resultName])) { |
|
198 | 198 | $this->fields[$resultName] = []; |
199 | 199 | } |
200 | 200 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | - if (! isset($this->fragments[$fragmentName])) { |
|
209 | + if (!isset($this->fragments[$fragmentName])) { |
|
210 | 210 | $this->runtime->addError(new Error( |
211 | 211 | sprintf('Fragment "%s" does not exist.', $fragmentName), |
212 | 212 | $selection |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $fragmentDefinition = $this->fragments[$fragmentName]; |
220 | 220 | $conditionTypeName = $fragmentDefinition->typeCondition->name->value; |
221 | 221 | |
222 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
222 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
223 | 223 | $this->runtime->addError(new Error( |
224 | 224 | sprintf('Cannot spread fragment "%s", type "%s" does not exist.', $fragmentName, $conditionTypeName), |
225 | 225 | $selection |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | } elseif ($conditionType instanceof AbstractType) { |
237 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
237 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
238 | 238 | continue; |
239 | 239 | } |
240 | 240 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if ($selection->typeCondition !== null) { |
245 | 245 | $conditionTypeName = $selection->typeCondition->name->value; |
246 | 246 | |
247 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
247 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
248 | 248 | $this->runtime->addError(new Error( |
249 | 249 | sprintf('Cannot spread inline fragment, type "%s" does not exist.', $conditionTypeName), |
250 | 250 | $selection |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | } elseif ($conditionType instanceof AbstractType) { |
262 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
262 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
263 | 263 | continue; |
264 | 264 | } |
265 | 265 | } |