@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | case 117: |
519 | 519 | $position = $this->position; |
520 | 520 | [$hex] = $this->readChars(4, true); |
521 | - if (! preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
521 | + if (!preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
522 | 522 | throw new SyntaxError( |
523 | 523 | $this->source, |
524 | 524 | $position - 1, |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $highOrderByte = $code >> 8; |
533 | 533 | if (0xD8 <= $highOrderByte && $highOrderByte <= 0xDF) { |
534 | 534 | [$utf16Continuation] = $this->readChars(6, true); |
535 | - if (! preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) { |
|
535 | + if (!preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) { |
|
536 | 536 | throw new SyntaxError( |
537 | 537 | $this->source, |
538 | 538 | $this->position - 5, |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->expect($openKind); |
370 | 370 | |
371 | 371 | $nodes = []; |
372 | - while (! $this->skip($closeKind)) { |
|
372 | + while (!$this->skip($closeKind)) { |
|
373 | 373 | $nodes[] = $parseFn($this); |
374 | 374 | } |
375 | 375 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $this->expect($openKind); |
390 | 390 | |
391 | 391 | $nodes = [$parseFn($this)]; |
392 | - while (! $this->skip($closeKind)) { |
|
392 | + while (!$this->skip($closeKind)) { |
|
393 | 393 | $nodes[] = $parseFn($this); |
394 | 394 | } |
395 | 395 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | return new DocumentNode([ |
424 | 424 | 'definitions' => $this->many( |
425 | 425 | Token::SOF, |
426 | - function () { |
|
426 | + function() { |
|
427 | 427 | return $this->parseDefinition(); |
428 | 428 | }, |
429 | 429 | Token::EOF |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | return $this->peek(Token::PAREN_L) |
551 | 551 | ? $this->many( |
552 | 552 | Token::PAREN_L, |
553 | - function () { |
|
553 | + function() { |
|
554 | 554 | return $this->parseVariableDefinition(); |
555 | 555 | }, |
556 | 556 | Token::PAREN_R |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | [ |
602 | 602 | 'selections' => $this->many( |
603 | 603 | Token::BRACE_L, |
604 | - function () { |
|
604 | + function() { |
|
605 | 605 | return $this->parseSelection(); |
606 | 606 | }, |
607 | 607 | Token::BRACE_R |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | private function parseArguments(bool $isConst) : NodeList |
657 | 657 | { |
658 | 658 | $parseFn = $isConst |
659 | - ? function () { |
|
659 | + ? function() { |
|
660 | 660 | return $this->parseConstArgument(); |
661 | 661 | } |
662 | - : function () { |
|
662 | + : function() { |
|
663 | 663 | return $this->parseArgument(); |
664 | 664 | }; |
665 | 665 | |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | break; |
857 | 857 | |
858 | 858 | case Token::DOLLAR: |
859 | - if (! $isConst) { |
|
859 | + if (!$isConst) { |
|
860 | 860 | return $this->parseVariable(); |
861 | 861 | } |
862 | 862 | break; |
@@ -897,9 +897,9 @@ discard block |
||
897 | 897 | private function parseArray(bool $isConst) : ListValueNode |
898 | 898 | { |
899 | 899 | $start = $this->lexer->token; |
900 | - $parseFn = $isConst ? function () { |
|
900 | + $parseFn = $isConst ? function() { |
|
901 | 901 | return $this->parseConstValue(); |
902 | - } : function () { |
|
902 | + } : function() { |
|
903 | 903 | return $this->parseVariableValue(); |
904 | 904 | }; |
905 | 905 | |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | $start = $this->lexer->token; |
917 | 917 | $this->expect(Token::BRACE_L); |
918 | 918 | $fields = []; |
919 | - while (! $this->skip(Token::BRACE_R)) { |
|
919 | + while (!$this->skip(Token::BRACE_R)) { |
|
920 | 920 | $fields[] = $this->parseObjectField($isConst); |
921 | 921 | } |
922 | 922 | |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | $operationTypes = $this->many( |
1092 | 1092 | Token::BRACE_L, |
1093 | - function () { |
|
1093 | + function() { |
|
1094 | 1094 | return $this->parseOperationTypeDefinition(); |
1095 | 1095 | }, |
1096 | 1096 | Token::BRACE_R |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $types[] = $this->parseNamedType(); |
1181 | 1181 | } while ($this->skip(Token::AMP) || |
1182 | 1182 | // Legacy support for the SDL? |
1183 | - (! empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME)) |
|
1183 | + (!empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME)) |
|
1184 | 1184 | ); |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | private function parseFieldsDefinition() : NodeList |
1194 | 1194 | { |
1195 | 1195 | // Legacy support for the SDL? |
1196 | - if (! empty($this->lexer->options['allowLegacySDLEmptyFields']) |
|
1196 | + if (!empty($this->lexer->options['allowLegacySDLEmptyFields']) |
|
1197 | 1197 | && $this->peek(Token::BRACE_L) |
1198 | 1198 | && $this->lexer->lookahead()->kind === Token::BRACE_R |
1199 | 1199 | ) { |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | $nodeList = $this->peek(Token::BRACE_L) |
1208 | 1208 | ? $this->many( |
1209 | 1209 | Token::BRACE_L, |
1210 | - function () { |
|
1210 | + function() { |
|
1211 | 1211 | return $this->parseFieldDefinition(); |
1212 | 1212 | }, |
1213 | 1213 | Token::BRACE_R |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | $nodeList = $this->peek(Token::PAREN_L) |
1251 | 1251 | ? $this->many( |
1252 | 1252 | Token::PAREN_L, |
1253 | - function () { |
|
1253 | + function() { |
|
1254 | 1254 | return $this->parseInputValueDefinition(); |
1255 | 1255 | }, |
1256 | 1256 | Token::PAREN_R |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | $nodeList = $this->peek(Token::BRACE_L) |
1383 | 1383 | ? $this->many( |
1384 | 1384 | Token::BRACE_L, |
1385 | - function () { |
|
1385 | + function() { |
|
1386 | 1386 | return $this->parseEnumValueDefinition(); |
1387 | 1387 | }, |
1388 | 1388 | Token::BRACE_R |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | $nodeList = $this->peek(Token::BRACE_L) |
1441 | 1441 | ? $this->many( |
1442 | 1442 | Token::BRACE_L, |
1443 | - function () { |
|
1443 | + function() { |
|
1444 | 1444 | return $this->parseInputValueDefinition(); |
1445 | 1445 | }, |
1446 | 1446 | Token::BRACE_R |
@@ -80,12 +80,12 @@ |
||
80 | 80 | // TODO: rework with generators when PHP minimum required version is changed to 5.5+ |
81 | 81 | $promisesOrValues = Utils::map( |
82 | 82 | $promisesOrValues, |
83 | - static function ($item) { |
|
83 | + static function($item) { |
|
84 | 84 | return $item instanceof Promise ? $item->adoptedPromise : $item; |
85 | 85 | } |
86 | 86 | ); |
87 | 87 | |
88 | - $promise = all($promisesOrValues)->then(static function ($values) use ($promisesOrValues) { |
|
88 | + $promise = all($promisesOrValues)->then(static function($values) use ($promisesOrValues) { |
|
89 | 89 | $orderedResults = []; |
90 | 90 | |
91 | 91 | foreach ($promisesOrValues as $key => $value) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public static function runQueue() : void |
42 | 42 | { |
43 | 43 | $q = self::$queue; |
44 | - while ($q !== null && ! $q->isEmpty()) { |
|
44 | + while ($q !== null && !$q->isEmpty()) { |
|
45 | 45 | $task = $q->dequeue(); |
46 | 46 | $task(); |
47 | 47 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | } |
57 | 57 | if (is_object($value) && method_exists($value, 'then')) { |
58 | 58 | $value->then( |
59 | - function ($resolvedValue) { |
|
59 | + function($resolvedValue) { |
|
60 | 60 | $this->resolve($resolvedValue); |
61 | 61 | }, |
62 | - function ($reason) { |
|
62 | + function($reason) { |
|
63 | 63 | $this->reject($reason); |
64 | 64 | } |
65 | 65 | ); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function reject($reason) : self |
87 | 87 | { |
88 | - if (! $reason instanceof Throwable) { |
|
88 | + if (!$reason instanceof Throwable) { |
|
89 | 89 | throw new Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); |
90 | 90 | } |
91 | 91 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ); |
116 | 116 | |
117 | 117 | foreach ($this->waiting as $descriptor) { |
118 | - self::getQueue()->enqueue(function () use ($descriptor) { |
|
118 | + self::getQueue()->enqueue(function() use ($descriptor) { |
|
119 | 119 | /** @var self $promise */ |
120 | 120 | [$promise, $onFulfilled, $onRejected] = $descriptor; |
121 | 121 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function convertThenable($thenable) |
34 | 34 | { |
35 | - if (! $thenable instanceof Deferred) { |
|
35 | + if (!$thenable instanceof Deferred) { |
|
36 | 36 | throw new InvariantViolation('Expected instance of GraphQL\Deferred, got ' . Utils::printSafe($thenable)); |
37 | 37 | } |
38 | 38 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if ($promiseOrValue instanceof Promise) { |
111 | 111 | $result[$index] = null; |
112 | 112 | $promiseOrValue->then( |
113 | - static function ($value) use ($index, &$count, $total, &$result, $all) { |
|
113 | + static function($value) use ($index, &$count, $total, &$result, $all) { |
|
114 | 114 | $result[$index] = $value; |
115 | 115 | $count++; |
116 | 116 | if ($count < $total) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $promiseQueue = SyncPromise::getQueue(); |
146 | 146 | |
147 | 147 | while ($promise->adoptedPromise->state === SyncPromise::PENDING && |
148 | - ! ($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
148 | + !($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
149 | 149 | ) { |
150 | 150 | Deferred::runQueue(); |
151 | 151 | SyncPromise::runQueue(); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct($adoptedPromise, PromiseAdapter $adapter) |
26 | 26 | { |
27 | - Utils::invariant(! $adoptedPromise instanceof self, 'Expecting promise from adapted system, got ' . self::class); |
|
27 | + Utils::invariant(!$adoptedPromise instanceof self, 'Expecting promise from adapted system, got ' . self::class); |
|
28 | 28 | |
29 | 29 | $this->adapter = $adapter; |
30 | 30 | $this->adoptedPromise = $adoptedPromise; |
@@ -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 |
@@ -265,23 +265,23 @@ |
||
265 | 265 | ); |
266 | 266 | } elseif ($hasValue) { |
267 | 267 | if ($argumentValueNode instanceof NullValueNode) { |
268 | - // If the explicit value `null` was provided, an entry in the coerced |
|
269 | - // values must exist as the value `null`. |
|
268 | + // If the explicit value `null` was provided, an entry in the coerced |
|
269 | + // values must exist as the value `null`. |
|
270 | 270 | $coercedValues[$name] = null; |
271 | 271 | } elseif ($argumentValueNode instanceof VariableNode) { |
272 | 272 | $variableName = $argumentValueNode->name->value; |
273 | 273 | Utils::invariant($variableValues !== null, 'Must exist for hasValue to be true.'); |
274 | - // Note: This does no further checking that this variable is correct. |
|
275 | - // This assumes that this query has been validated and the variable |
|
276 | - // usage here is of the correct type. |
|
274 | + // Note: This does no further checking that this variable is correct. |
|
275 | + // This assumes that this query has been validated and the variable |
|
276 | + // usage here is of the correct type. |
|
277 | 277 | $coercedValues[$name] = $variableValues[$variableName] ?? null; |
278 | 278 | } else { |
279 | 279 | $valueNode = $argumentValueNode; |
280 | 280 | $coercedValue = AST::valueFromAST($valueNode, $argType, $variableValues); |
281 | 281 | if (Utils::isInvalid($coercedValue)) { |
282 | - // Note: ValuesOfCorrectType validation should catch this before |
|
283 | - // execution. This is a runtime check to ensure execution does not |
|
284 | - // continue with an invalid argument value. |
|
282 | + // Note: ValuesOfCorrectType validation should catch this before |
|
283 | + // execution. This is a runtime check to ensure execution does not |
|
284 | + // continue with an invalid argument value. |
|
285 | 285 | throw new Error( |
286 | 286 | 'Argument "' . $name . '" has invalid value ' . Printer::doPrint($valueNode) . '.', |
287 | 287 | [$argumentValueNode] |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** @var InputType|Type $varType */ |
68 | 68 | $varType = TypeInfo::typeFromAST($schema, $varDefNode->type); |
69 | 69 | |
70 | - if (! Type::isInputType($varType)) { |
|
70 | + if (!Type::isInputType($varType)) { |
|
71 | 71 | // Must use input types for variables. This should be caught during |
72 | 72 | // validation, however is checked again here for safety. |
73 | 73 | $errors[] = new Error( |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $hasValue = array_key_exists($varName, $inputs); |
83 | 83 | $value = $hasValue ? $inputs[$varName] : Utils::undefined(); |
84 | 84 | |
85 | - if (! $hasValue && $varDefNode->defaultValue) { |
|
85 | + if (!$hasValue && $varDefNode->defaultValue) { |
|
86 | 86 | // If no value was provided to a variable with a default value, |
87 | 87 | // use the default value. |
88 | 88 | $coercedValues[$varName] = AST::valueFromAST($varDefNode->defaultValue, $varType); |
89 | - } elseif ((! $hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
89 | + } elseif ((!$hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
90 | 90 | // If no value or a nullish value was provided to a variable with a |
91 | 91 | // non-null type (required), produce an error. |
92 | 92 | $errors[] = new Error( |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - if (! empty($errors)) { |
|
139 | + if (!empty($errors)) { |
|
140 | 140 | return [$errors, null]; |
141 | 141 | } |
142 | 142 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
161 | 161 | $directiveNode = Utils::find( |
162 | 162 | $node->directives, |
163 | - static function (DirectiveNode $directive) use ($directiveDef) { |
|
163 | + static function(DirectiveNode $directive) use ($directiveDef) { |
|
164 | 164 | return $directive->name->value === $directiveDef->name; |
165 | 165 | } |
166 | 166 | ); |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | $isNull = $argumentValueNode instanceof NullValueNode; |
234 | 234 | } |
235 | 235 | |
236 | - if (! $hasValue && $argumentDefinition->defaultValueExists()) { |
|
236 | + if (!$hasValue && $argumentDefinition->defaultValueExists()) { |
|
237 | 237 | // If no argument was provided where the definition has a default value, |
238 | 238 | // use the default value. |
239 | 239 | $coercedValues[$name] = $argumentDefinition->defaultValue; |
240 | - } elseif ((! $hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
240 | + } elseif ((!$hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
241 | 241 | // If no argument or a null value was provided to an argument with a |
242 | 242 | // non-null type (required), produce a field error. |
243 | 243 | if ($isNull) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | return $errors |
329 | 329 | ? array_map( |
330 | - static function (Throwable $error) { |
|
330 | + static function(Throwable $error) { |
|
331 | 331 | return $error->getMessage(); |
332 | 332 | }, |
333 | 333 | $errors |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | private function __construct(ExecutionContext $context) |
63 | 63 | { |
64 | - if (! self::$UNDEFINED) { |
|
64 | + if (!self::$UNDEFINED) { |
|
65 | 65 | self::$UNDEFINED = Utils::undefined(); |
66 | 66 | } |
67 | 67 | $this->exeContext = $context; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $errors = array_merge($errors, $coercionErrors); |
177 | 177 | } |
178 | 178 | } |
179 | - if (! empty($errors)) { |
|
179 | + if (!empty($errors)) { |
|
180 | 180 | return $errors; |
181 | 181 | } |
182 | 182 | Utils::invariant($operation, 'Has operation if no errors.'); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | private function buildResponse($data) |
223 | 223 | { |
224 | 224 | if ($this->isPromise($data)) { |
225 | - return $data->then(function ($resolved) { |
|
225 | + return $data->then(function($resolved) { |
|
226 | 226 | return $this->buildResponse($resolved); |
227 | 227 | }); |
228 | 228 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | if ($this->isPromise($result)) { |
258 | 258 | return $result->then( |
259 | 259 | null, |
260 | - function ($error) { |
|
260 | + function($error) { |
|
261 | 261 | if ($error instanceof Error) { |
262 | 262 | $this->exeContext->addError($error); |
263 | 263 | |
@@ -346,18 +346,18 @@ discard block |
||
346 | 346 | foreach ($selectionSet->selections as $selection) { |
347 | 347 | switch (true) { |
348 | 348 | case $selection instanceof FieldNode: |
349 | - if (! $this->shouldIncludeNode($selection)) { |
|
349 | + if (!$this->shouldIncludeNode($selection)) { |
|
350 | 350 | break; |
351 | 351 | } |
352 | 352 | $name = self::getFieldEntryKey($selection); |
353 | - if (! isset($fields[$name])) { |
|
353 | + if (!isset($fields[$name])) { |
|
354 | 354 | $fields[$name] = new ArrayObject(); |
355 | 355 | } |
356 | 356 | $fields[$name][] = $selection; |
357 | 357 | break; |
358 | 358 | case $selection instanceof InlineFragmentNode: |
359 | - if (! $this->shouldIncludeNode($selection) || |
|
360 | - ! $this->doesFragmentConditionMatch($selection, $runtimeType) |
|
359 | + if (!$this->shouldIncludeNode($selection) || |
|
360 | + !$this->doesFragmentConditionMatch($selection, $runtimeType) |
|
361 | 361 | ) { |
362 | 362 | break; |
363 | 363 | } |
@@ -370,13 +370,13 @@ discard block |
||
370 | 370 | break; |
371 | 371 | case $selection instanceof FragmentSpreadNode: |
372 | 372 | $fragName = $selection->name->value; |
373 | - if (! empty($visitedFragmentNames[$fragName]) || ! $this->shouldIncludeNode($selection)) { |
|
373 | + if (!empty($visitedFragmentNames[$fragName]) || !$this->shouldIncludeNode($selection)) { |
|
374 | 374 | break; |
375 | 375 | } |
376 | 376 | $visitedFragmentNames[$fragName] = true; |
377 | 377 | /** @var FragmentDefinitionNode|null $fragment */ |
378 | 378 | $fragment = $exeContext->fragments[$fragName] ?? null; |
379 | - if ($fragment === null || ! $this->doesFragmentConditionMatch($fragment, $runtimeType)) { |
|
379 | + if ($fragment === null || !$this->doesFragmentConditionMatch($fragment, $runtimeType)) { |
|
380 | 380 | break; |
381 | 381 | } |
382 | 382 | $this->collectFields( |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | $variableValues |
418 | 418 | ); |
419 | 419 | |
420 | - return ! isset($include['if']) || $include['if'] !== false; |
|
420 | + return !isset($include['if']) || $include['if'] !== false; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | { |
469 | 469 | $result = $this->promiseReduce( |
470 | 470 | array_keys($fields->getArrayCopy()), |
471 | - function ($results, $responseName) use ($path, $parentType, $rootValue, $fields) { |
|
471 | + function($results, $responseName) use ($path, $parentType, $rootValue, $fields) { |
|
472 | 472 | $fieldNodes = $fields[$responseName]; |
473 | 473 | $fieldPath = $path; |
474 | 474 | $fieldPath[] = $responseName; |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | $promise = $this->getPromise($result); |
480 | 480 | if ($promise !== null) { |
481 | - return $promise->then(static function ($resolvedResult) use ($responseName, $results) { |
|
481 | + return $promise->then(static function($resolvedResult) use ($responseName, $results) { |
|
482 | 482 | $results[$responseName] = $resolvedResult; |
483 | 483 | |
484 | 484 | return $results; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | ); |
493 | 493 | |
494 | 494 | if ($this->isPromise($result)) { |
495 | - return $result->then(static function ($resolvedResults) { |
|
495 | + return $result->then(static function($resolvedResults) { |
|
496 | 496 | return self::fixResultsIfEmptyArray($resolvedResults); |
497 | 497 | }); |
498 | 498 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | try { |
617 | 617 | // Build a map of arguments from the field.arguments AST, using the |
618 | 618 | // variables scope to fulfill any variable references. |
619 | - $args = Values::getArgumentValues( |
|
619 | + $args = Values::getArgumentValues( |
|
620 | 620 | $fieldDef, |
621 | 621 | $fieldNode, |
622 | 622 | $this->exeContext->variableValues |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | try { |
652 | 652 | $promise = $this->getPromise($result); |
653 | 653 | if ($promise !== null) { |
654 | - $completed = $promise->then(function (&$resolved) use ($returnType, $fieldNodes, $info, $path) { |
|
654 | + $completed = $promise->then(function(&$resolved) use ($returnType, $fieldNodes, $info, $path) { |
|
655 | 655 | return $this->completeValue($returnType, $fieldNodes, $info, $path, $resolved); |
656 | 656 | }); |
657 | 657 | } else { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | |
661 | 661 | $promise = $this->getPromise($completed); |
662 | 662 | if ($promise !== null) { |
663 | - return $promise->then(null, function ($error) use ($fieldNodes, $path, $returnType) { |
|
663 | + return $promise->then(null, function($error) use ($fieldNodes, $path, $returnType) { |
|
664 | 664 | return $this->handleFieldError($error, $fieldNodes, $path, $returnType); |
665 | 665 | }); |
666 | 666 | } |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | } |
820 | 820 | if ($this->exeContext->promiseAdapter->isThenable($value)) { |
821 | 821 | $promise = $this->exeContext->promiseAdapter->convertThenable($value); |
822 | - if (! $promise instanceof Promise) { |
|
822 | + if (!$promise instanceof Promise) { |
|
823 | 823 | throw new InvariantViolation(sprintf( |
824 | 824 | '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s', |
825 | 825 | get_class($this->exeContext->promiseAdapter), |
@@ -849,10 +849,10 @@ discard block |
||
849 | 849 | { |
850 | 850 | return array_reduce( |
851 | 851 | $values, |
852 | - function ($previous, $value) use ($callback) { |
|
852 | + function($previous, $value) use ($callback) { |
|
853 | 853 | $promise = $this->getPromise($previous); |
854 | 854 | if ($promise !== null) { |
855 | - return $promise->then(static function ($resolved) use ($callback, $value) { |
|
855 | + return $promise->then(static function($resolved) use ($callback, $value) { |
|
856 | 856 | return $callback($resolved, $value); |
857 | 857 | }); |
858 | 858 | } |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | $fieldPath[] = $i++; |
890 | 890 | $info->path = $fieldPath; |
891 | 891 | $completedItem = $this->completeValueCatchingError($itemType, $fieldNodes, $info, $fieldPath, $item); |
892 | - if (! $containsPromise && $this->getPromise($completedItem) !== null) { |
|
892 | + if (!$containsPromise && $this->getPromise($completedItem) !== null) { |
|
893 | 893 | $containsPromise = true; |
894 | 894 | } |
895 | 895 | $completedItems[] = $completedItem; |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | } |
944 | 944 | $promise = $this->getPromise($runtimeType); |
945 | 945 | if ($promise !== null) { |
946 | - return $promise->then(function ($resolvedRuntimeType) use ( |
|
946 | + return $promise->then(function($resolvedRuntimeType) use ( |
|
947 | 947 | $returnType, |
948 | 948 | $fieldNodes, |
949 | 949 | $info, |
@@ -1034,9 +1034,9 @@ discard block |
||
1034 | 1034 | return $type; |
1035 | 1035 | } |
1036 | 1036 | } |
1037 | - if (! empty($promisedIsTypeOfResults)) { |
|
1037 | + if (!empty($promisedIsTypeOfResults)) { |
|
1038 | 1038 | return $this->exeContext->promiseAdapter->all($promisedIsTypeOfResults) |
1039 | - ->then(static function ($isTypeOfResults) use ($possibleTypes) { |
|
1039 | + ->then(static function($isTypeOfResults) use ($possibleTypes) { |
|
1040 | 1040 | foreach ($isTypeOfResults as $index => $result) { |
1041 | 1041 | if ($result) { |
1042 | 1042 | return $possibleTypes[$index]; |
@@ -1070,13 +1070,13 @@ discard block |
||
1070 | 1070 | if ($isTypeOf !== null) { |
1071 | 1071 | $promise = $this->getPromise($isTypeOf); |
1072 | 1072 | if ($promise !== null) { |
1073 | - return $promise->then(function ($isTypeOfResult) use ( |
|
1073 | + return $promise->then(function($isTypeOfResult) use ( |
|
1074 | 1074 | $returnType, |
1075 | 1075 | $fieldNodes, |
1076 | 1076 | $path, |
1077 | 1077 | &$result |
1078 | 1078 | ) { |
1079 | - if (! $isTypeOfResult) { |
|
1079 | + if (!$isTypeOfResult) { |
|
1080 | 1080 | throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); |
1081 | 1081 | } |
1082 | 1082 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | ); |
1089 | 1089 | }); |
1090 | 1090 | } |
1091 | - if (! $isTypeOf) { |
|
1091 | + if (!$isTypeOf) { |
|
1092 | 1092 | throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); |
1093 | 1093 | } |
1094 | 1094 | } |
@@ -1147,15 +1147,15 @@ discard block |
||
1147 | 1147 | */ |
1148 | 1148 | private function collectSubFields(ObjectType $returnType, $fieldNodes) : ArrayObject |
1149 | 1149 | { |
1150 | - if (! isset($this->subFieldCache[$returnType])) { |
|
1150 | + if (!isset($this->subFieldCache[$returnType])) { |
|
1151 | 1151 | $this->subFieldCache[$returnType] = new SplObjectStorage(); |
1152 | 1152 | } |
1153 | - if (! isset($this->subFieldCache[$returnType][$fieldNodes])) { |
|
1153 | + if (!isset($this->subFieldCache[$returnType][$fieldNodes])) { |
|
1154 | 1154 | // Collect sub-fields to execute to complete this value. |
1155 | 1155 | $subFieldNodes = new ArrayObject(); |
1156 | 1156 | $visitedFragmentNames = new ArrayObject(); |
1157 | 1157 | foreach ($fieldNodes as $fieldNode) { |
1158 | - if (! isset($fieldNode->selectionSet)) { |
|
1158 | + if (!isset($fieldNode->selectionSet)) { |
|
1159 | 1159 | continue; |
1160 | 1160 | } |
1161 | 1161 | $subFieldNodes = $this->collectFields( |
@@ -1192,13 +1192,13 @@ discard block |
||
1192 | 1192 | if ($result === self::$UNDEFINED) { |
1193 | 1193 | continue; |
1194 | 1194 | } |
1195 | - if (! $containsPromise && $this->isPromise($result)) { |
|
1195 | + if (!$containsPromise && $this->isPromise($result)) { |
|
1196 | 1196 | $containsPromise = true; |
1197 | 1197 | } |
1198 | 1198 | $results[$responseName] = $result; |
1199 | 1199 | } |
1200 | 1200 | // If there are no promises, we can just return the object |
1201 | - if (! $containsPromise) { |
|
1201 | + if (!$containsPromise) { |
|
1202 | 1202 | return self::fixResultsIfEmptyArray($results); |
1203 | 1203 | } |
1204 | 1204 | |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | $valuesAndPromises = array_values($assoc); |
1242 | 1242 | $promise = $this->exeContext->promiseAdapter->all($valuesAndPromises); |
1243 | 1243 | |
1244 | - return $promise->then(static function ($values) use ($keys) { |
|
1244 | + return $promise->then(static function($values) use ($keys) { |
|
1245 | 1245 | $resolvedResults = []; |
1246 | 1246 | foreach ($values as $i => $value) { |
1247 | 1247 | $resolvedResults[$keys[$i]] = $value; |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | $runtimeType = is_string($runtimeTypeOrName) |
1268 | 1268 | ? $this->exeContext->schema->getType($runtimeTypeOrName) |
1269 | 1269 | : $runtimeTypeOrName; |
1270 | - if (! $runtimeType instanceof ObjectType) { |
|
1270 | + if (!$runtimeType instanceof ObjectType) { |
|
1271 | 1271 | throw new InvariantViolation( |
1272 | 1272 | sprintf( |
1273 | 1273 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | ) |
1284 | 1284 | ); |
1285 | 1285 | } |
1286 | - if (! $this->exeContext->schema->isPossibleType($returnType, $runtimeType)) { |
|
1286 | + if (!$this->exeContext->schema->isPossibleType($returnType, $runtimeType)) { |
|
1287 | 1287 | throw new InvariantViolation( |
1288 | 1288 | sprintf('Runtime Object type "%s" is not a possible type for "%s".', $runtimeType, $returnType) |
1289 | 1289 | ); |