@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (is_callable($fields)) { |
91 | 91 | $fields = $fields(); |
92 | 92 | } |
93 | - if (! is_array($fields)) { |
|
93 | + if (!is_array($fields)) { |
|
94 | 94 | throw new InvariantViolation( |
95 | 95 | sprintf('%s fields must be an array or a callable which returns such an array.', $type->name) |
96 | 96 | ); |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $map = []; |
99 | 99 | foreach ($fields as $name => $field) { |
100 | 100 | if (is_array($field)) { |
101 | - if (! isset($field['name'])) { |
|
102 | - if (! is_string($name)) { |
|
101 | + if (!isset($field['name'])) { |
|
102 | + if (!is_string($name)) { |
|
103 | 103 | throw new InvariantViolation( |
104 | 104 | sprintf( |
105 | 105 | '%s fields must be an associative array with field names as keys or a function which returns such an array.', |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $field['name'] = $name; |
112 | 112 | } |
113 | - if (isset($field['args']) && ! is_array($field['args'])) { |
|
113 | + if (isset($field['args']) && !is_array($field['args'])) { |
|
114 | 114 | throw new InvariantViolation( |
115 | 115 | sprintf('%s.%s args must be an array.', $type->name, $name) |
116 | 116 | ); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } elseif ($field instanceof self) { |
120 | 120 | $fieldDef = $field; |
121 | 121 | } else { |
122 | - if (! is_string($name) || ! $field) { |
|
122 | + if (!is_string($name) || !$field) { |
|
123 | 123 | throw new InvariantViolation( |
124 | 124 | sprintf( |
125 | 125 | '%s.%s field config must be an array, but got: %s', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | throw new InvariantViolation(sprintf('%s.%s: %s', $parentType->name, $this->name, $e->getMessage())); |
208 | 208 | } |
209 | 209 | Utils::invariant( |
210 | - ! isset($this->config['isDeprecated']), |
|
210 | + !isset($this->config['isDeprecated']), |
|
211 | 211 | sprintf( |
212 | 212 | '%s.%s should provide "deprecationReason" instead of "isDeprecated".', |
213 | 213 | $parentType->name, |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct(array $config) |
32 | 32 | { |
33 | - if (! isset($config['name'])) { |
|
33 | + if (!isset($config['name'])) { |
|
34 | 34 | $config['name'] = $this->tryInferName(); |
35 | 35 | } |
36 | 36 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $fields = $this->config['fields'] ?? []; |
68 | 68 | $fields = is_callable($fields) ? call_user_func($fields) : $fields; |
69 | 69 | |
70 | - if (! is_array($fields)) { |
|
70 | + if (!is_array($fields)) { |
|
71 | 71 | throw new InvariantViolation( |
72 | 72 | sprintf('%s fields must be an array or a callable which returns such an array.', $this->name) |
73 | 73 | ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | parent::assertValid(); |
97 | 97 | |
98 | 98 | Utils::invariant( |
99 | - ! empty($this->getFields()), |
|
99 | + !empty($this->getFields()), |
|
100 | 100 | sprintf( |
101 | 101 | '%s fields must be an associative array with field names as keys or a callable which returns such an array.', |
102 | 102 | $this->name |
@@ -25,7 +25,7 @@ |
||
25 | 25 | public static function runQueue() |
26 | 26 | { |
27 | 27 | $q = self::$queue; |
28 | - while ($q && ! $q->isEmpty()) { |
|
28 | + while ($q && !$q->isEmpty()) { |
|
29 | 29 | /** @var self $dfd */ |
30 | 30 | $dfd = $q->dequeue(); |
31 | 31 | $dfd->run(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | private function __construct(ExecutionContext $context) |
64 | 64 | { |
65 | - if (! self::$UNDEFINED) { |
|
65 | + if (!self::$UNDEFINED) { |
|
66 | 66 | self::$UNDEFINED = Utils::undefined(); |
67 | 67 | } |
68 | 68 | $this->exeContext = $context; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | foreach ($documentNode->definitions as $definition) { |
141 | 141 | switch ($definition->kind) { |
142 | 142 | case NodeKind::OPERATION_DEFINITION: |
143 | - if (! $operationName && $operation) { |
|
143 | + if (!$operationName && $operation) { |
|
144 | 144 | $hasMultipleAssumedOperations = true; |
145 | 145 | } |
146 | - if (! $operationName || |
|
146 | + if (!$operationName || |
|
147 | 147 | (isset($definition->name) && $definition->name->value === $operationName)) { |
148 | 148 | $operation = $definition; |
149 | 149 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $errors = array_merge($errors, $coercionErrors); |
178 | 178 | } |
179 | 179 | } |
180 | - if (! empty($errors)) { |
|
180 | + if (!empty($errors)) { |
|
181 | 181 | return $errors; |
182 | 182 | } |
183 | 183 | Utils::invariant($operation, 'Has operation if no errors.'); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function buildResponse($data) |
222 | 222 | { |
223 | 223 | if ($this->isPromise($data)) { |
224 | - return $data->then(function ($resolved) { |
|
224 | + return $data->then(function($resolved) { |
|
225 | 225 | return $this->buildResponse($resolved); |
226 | 226 | }); |
227 | 227 | } |
@@ -250,12 +250,11 @@ discard block |
||
250 | 250 | // Similar to completeValueCatchingError. |
251 | 251 | try { |
252 | 252 | $result = $operation->operation === 'mutation' ? |
253 | - $this->executeFieldsSerially($type, $rootValue, $path, $fields) : |
|
254 | - $this->executeFields($type, $rootValue, $path, $fields); |
|
253 | + $this->executeFieldsSerially($type, $rootValue, $path, $fields) : $this->executeFields($type, $rootValue, $path, $fields); |
|
255 | 254 | if ($this->isPromise($result)) { |
256 | 255 | return $result->then( |
257 | 256 | null, |
258 | - function ($error) { |
|
257 | + function($error) { |
|
259 | 258 | $this->exeContext->addError($error); |
260 | 259 | return $this->exeContext->promises->createFulfilled(null); |
261 | 260 | } |
@@ -280,7 +279,7 @@ discard block |
||
280 | 279 | switch ($operation->operation) { |
281 | 280 | case 'query': |
282 | 281 | $queryType = $schema->getQueryType(); |
283 | - if (! $queryType) { |
|
282 | + if (!$queryType) { |
|
284 | 283 | throw new Error( |
285 | 284 | 'Schema does not define the required query root type.', |
286 | 285 | [$operation] |
@@ -289,7 +288,7 @@ discard block |
||
289 | 288 | return $queryType; |
290 | 289 | case 'mutation': |
291 | 290 | $mutationType = $schema->getMutationType(); |
292 | - if (! $mutationType) { |
|
291 | + if (!$mutationType) { |
|
293 | 292 | throw new Error( |
294 | 293 | 'Schema is not configured for mutations.', |
295 | 294 | [$operation] |
@@ -298,7 +297,7 @@ discard block |
||
298 | 297 | return $mutationType; |
299 | 298 | case 'subscription': |
300 | 299 | $subscriptionType = $schema->getSubscriptionType(); |
301 | - if (! $subscriptionType) { |
|
300 | + if (!$subscriptionType) { |
|
302 | 301 | throw new Error( |
303 | 302 | 'Schema is not configured for subscriptions.', |
304 | 303 | [$operation] |
@@ -336,18 +335,18 @@ discard block |
||
336 | 335 | foreach ($selectionSet->selections as $selection) { |
337 | 336 | switch ($selection->kind) { |
338 | 337 | case NodeKind::FIELD: |
339 | - if (! $this->shouldIncludeNode($selection)) { |
|
338 | + if (!$this->shouldIncludeNode($selection)) { |
|
340 | 339 | break; |
341 | 340 | } |
342 | 341 | $name = self::getFieldEntryKey($selection); |
343 | - if (! isset($fields[$name])) { |
|
342 | + if (!isset($fields[$name])) { |
|
344 | 343 | $fields[$name] = new ArrayObject(); |
345 | 344 | } |
346 | 345 | $fields[$name][] = $selection; |
347 | 346 | break; |
348 | 347 | case NodeKind::INLINE_FRAGMENT: |
349 | - if (! $this->shouldIncludeNode($selection) || |
|
350 | - ! $this->doesFragmentConditionMatch($selection, $runtimeType) |
|
348 | + if (!$this->shouldIncludeNode($selection) || |
|
349 | + !$this->doesFragmentConditionMatch($selection, $runtimeType) |
|
351 | 350 | ) { |
352 | 351 | break; |
353 | 352 | } |
@@ -360,13 +359,13 @@ discard block |
||
360 | 359 | break; |
361 | 360 | case NodeKind::FRAGMENT_SPREAD: |
362 | 361 | $fragName = $selection->name->value; |
363 | - if (! empty($visitedFragmentNames[$fragName]) || ! $this->shouldIncludeNode($selection)) { |
|
362 | + if (!empty($visitedFragmentNames[$fragName]) || !$this->shouldIncludeNode($selection)) { |
|
364 | 363 | break; |
365 | 364 | } |
366 | 365 | $visitedFragmentNames[$fragName] = true; |
367 | 366 | /** @var FragmentDefinitionNode|null $fragment */ |
368 | 367 | $fragment = $exeContext->fragments[$fragName] ?? null; |
369 | - if (! $fragment || ! $this->doesFragmentConditionMatch($fragment, $runtimeType)) { |
|
368 | + if (!$fragment || !$this->doesFragmentConditionMatch($fragment, $runtimeType)) { |
|
370 | 369 | break; |
371 | 370 | } |
372 | 371 | $this->collectFields( |
@@ -462,7 +461,7 @@ discard block |
||
462 | 461 | { |
463 | 462 | $result = $this->promiseReduce( |
464 | 463 | array_keys($fields->getArrayCopy()), |
465 | - function ($results, $responseName) use ($path, $parentType, $sourceValue, $fields) { |
|
464 | + function($results, $responseName) use ($path, $parentType, $sourceValue, $fields) { |
|
466 | 465 | $fieldNodes = $fields[$responseName]; |
467 | 466 | $fieldPath = $path; |
468 | 467 | $fieldPath[] = $responseName; |
@@ -472,7 +471,7 @@ discard block |
||
472 | 471 | } |
473 | 472 | $promise = $this->getPromise($result); |
474 | 473 | if ($promise) { |
475 | - return $promise->then(static function ($resolvedResult) use ($responseName, $results) { |
|
474 | + return $promise->then(static function($resolvedResult) use ($responseName, $results) { |
|
476 | 475 | $results[$responseName] = $resolvedResult; |
477 | 476 | return $results; |
478 | 477 | }); |
@@ -483,7 +482,7 @@ discard block |
||
483 | 482 | [] |
484 | 483 | ); |
485 | 484 | if ($this->isPromise($result)) { |
486 | - return $result->then(static function ($resolvedResults) { |
|
485 | + return $result->then(static function($resolvedResults) { |
|
487 | 486 | return self::fixResultsIfEmptyArray($resolvedResults); |
488 | 487 | }); |
489 | 488 | } |
@@ -508,7 +507,7 @@ discard block |
||
508 | 507 | $fieldNode = $fieldNodes[0]; |
509 | 508 | $fieldName = $fieldNode->name->value; |
510 | 509 | $fieldDef = $this->getFieldDef($exeContext->schema, $parentType, $fieldName); |
511 | - if (! $fieldDef) { |
|
510 | + if (!$fieldDef) { |
|
512 | 511 | return self::$UNDEFINED; |
513 | 512 | } |
514 | 513 | $returnType = $fieldDef->getType(); |
@@ -657,11 +656,11 @@ discard block |
||
657 | 656 | $path, |
658 | 657 | $result |
659 | 658 | ); |
660 | - $promise = $this->getPromise($completed); |
|
659 | + $promise = $this->getPromise($completed); |
|
661 | 660 | if ($promise) { |
662 | 661 | return $promise->then( |
663 | 662 | null, |
664 | - function ($error) use ($exeContext) { |
|
663 | + function($error) use ($exeContext) { |
|
665 | 664 | $exeContext->addError($error); |
666 | 665 | return $this->exeContext->promises->createFulfilled(null); |
667 | 666 | } |
@@ -703,11 +702,11 @@ discard block |
||
703 | 702 | $path, |
704 | 703 | $result |
705 | 704 | ); |
706 | - $promise = $this->getPromise($completed); |
|
705 | + $promise = $this->getPromise($completed); |
|
707 | 706 | if ($promise) { |
708 | 707 | return $promise->then( |
709 | 708 | null, |
710 | - function ($error) use ($fieldNodes, $path) { |
|
709 | + function($error) use ($fieldNodes, $path) { |
|
711 | 710 | return $this->exeContext->promises->createRejected(Error::createLocatedError( |
712 | 711 | $error, |
713 | 712 | $fieldNodes, |
@@ -764,7 +763,7 @@ discard block |
||
764 | 763 | $promise = $this->getPromise($result); |
765 | 764 | // If result is a Promise, apply-lift over completeValue. |
766 | 765 | if ($promise) { |
767 | - return $promise->then(function (&$resolved) use ($returnType, $fieldNodes, $info, $path) { |
|
766 | + return $promise->then(function(&$resolved) use ($returnType, $fieldNodes, $info, $path) { |
|
768 | 767 | return $this->completeValue($returnType, $fieldNodes, $info, $path, $resolved); |
769 | 768 | }); |
770 | 769 | } |
@@ -856,7 +855,7 @@ discard block |
||
856 | 855 | } |
857 | 856 | if ($this->exeContext->promises->isThenable($value)) { |
858 | 857 | $promise = $this->exeContext->promises->convertThenable($value); |
859 | - if (! $promise instanceof Promise) { |
|
858 | + if (!$promise instanceof Promise) { |
|
860 | 859 | throw new InvariantViolation(sprintf( |
861 | 860 | '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s', |
862 | 861 | get_class($this->exeContext->promises), |
@@ -884,10 +883,10 @@ discard block |
||
884 | 883 | { |
885 | 884 | return array_reduce( |
886 | 885 | $values, |
887 | - function ($previous, $value) use ($callback) { |
|
886 | + function($previous, $value) use ($callback) { |
|
888 | 887 | $promise = $this->getPromise($previous); |
889 | 888 | if ($promise) { |
890 | - return $promise->then(static function ($resolved) use ($callback, $value) { |
|
889 | + return $promise->then(static function($resolved) use ($callback, $value) { |
|
891 | 890 | return $callback($resolved, $value); |
892 | 891 | }); |
893 | 892 | } |
@@ -923,7 +922,7 @@ discard block |
||
923 | 922 | $fieldPath = $path; |
924 | 923 | $fieldPath[] = $i++; |
925 | 924 | $completedItem = $this->completeValueCatchingError($itemType, $fieldNodes, $info, $fieldPath, $item); |
926 | - if (! $containsPromise && $this->getPromise($completedItem)) { |
|
925 | + if (!$containsPromise && $this->getPromise($completedItem)) { |
|
927 | 926 | $containsPromise = true; |
928 | 927 | } |
929 | 928 | $completedItems[] = $completedItem; |
@@ -980,7 +979,7 @@ discard block |
||
980 | 979 | } |
981 | 980 | $promise = $this->getPromise($runtimeType); |
982 | 981 | if ($promise) { |
983 | - return $promise->then(function ($resolvedRuntimeType) use ( |
|
982 | + return $promise->then(function($resolvedRuntimeType) use ( |
|
984 | 983 | $returnType, |
985 | 984 | $fieldNodes, |
986 | 985 | $info, |
@@ -1068,9 +1067,9 @@ discard block |
||
1068 | 1067 | return $type; |
1069 | 1068 | } |
1070 | 1069 | } |
1071 | - if (! empty($promisedIsTypeOfResults)) { |
|
1070 | + if (!empty($promisedIsTypeOfResults)) { |
|
1072 | 1071 | return $this->exeContext->promises->all($promisedIsTypeOfResults) |
1073 | - ->then(static function ($isTypeOfResults) use ($possibleTypes) { |
|
1072 | + ->then(static function($isTypeOfResults) use ($possibleTypes) { |
|
1074 | 1073 | foreach ($isTypeOfResults as $index => $result) { |
1075 | 1074 | if ($result) { |
1076 | 1075 | return $possibleTypes[$index]; |
@@ -1102,13 +1101,13 @@ discard block |
||
1102 | 1101 | if ($isTypeOf !== null) { |
1103 | 1102 | $promise = $this->getPromise($isTypeOf); |
1104 | 1103 | if ($promise) { |
1105 | - return $promise->then(function ($isTypeOfResult) use ( |
|
1104 | + return $promise->then(function($isTypeOfResult) use ( |
|
1106 | 1105 | $returnType, |
1107 | 1106 | $fieldNodes, |
1108 | 1107 | $path, |
1109 | 1108 | &$result |
1110 | 1109 | ) { |
1111 | - if (! $isTypeOfResult) { |
|
1110 | + if (!$isTypeOfResult) { |
|
1112 | 1111 | throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); |
1113 | 1112 | } |
1114 | 1113 | return $this->collectAndExecuteSubfields( |
@@ -1119,7 +1118,7 @@ discard block |
||
1119 | 1118 | ); |
1120 | 1119 | }); |
1121 | 1120 | } |
1122 | - if (! $isTypeOf) { |
|
1121 | + if (!$isTypeOf) { |
|
1123 | 1122 | throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); |
1124 | 1123 | } |
1125 | 1124 | } |
@@ -1169,15 +1168,15 @@ discard block |
||
1169 | 1168 | |
1170 | 1169 | private function collectSubFields(ObjectType $returnType, $fieldNodes) : ArrayObject |
1171 | 1170 | { |
1172 | - if (! isset($this->subFieldCache[$returnType])) { |
|
1171 | + if (!isset($this->subFieldCache[$returnType])) { |
|
1173 | 1172 | $this->subFieldCache[$returnType] = new SplObjectStorage(); |
1174 | 1173 | } |
1175 | - if (! isset($this->subFieldCache[$returnType][$fieldNodes])) { |
|
1174 | + if (!isset($this->subFieldCache[$returnType][$fieldNodes])) { |
|
1176 | 1175 | // Collect sub-fields to execute to complete this value. |
1177 | 1176 | $subFieldNodes = new ArrayObject(); |
1178 | 1177 | $visitedFragmentNames = new ArrayObject(); |
1179 | 1178 | foreach ($fieldNodes as $fieldNode) { |
1180 | - if (! isset($fieldNode->selectionSet)) { |
|
1179 | + if (!isset($fieldNode->selectionSet)) { |
|
1181 | 1180 | continue; |
1182 | 1181 | } |
1183 | 1182 | $subFieldNodes = $this->collectFields( |
@@ -1213,13 +1212,13 @@ discard block |
||
1213 | 1212 | if ($result === self::$UNDEFINED) { |
1214 | 1213 | continue; |
1215 | 1214 | } |
1216 | - if (! $containsPromise && $this->getPromise($result)) { |
|
1215 | + if (!$containsPromise && $this->getPromise($result)) { |
|
1217 | 1216 | $containsPromise = true; |
1218 | 1217 | } |
1219 | 1218 | $finalResults[$responseName] = $result; |
1220 | 1219 | } |
1221 | 1220 | // If there are no promises, we can just return the object |
1222 | - if (! $containsPromise) { |
|
1221 | + if (!$containsPromise) { |
|
1223 | 1222 | return self::fixResultsIfEmptyArray($finalResults); |
1224 | 1223 | } |
1225 | 1224 | // Otherwise, results is a map from field name to the result |
@@ -1260,7 +1259,7 @@ discard block |
||
1260 | 1259 | $keys = array_keys($assoc); |
1261 | 1260 | $valuesAndPromises = array_values($assoc); |
1262 | 1261 | $promise = $this->exeContext->promises->all($valuesAndPromises); |
1263 | - return $promise->then(static function ($values) use ($keys) { |
|
1262 | + return $promise->then(static function($values) use ($keys) { |
|
1264 | 1263 | $resolvedResults = []; |
1265 | 1264 | foreach ($values as $i => $value) { |
1266 | 1265 | $resolvedResults[$keys[$i]] = $value; |
@@ -1283,9 +1282,8 @@ discard block |
||
1283 | 1282 | &$result |
1284 | 1283 | ) { |
1285 | 1284 | $runtimeType = is_string($runtimeTypeOrName) ? |
1286 | - $this->exeContext->schema->getType($runtimeTypeOrName) : |
|
1287 | - $runtimeTypeOrName; |
|
1288 | - if (! $runtimeType instanceof ObjectType) { |
|
1285 | + $this->exeContext->schema->getType($runtimeTypeOrName) : $runtimeTypeOrName; |
|
1286 | + if (!$runtimeType instanceof ObjectType) { |
|
1289 | 1287 | throw new InvariantViolation( |
1290 | 1288 | sprintf( |
1291 | 1289 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -1301,7 +1299,7 @@ discard block |
||
1301 | 1299 | ) |
1302 | 1300 | ); |
1303 | 1301 | } |
1304 | - if (! $this->exeContext->schema->isPossibleType($returnType, $runtimeType)) { |
|
1302 | + if (!$this->exeContext->schema->isPossibleType($returnType, $runtimeType)) { |
|
1305 | 1303 | throw new InvariantViolation( |
1306 | 1304 | sprintf('Runtime Object type "%s" is not a possible type for "%s".', $runtimeType, $returnType) |
1307 | 1305 | ); |
@@ -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'] = (array) $this->extensions; |
158 | 158 | } |
159 | 159 |
@@ -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; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public static function runQueue() |
44 | 44 | { |
45 | 45 | $q = self::$queue; |
46 | - while ($q && ! $q->isEmpty()) { |
|
46 | + while ($q && !$q->isEmpty()) { |
|
47 | 47 | $task = $q->dequeue(); |
48 | 48 | $task(); |
49 | 49 | } |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | } |
59 | 59 | if (is_object($value) && method_exists($value, 'then')) { |
60 | 60 | $value->then( |
61 | - function ($resolvedValue) { |
|
61 | + function($resolvedValue) { |
|
62 | 62 | $this->resolve($resolvedValue); |
63 | 63 | }, |
64 | - function ($reason) { |
|
64 | + function($reason) { |
|
65 | 65 | $this->reject($reason); |
66 | 66 | } |
67 | 67 | ); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function reject($reason) |
89 | 89 | { |
90 | - if (! $reason instanceof Exception && ! $reason instanceof Throwable) { |
|
90 | + if (!$reason instanceof Exception && !$reason instanceof Throwable) { |
|
91 | 91 | throw new Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); |
92 | 92 | } |
93 | 93 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ); |
118 | 118 | |
119 | 119 | foreach ($this->waiting as $descriptor) { |
120 | - self::getQueue()->enqueue(function () use ($descriptor) { |
|
120 | + self::getQueue()->enqueue(function() use ($descriptor) { |
|
121 | 121 | /** @var $promise self */ |
122 | 122 | [$promise, $onFulfilled, $onRejected] = $descriptor; |
123 | 123 | |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | |
155 | 155 | public function then(?callable $onFulfilled = null, ?callable $onRejected = null) |
156 | 156 | { |
157 | - if ($this->state === self::REJECTED && ! $onRejected) { |
|
157 | + if ($this->state === self::REJECTED && !$onRejected) { |
|
158 | 158 | return $this; |
159 | 159 | } |
160 | - if ($this->state === self::FULFILLED && ! $onFulfilled) { |
|
160 | + if ($this->state === self::FULFILLED && !$onFulfilled) { |
|
161 | 161 | return $this; |
162 | 162 | } |
163 | 163 | $tmp = new self(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function convertThenable($thenable) |
35 | 35 | { |
36 | - if (! $thenable instanceof Deferred) { |
|
36 | + if (!$thenable instanceof Deferred) { |
|
37 | 37 | throw new InvariantViolation('Expected instance of GraphQL\Deferred, got ' . Utils::printSafe($thenable)); |
38 | 38 | } |
39 | 39 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | if ($promiseOrValue instanceof Promise) { |
114 | 114 | $result[$index] = null; |
115 | 115 | $promiseOrValue->then( |
116 | - static function ($value) use ($index, &$count, $total, &$result, $all) { |
|
116 | + static function($value) use ($index, &$count, $total, &$result, $all) { |
|
117 | 117 | $result[$index] = $value; |
118 | 118 | $count++; |
119 | 119 | if ($count < $total) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $promiseQueue = SyncPromise::getQueue(); |
149 | 149 | |
150 | 150 | while ($promise->adoptedPromise->state === SyncPromise::PENDING && |
151 | - ! ($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
151 | + !($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
152 | 152 | ) { |
153 | 153 | Deferred::runQueue(); |
154 | 154 | SyncPromise::runQueue(); |
@@ -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) { |