@@ -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 |
@@ -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) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (! empty($errors)) { |
|
| 111 | + if (!empty($errors)) { |
|
| 112 | 112 | return [$errors, null]; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
| 133 | 133 | $directiveNode = Utils::find( |
| 134 | 134 | $node->directives, |
| 135 | - static function (DirectiveNode $directive) use ($directiveDef) { |
|
| 135 | + static function(DirectiveNode $directive) use ($directiveDef) { |
|
| 136 | 136 | return $directive->name->value === $directiveDef->name; |
| 137 | 137 | } |
| 138 | 138 | ); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $argType = $argumentDefinition->getType(); |
| 197 | 197 | $argumentValueNode = $argumentValueMap[$name] ?? null; |
| 198 | 198 | |
| 199 | - if (! $argumentValueNode) { |
|
| 199 | + if (!$argumentValueNode) { |
|
| 200 | 200 | if ($argumentDefinition->defaultValueExists()) { |
| 201 | 201 | $coercedValues[$name] = $argumentDefinition->defaultValue; |
| 202 | 202 | } elseif ($argType instanceof NonNull) { |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | return $errors |
| 271 | 271 | ? array_map( |
| 272 | - static function (Throwable $error) { |
|
| 272 | + static function(Throwable $error) { |
|
| 273 | 273 | return $error->getMessage(); |
| 274 | 274 | }, |
| 275 | 275 | $errors |
@@ -495,7 +495,7 @@ |
||
| 495 | 495 | case 117: |
| 496 | 496 | $position = $this->position; |
| 497 | 497 | [$hex] = $this->readChars(4, true); |
| 498 | - if (! preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
| 498 | + if (!preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
| 499 | 499 | throw new SyntaxError( |
| 500 | 500 | $this->source, |
| 501 | 501 | $position - 1, |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $isEdited = $isLeaving && count($edits) !== 0; |
| 209 | 209 | |
| 210 | 210 | if ($isLeaving) { |
| 211 | - $key = ! $ancestors ? $UNDEFINED : $path[count($path) - 1]; |
|
| 211 | + $key = !$ancestors ? $UNDEFINED : $path[count($path) - 1]; |
|
| 212 | 212 | $node = $parent; |
| 213 | 213 | $parent = array_pop($ancestors); |
| 214 | 214 | |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $result = null; |
| 265 | - if (! $node instanceof NodeList && ! is_array($node)) { |
|
| 266 | - if (! ($node instanceof Node)) { |
|
| 265 | + if (!$node instanceof NodeList && !is_array($node)) { |
|
| 266 | + if (!($node instanceof Node)) { |
|
| 267 | 267 | throw new Exception('Invalid AST Node: ' . json_encode($node)); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if ($result->doBreak) { |
| 279 | 279 | break; |
| 280 | 280 | } |
| 281 | - if (! $isLeaving && $result->doContinue) { |
|
| 281 | + if (!$isLeaving && $result->doContinue) { |
|
| 282 | 282 | array_pop($path); |
| 283 | 283 | continue; |
| 284 | 284 | } |
@@ -290,8 +290,8 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | $edits[] = [$key, $editValue]; |
| 293 | - if (! $isLeaving) { |
|
| 294 | - if (! ($editValue instanceof Node)) { |
|
| 293 | + if (!$isLeaving) { |
|
| 294 | + if (!($editValue instanceof Node)) { |
|
| 295 | 295 | array_pop($path); |
| 296 | 296 | continue; |
| 297 | 297 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if ($isLeaving) { |
| 310 | 310 | array_pop($path); |
| 311 | 311 | } else { |
| 312 | - $stack = [ |
|
| 312 | + $stack = [ |
|
| 313 | 313 | 'inArray' => $inArray, |
| 314 | 314 | 'index' => $index, |
| 315 | 315 | 'keys' => $keys, |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | $skipping = new SplFixedArray($visitorsCount); |
| 392 | 392 | |
| 393 | 393 | return [ |
| 394 | - 'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
| 394 | + 'enter' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
| 395 | 395 | for ($i = 0; $i < $visitorsCount; $i++) { |
| 396 | - if (! empty($skipping[$i])) { |
|
| 396 | + if (!empty($skipping[$i])) { |
|
| 397 | 397 | continue; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | false |
| 404 | 404 | ); |
| 405 | 405 | |
| 406 | - if (! $fn) { |
|
| 406 | + if (!$fn) { |
|
| 407 | 407 | continue; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | }, |
| 425 | - 'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
| 425 | + 'leave' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
| 426 | 426 | for ($i = 0; $i < $visitorsCount; $i++) { |
| 427 | 427 | if (empty($skipping[$i])) { |
| 428 | 428 | $fn = self::getVisitFn( |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor) |
| 459 | 459 | { |
| 460 | 460 | return [ |
| 461 | - 'enter' => static function (Node $node) use ($typeInfo, $visitor) { |
|
| 461 | + 'enter' => static function(Node $node) use ($typeInfo, $visitor) { |
|
| 462 | 462 | $typeInfo->enter($node); |
| 463 | 463 | $fn = self::getVisitFn($visitor, $node->kind, false); |
| 464 | 464 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | return null; |
| 478 | 478 | }, |
| 479 | - 'leave' => static function (Node $node) use ($typeInfo, $visitor) { |
|
| 479 | + 'leave' => static function(Node $node) use ($typeInfo, $visitor) { |
|
| 480 | 480 | $fn = self::getVisitFn($visitor, $node->kind, true); |
| 481 | 481 | $result = $fn ? call_user_func_array($fn, func_get_args()) : null; |
| 482 | 482 | $typeInfo->leave($node); |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | $kindVisitor = $visitor[$kind] ?? null; |
| 503 | 503 | |
| 504 | - if (! $isLeaving && is_callable($kindVisitor)) { |
|
| 504 | + if (!$isLeaving && is_callable($kindVisitor)) { |
|
| 505 | 505 | // { Kind() {} } |
| 506 | 506 | return $kindVisitor; |
| 507 | 507 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public static function allRules() |
| 129 | 129 | { |
| 130 | - if (! self::$initRules) { |
|
| 130 | + if (!self::$initRules) { |
|
| 131 | 131 | static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); |
| 132 | 132 | static::$initRules = true; |
| 133 | 133 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | return is_array($value) |
| 269 | 269 | ? count(array_filter( |
| 270 | 270 | $value, |
| 271 | - static function ($item) { |
|
| 271 | + static function($item) { |
|
| 272 | 272 | return $item instanceof Exception || $item instanceof Throwable; |
| 273 | 273 | } |
| 274 | 274 | )) === count($value) |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | throw new Error( |
| 317 | 317 | implode( |
| 318 | 318 | "\n\n", |
| 319 | - array_map(static function (Error $error) : string { |
|
| 319 | + array_map(static function(Error $error) : string { |
|
| 320 | 320 | return $error->message; |
| 321 | 321 | }, $errors) |
| 322 | 322 | ) |