@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $queryComplexity->setRawVariableValues($variableValues); |
139 | 139 | } else { |
140 | 140 | foreach ($validationRules as $rule) { |
141 | - if (! ($rule instanceof QueryComplexity)) { |
|
141 | + if (!($rule instanceof QueryComplexity)) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $validationErrors = DocumentValidator::validate($schema, $documentNode, $validationRules); |
150 | 150 | |
151 | - if (! empty($validationErrors)) { |
|
151 | + if (!empty($validationErrors)) { |
|
152 | 152 | return $promiseAdapter->createFulfilled( |
153 | 153 | new ExecutionResult(null, $validationErrors) |
154 | 154 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ($promiseAdapter instanceof SyncPromiseAdapter) { |
209 | 209 | $result = $promiseAdapter->wait($result)->toArray(); |
210 | 210 | } else { |
211 | - $result = $result->then(static function (ExecutionResult $r) { |
|
211 | + $result = $result->then(static function(ExecutionResult $r) { |
|
212 | 212 | return $r->toArray(); |
213 | 213 | }); |
214 | 214 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $this->collector = new Collector($this->schema, $this); |
173 | 173 | $this->collector->initialize($this->documentNode, $this->operationName); |
174 | 174 | |
175 | - if (! empty($this->errors)) { |
|
175 | + if (!empty($this->errors)) { |
|
176 | 176 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $this->errors)); |
177 | 177 | } |
178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $this->rawVariableValues ?: [] |
183 | 183 | ); |
184 | 184 | |
185 | - if (! empty($errors)) { |
|
185 | + if (!empty($errors)) { |
|
186 | 186 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $errors)); |
187 | 187 | } |
188 | 188 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | ); |
204 | 204 | |
205 | 205 | $fieldDefinition = $this->findFieldDefinition($ctx); |
206 | - if (! $fieldDefinition->getType() instanceof NonNull) { |
|
206 | + if (!$fieldDefinition->getType() instanceof NonNull) { |
|
207 | 207 | $ctx->nullFence = [$shared->resultName]; |
208 | 208 | } |
209 | 209 | |
210 | - if ($this->collector->operation->operation === 'mutation' && ! $this->queue->isEmpty()) { |
|
210 | + if ($this->collector->operation->operation === 'mutation' && !$this->queue->isEmpty()) { |
|
211 | 211 | $this->schedule->enqueue($ctx); |
212 | 212 | } else { |
213 | 213 | $this->queue->enqueue(new Strand($this->spawn($ctx))); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->run(); |
218 | 218 | |
219 | 219 | if ($this->pending > 0) { |
220 | - return $this->promiseAdapter->create(function (callable $resolve) { |
|
220 | + return $this->promiseAdapter->create(function(callable $resolve) { |
|
221 | 221 | $this->doResolve = $resolve; |
222 | 222 | }); |
223 | 223 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function run() |
266 | 266 | { |
267 | 267 | RUN: |
268 | - while (! $this->queue->isEmpty()) { |
|
268 | + while (!$this->queue->isEmpty()) { |
|
269 | 269 | /** @var Strand $strand */ |
270 | 270 | $strand = $this->queue->dequeue(); |
271 | 271 | |
@@ -298,13 +298,13 @@ discard block |
||
298 | 298 | $this->promiseAdapter |
299 | 299 | ->convertThenable($value) |
300 | 300 | ->then( |
301 | - function ($value) use ($strand) { |
|
301 | + function($value) use ($strand) { |
|
302 | 302 | $strand->success = true; |
303 | 303 | $strand->value = $value; |
304 | 304 | $this->queue->enqueue($strand); |
305 | 305 | $this->done(); |
306 | 306 | }, |
307 | - function (Throwable $throwable) use ($strand) { |
|
307 | + function(Throwable $throwable) use ($strand) { |
|
308 | 308 | $strand->success = false; |
309 | 309 | $strand->value = $throwable; |
310 | 310 | $this->queue->enqueue($strand); |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | |
417 | 417 | $value = $resolve($ctx->value, $arguments, $this->contextValue, $ctx->resolveInfo); |
418 | 418 | |
419 | - if (! $this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
419 | + if (!$this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
420 | 420 | $returnValue = yield $this->completeValue( |
421 | 421 | $ctx, |
422 | 422 | $returnType, |
@@ -438,12 +438,12 @@ discard block |
||
438 | 438 | if ($returnValue !== self::$undefined) { |
439 | 439 | $ctx->result->{$ctx->shared->resultName} = $returnValue; |
440 | 440 | } elseif ($ctx->resolveInfo !== null && $ctx->resolveInfo->returnType instanceof NonNull) { // !!! $ctx->resolveInfo might not have been initialized yet |
441 | - $result =& $this->rootResult; |
|
441 | + $result = & $this->rootResult; |
|
442 | 442 | foreach ($ctx->nullFence ?? [] as $key) { |
443 | 443 | if (is_string($key)) { |
444 | - $result =& $result->{$key}; |
|
444 | + $result = & $result->{$key}; |
|
445 | 445 | } else { |
446 | - $result =& $result[$key]; |
|
446 | + $result = & $result[$key]; |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | $result = null; |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $type = $type->getWrappedType(); |
486 | 486 | } |
487 | 487 | |
488 | - if (! $type instanceof LeafType) { |
|
488 | + if (!$type instanceof LeafType) { |
|
489 | 489 | return false; |
490 | 490 | } |
491 | 491 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $itemPath[] = $index; // !!! use arrays COW semantics |
618 | 618 | |
619 | 619 | try { |
620 | - if (! $this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
620 | + if (!$this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
621 | 621 | $itemReturnValue = yield $this->completeValue($ctx, $itemType, $itemValue, $itemPath, $nullFence); |
622 | 622 | } |
623 | 623 | } catch (Throwable $reason) { |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | |
709 | 709 | $returnValue = self::$undefined; |
710 | 710 | goto CHECKED_RETURN; |
711 | - } elseif (! $objectType instanceof ObjectType) { |
|
711 | + } elseif (!$objectType instanceof ObjectType) { |
|
712 | 712 | $this->addError(Error::createLocatedError( |
713 | 713 | new InvariantViolation(sprintf( |
714 | 714 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | |
729 | 729 | $returnValue = null; |
730 | 730 | goto CHECKED_RETURN; |
731 | - } elseif (! $this->schema->isPossibleType($type, $objectType)) { |
|
731 | + } elseif (!$this->schema->isPossibleType($type, $objectType)) { |
|
732 | 732 | $this->addError(Error::createLocatedError( |
733 | 733 | new InvariantViolation(sprintf( |
734 | 734 | 'Runtime Object type "%s" is not a possible type for "%s".', |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | if ($typeCheck !== null) { |
781 | 781 | // !!! $objectType->isTypeOf() might return promise, yield to resolve |
782 | 782 | $typeCheck = yield $typeCheck; |
783 | - if (! $typeCheck) { |
|
783 | + if (!$typeCheck) { |
|
784 | 784 | $this->addError(Error::createLocatedError( |
785 | 785 | sprintf('Expected value of type "%s" but got: %s.', $type->name, Utils::printSafe($value)), |
786 | 786 | $ctx->shared->fieldNodes, |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | public static function assign($obj, array $vars, array $requiredKeys = []) |
85 | 85 | { |
86 | 86 | foreach ($requiredKeys as $key) { |
87 | - if (! isset($vars[$key])) { |
|
87 | + if (!isset($vars[$key])) { |
|
88 | 88 | throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key)); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | foreach ($vars as $key => $value) { |
93 | - if (! property_exists($obj, $key)) { |
|
93 | + if (!property_exists($obj, $key)) { |
|
94 | 94 | $cls = get_class($obj); |
95 | 95 | Warning::warn( |
96 | 96 | sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls), |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | $result = []; |
142 | 142 | $assoc = false; |
143 | 143 | foreach ($traversable as $key => $value) { |
144 | - if (! $assoc && ! is_int($key)) { |
|
144 | + if (!$assoc && !is_int($key)) { |
|
145 | 145 | $assoc = true; |
146 | 146 | } |
147 | - if (! $predicate($value, $key)) { |
|
147 | + if (!$predicate($value, $key)) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $map = []; |
217 | 217 | foreach ($traversable as $key => $value) { |
218 | 218 | $newKey = $keyFn($value, $key); |
219 | - if (! is_scalar($newKey)) { |
|
219 | + if (!is_scalar($newKey)) { |
|
220 | 220 | continue; |
221 | 221 | } |
222 | 222 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | public static function every($traversable, callable $predicate) |
296 | 296 | { |
297 | 297 | foreach ($traversable as $key => $value) { |
298 | - if (! $predicate($value, $key)) { |
|
298 | + if (!$predicate($value, $key)) { |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public static function invariant($test, $message = '') |
311 | 311 | { |
312 | - if (! $test) { |
|
312 | + if (!$test) { |
|
313 | 313 | if (func_num_args() > 2) { |
314 | 314 | $args = func_get_args(); |
315 | 315 | array_shift($args); |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | */ |
447 | 447 | public static function ord($char, $encoding = 'UTF-8') |
448 | 448 | { |
449 | - if (! $char && $char !== '0') { |
|
449 | + if (!$char && $char !== '0') { |
|
450 | 450 | return 0; |
451 | 451 | } |
452 | - if (! isset($char[1])) { |
|
452 | + if (!isset($char[1])) { |
|
453 | 453 | return ord($char); |
454 | 454 | } |
455 | 455 | if ($encoding !== 'UCS-4BE') { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | ); |
528 | 528 | } |
529 | 529 | |
530 | - if (! preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
530 | + if (!preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
531 | 531 | return new Error( |
532 | 532 | sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name), |
533 | 533 | $node |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | */ |
548 | 548 | public static function withErrorHandling(callable $fn, array &$errors) |
549 | 549 | { |
550 | - return static function () use ($fn, &$errors) { |
|
550 | + return static function() use ($fn, &$errors) { |
|
551 | 551 | // Catch custom errors (to report them in query results) |
552 | - set_error_handler(static function ($severity, $message, $file, $line) use (&$errors) { |
|
552 | + set_error_handler(static function($severity, $message, $file, $line) use (&$errors) { |
|
553 | 553 | $errors[] = new ErrorException($message, 0, $severity, $file, $line); |
554 | 554 | }); |
555 | 555 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | public static function quotedOrList(array $items) |
570 | 570 | { |
571 | 571 | $items = array_map( |
572 | - static function ($item) { |
|
572 | + static function($item) { |
|
573 | 573 | return sprintf('"%s"', $item); |
574 | 574 | }, |
575 | 575 | $items |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | return array_reduce( |
600 | 600 | range(1, $selectedLength - 1), |
601 | - static function ($list, $index) use ($selected, $selectedLength) { |
|
601 | + static function($list, $index) use ($selected, $selectedLength) { |
|
602 | 602 | return $list . |
603 | 603 | ($selectedLength > 2 ? ', ' : ' ') . |
604 | 604 | ($index === $selectedLength - 1 ? 'or ' : '') . |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public static function fromArray(array $node) : Node |
90 | 90 | { |
91 | - if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) { |
|
91 | + if (!isset($node['kind']) || !isset(NodeKind::$classMap[$node['kind']])) { |
|
92 | 92 | throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node)); |
93 | 93 | } |
94 | 94 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $valuesNodes = []; |
177 | 177 | foreach ($value as $item) { |
178 | 178 | $itemNode = self::astFromValue($item, $itemType); |
179 | - if (! $itemNode) { |
|
179 | + if (!$itemNode) { |
|
180 | 180 | continue; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($type instanceof InputObjectType) { |
195 | 195 | $isArray = is_array($value); |
196 | 196 | $isArrayLike = $isArray || $value instanceof ArrayAccess; |
197 | - if ($value === null || (! $isArrayLike && ! is_object($value))) { |
|
197 | + if ($value === null || (!$isArrayLike && !is_object($value))) { |
|
198 | 198 | return null; |
199 | 199 | } |
200 | 200 | $fields = $type->getFields(); |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | $fieldExists = property_exists($value, $fieldName); |
220 | 220 | } |
221 | 221 | |
222 | - if (! $fieldExists) { |
|
222 | + if (!$fieldExists) { |
|
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $fieldNode = self::astFromValue($fieldValue, $field->getType()); |
227 | 227 | |
228 | - if (! $fieldNode) { |
|
228 | + if (!$fieldNode) { |
|
229 | 229 | continue; |
230 | 230 | } |
231 | 231 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | if ($valueNode instanceof VariableNode) { |
350 | 350 | $variableName = $valueNode->name->value; |
351 | 351 | |
352 | - if (! $variables || ! array_key_exists($variableName, $variables)) { |
|
352 | + if (!$variables || !array_key_exists($variableName, $variables)) { |
|
353 | 353 | // No valid return value. |
354 | 354 | return $undefined; |
355 | 355 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | if ($type instanceof InputObjectType) { |
399 | - if (! $valueNode instanceof ObjectValueNode) { |
|
399 | + if (!$valueNode instanceof ObjectValueNode) { |
|
400 | 400 | // Invalid: intentionally return no value. |
401 | 401 | return $undefined; |
402 | 402 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $fields = $type->getFields(); |
406 | 406 | $fieldNodes = Utils::keyMap( |
407 | 407 | $valueNode->fields, |
408 | - static function ($field) { |
|
408 | + static function($field) { |
|
409 | 409 | return $field->name->value; |
410 | 410 | } |
411 | 411 | ); |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | if ($type instanceof EnumType) { |
444 | - if (! $valueNode instanceof EnumValueNode) { |
|
444 | + if (!$valueNode instanceof EnumValueNode) { |
|
445 | 445 | return $undefined; |
446 | 446 | } |
447 | 447 | $enumValue = $type->getValue($valueNode->value); |
448 | - if (! $enumValue) { |
|
448 | + if (!$enumValue) { |
|
449 | 449 | return $undefined; |
450 | 450 | } |
451 | 451 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | private static function isMissingVariable($valueNode, $variables) |
481 | 481 | { |
482 | 482 | return $valueNode instanceof VariableNode && |
483 | - (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables)); |
|
483 | + (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables)); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | return $valueNode->value; |
524 | 524 | case $valueNode instanceof ListValueNode: |
525 | 525 | return array_map( |
526 | - static function ($node) use ($variables) { |
|
526 | + static function($node) use ($variables) { |
|
527 | 527 | return self::valueFromASTUntyped($node, $variables); |
528 | 528 | }, |
529 | 529 | iterator_to_array($valueNode->values) |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | case $valueNode instanceof ObjectValueNode: |
532 | 532 | return array_combine( |
533 | 533 | array_map( |
534 | - static function ($field) { |
|
534 | + static function($field) { |
|
535 | 535 | return $field->name->value; |
536 | 536 | }, |
537 | 537 | iterator_to_array($valueNode->fields) |
538 | 538 | ), |
539 | 539 | array_map( |
540 | - static function ($field) use ($variables) { |
|
540 | + static function($field) use ($variables) { |
|
541 | 541 | return self::valueFromASTUntyped($field->value, $variables); |
542 | 542 | }, |
543 | 543 | iterator_to_array($valueNode->fields) |
@@ -597,11 +597,11 @@ discard block |
||
597 | 597 | { |
598 | 598 | if ($document->definitions) { |
599 | 599 | foreach ($document->definitions as $def) { |
600 | - if (! ($def instanceof OperationDefinitionNode)) { |
|
600 | + if (!($def instanceof OperationDefinitionNode)) { |
|
601 | 601 | continue; |
602 | 602 | } |
603 | 603 | |
604 | - if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
604 | + if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
605 | 605 | return $def->operation; |
606 | 606 | } |
607 | 607 | } |
@@ -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; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // Compute list of blame nodes. |
107 | 107 | if ($nodes instanceof Traversable) { |
108 | 108 | $nodes = iterator_to_array($nodes); |
109 | - } elseif ($nodes && ! is_array($nodes)) { |
|
109 | + } elseif ($nodes && !is_array($nodes)) { |
|
110 | 110 | $nodes = [$nodes]; |
111 | 111 | } |
112 | 112 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function getSource() |
213 | 213 | { |
214 | 214 | if ($this->source === null) { |
215 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
215 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
216 | 216 | $this->source = $this->nodes[0]->loc->source; |
217 | 217 | } |
218 | 218 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getPositions() |
227 | 227 | { |
228 | - if ($this->positions === null && ! empty($this->nodes)) { |
|
228 | + if ($this->positions === null && !empty($this->nodes)) { |
|
229 | 229 | $positions = array_map( |
230 | - static function ($node) { |
|
230 | + static function($node) { |
|
231 | 231 | return isset($node->loc) ? $node->loc->start : null; |
232 | 232 | }, |
233 | 233 | $this->nodes |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $positions = array_filter( |
237 | 237 | $positions, |
238 | - static function ($p) { |
|
238 | + static function($p) { |
|
239 | 239 | return $p !== null; |
240 | 240 | } |
241 | 241 | ); |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | |
271 | 271 | if ($positions && $source) { |
272 | 272 | $this->locations = array_map( |
273 | - static function ($pos) use ($source) { |
|
273 | + static function($pos) use ($source) { |
|
274 | 274 | return $source->getLocation($pos); |
275 | 275 | }, |
276 | 276 | $positions |
277 | 277 | ); |
278 | 278 | } elseif ($nodes) { |
279 | - $locations = array_filter( |
|
279 | + $locations = array_filter( |
|
280 | 280 | array_map( |
281 | - static function ($node) { |
|
281 | + static function($node) { |
|
282 | 282 | if ($node->loc && $node->loc->source) { |
283 | 283 | return $node->loc->source->getLocation($node->loc->start); |
284 | 284 | } |
@@ -339,18 +339,18 @@ discard block |
||
339 | 339 | |
340 | 340 | $locations = Utils::map( |
341 | 341 | $this->getLocations(), |
342 | - static function (SourceLocation $loc) { |
|
342 | + static function(SourceLocation $loc) { |
|
343 | 343 | return $loc->toSerializableArray(); |
344 | 344 | } |
345 | 345 | ); |
346 | 346 | |
347 | - if (! empty($locations)) { |
|
347 | + if (!empty($locations)) { |
|
348 | 348 | $arr['locations'] = $locations; |
349 | 349 | } |
350 | - if (! empty($this->path)) { |
|
350 | + if (!empty($this->path)) { |
|
351 | 351 | $arr['path'] = $this->path; |
352 | 352 | } |
353 | - if (! empty($this->extensions)) { |
|
353 | + if (!empty($this->extensions)) { |
|
354 | 354 | $arr['extensions'] = $this->extensions; |
355 | 355 | } |
356 | 356 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if ($error->nodes) { |
71 | 71 | /** @var Node $node */ |
72 | 72 | foreach ($error->nodes as $node) { |
73 | - if (! $node->loc) { |
|
73 | + if (!$node->loc) { |
|
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - return ! $printedLocations |
|
93 | + return !$printedLocations |
|
94 | 94 | ? $error->getMessage() |
95 | 95 | : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; |
96 | 96 | } |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | if ($e instanceof Error) { |
204 | 204 | $locations = Utils::map( |
205 | 205 | $e->getLocations(), |
206 | - static function (SourceLocation $loc) { |
|
206 | + static function(SourceLocation $loc) { |
|
207 | 207 | return $loc->toSerializableArray(); |
208 | 208 | } |
209 | 209 | ); |
210 | - if (! empty($locations)) { |
|
210 | + if (!empty($locations)) { |
|
211 | 211 | $formattedError['locations'] = $locations; |
212 | 212 | } |
213 | - if (! empty($e->path)) { |
|
213 | + if (!empty($e->path)) { |
|
214 | 214 | $formattedError['path'] = $e->path; |
215 | 215 | } |
216 | - if (! empty($e->getExtensions())) { |
|
216 | + if (!empty($e->getExtensions())) { |
|
217 | 217 | $formattedError['extensions'] = $e->getExtensions() + $formattedError['extensions']; |
218 | 218 | } |
219 | 219 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public static function addDebugEntries(array $formattedError, $e, $debug) |
241 | 241 | { |
242 | - if (! $debug) { |
|
242 | + if (!$debug) { |
|
243 | 243 | return $formattedError; |
244 | 244 | } |
245 | 245 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $debug = (int) $debug; |
253 | 253 | |
254 | 254 | if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { |
255 | - if (! $e instanceof Error) { |
|
255 | + if (!$e instanceof Error) { |
|
256 | 256 | throw $e; |
257 | 257 | } |
258 | 258 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | - $isUnsafe = ! $e instanceof ClientAware || ! $e->isClientSafe(); |
|
264 | + $isUnsafe = !$e instanceof ClientAware || !$e->isClientSafe(); |
|
265 | 265 | |
266 | 266 | if (($debug & Debug::RETHROW_UNSAFE_EXCEPTIONS) && $isUnsafe) { |
267 | 267 | if ($e->getPrevious()) { |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | ]; |
283 | 283 | } |
284 | 284 | |
285 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); |
|
285 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); |
|
286 | 286 | |
287 | - if (! $isTrivial) { |
|
287 | + if (!$isTrivial) { |
|
288 | 288 | $debugging = $e->getPrevious() ?: $e; |
289 | 289 | $formattedError['trace'] = static::toSafeTrace($debugging); |
290 | 290 | } |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public static function prepareFormatter(?callable $formatter = null, $debug) |
305 | 305 | { |
306 | - $formatter = $formatter ?: static function ($e) { |
|
306 | + $formatter = $formatter ?: static function($e) { |
|
307 | 307 | return FormattedError::createFromException($e); |
308 | 308 | }; |
309 | 309 | if ($debug) { |
310 | - $formatter = static function ($e) use ($formatter, $debug) { |
|
310 | + $formatter = static function($e) use ($formatter, $debug) { |
|
311 | 311 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); |
312 | 312 | }; |
313 | 313 | } |
@@ -332,18 +332,18 @@ discard block |
||
332 | 332 | // Remove invariant entries as they don't provide much value: |
333 | 333 | ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) { |
334 | 334 | array_shift($trace); |
335 | - } elseif (! isset($trace[0]['file'])) { |
|
335 | + } elseif (!isset($trace[0]['file'])) { |
|
336 | 336 | // Remove root call as it's likely error handler trace: |
337 | 337 | array_shift($trace); |
338 | 338 | } |
339 | 339 | |
340 | 340 | return array_map( |
341 | - static function ($err) { |
|
341 | + static function($err) { |
|
342 | 342 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
343 | 343 | |
344 | 344 | if (isset($err['function'])) { |
345 | 345 | $func = $err['function']; |
346 | - $args = ! empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : []; |
|
346 | + $args = !empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : []; |
|
347 | 347 | $funcStr = $func . '(' . implode(', ', $args) . ')'; |
348 | 348 | |
349 | 349 | if (isset($err['class'])) { |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | { |
413 | 413 | $formatted = ['message' => $error]; |
414 | 414 | |
415 | - if (! empty($locations)) { |
|
415 | + if (!empty($locations)) { |
|
416 | 416 | $formatted['locations'] = array_map( |
417 | - static function ($loc) { |
|
417 | + static function($loc) { |
|
418 | 418 | return $loc->toArray(); |
419 | 419 | }, |
420 | 420 | $locations |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | throw new RequestError('Could not parse JSON: ' . json_last_error_msg()); |
84 | 84 | } |
85 | 85 | |
86 | - if (! is_array($bodyParams)) { |
|
86 | + if (!is_array($bodyParams)) { |
|
87 | 87 | throw new RequestError( |
88 | 88 | 'GraphQL Server expects JSON object or array, but got ' . |
89 | 89 | Utils::printSafeJson($bodyParams) |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function validateOperationParams(OperationParams $params) |
150 | 150 | { |
151 | 151 | $errors = []; |
152 | - if (! $params->query && ! $params->queryId) { |
|
152 | + if (!$params->query && !$params->queryId) { |
|
153 | 153 | $errors[] = new RequestError('GraphQL Request must include at least one of those two parameters: "query" or "queryId"'); |
154 | 154 | } |
155 | 155 | |
@@ -157,28 +157,28 @@ discard block |
||
157 | 157 | $errors[] = new RequestError('GraphQL Request parameters "query" and "queryId" are mutually exclusive'); |
158 | 158 | } |
159 | 159 | |
160 | - if ($params->query !== null && (! is_string($params->query) || empty($params->query))) { |
|
160 | + if ($params->query !== null && (!is_string($params->query) || empty($params->query))) { |
|
161 | 161 | $errors[] = new RequestError( |
162 | 162 | 'GraphQL Request parameter "query" must be string, but got ' . |
163 | 163 | Utils::printSafeJson($params->query) |
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | - if ($params->queryId !== null && (! is_string($params->queryId) || empty($params->queryId))) { |
|
167 | + if ($params->queryId !== null && (!is_string($params->queryId) || empty($params->queryId))) { |
|
168 | 168 | $errors[] = new RequestError( |
169 | 169 | 'GraphQL Request parameter "queryId" must be string, but got ' . |
170 | 170 | Utils::printSafeJson($params->queryId) |
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | - if ($params->operation !== null && (! is_string($params->operation) || empty($params->operation))) { |
|
174 | + if ($params->operation !== null && (!is_string($params->operation) || empty($params->operation))) { |
|
175 | 175 | $errors[] = new RequestError( |
176 | 176 | 'GraphQL Request parameter "operation" must be string, but got ' . |
177 | 177 | Utils::printSafeJson($params->operation) |
178 | 178 | ); |
179 | 179 | } |
180 | 180 | |
181 | - if ($params->variables !== null && (! is_array($params->variables) || isset($params->variables[0]))) { |
|
181 | + if ($params->variables !== null && (!is_array($params->variables) || isset($params->variables[0]))) { |
|
182 | 182 | $errors[] = new RequestError( |
183 | 183 | 'GraphQL Request parameter "variables" must be object or JSON string parsed to object, but got ' . |
184 | 184 | Utils::printSafeJson($params->getOriginalInput('variables')) |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | $isBatch = false |
250 | 250 | ) { |
251 | 251 | try { |
252 | - if (! $config->getSchema()) { |
|
252 | + if (!$config->getSchema()) { |
|
253 | 253 | throw new InvariantViolation('Schema is required for the server'); |
254 | 254 | } |
255 | 255 | |
256 | - if ($isBatch && ! $config->getQueryBatching()) { |
|
256 | + if ($isBatch && !$config->getQueryBatching()) { |
|
257 | 257 | throw new RequestError('Batched queries are not supported by this server'); |
258 | 258 | } |
259 | 259 | |
260 | 260 | $errors = $this->validateOperationParams($op); |
261 | 261 | |
262 | - if (! empty($errors)) { |
|
262 | + if (!empty($errors)) { |
|
263 | 263 | $errors = Utils::map( |
264 | 264 | $errors, |
265 | - static function (RequestError $err) { |
|
265 | + static function(RequestError $err) { |
|
266 | 266 | return Error::createLocatedError($err, null, null); |
267 | 267 | } |
268 | 268 | ); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $doc = $op->queryId ? $this->loadPersistedQuery($config, $op) : $op->query; |
276 | 276 | |
277 | - if (! $doc instanceof DocumentNode) { |
|
277 | + if (!$doc instanceof DocumentNode) { |
|
278 | 278 | $doc = Parser::parse($doc); |
279 | 279 | } |
280 | 280 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | ); |
305 | 305 | } |
306 | 306 | |
307 | - $applyErrorHandling = static function (ExecutionResult $result) use ($config) { |
|
307 | + $applyErrorHandling = static function(ExecutionResult $result) use ($config) { |
|
308 | 308 | if ($config->getErrorsHandler()) { |
309 | 309 | $result->setErrorsHandler($config->getErrorsHandler()); |
310 | 310 | } |
@@ -333,13 +333,13 @@ discard block |
||
333 | 333 | // Load query if we got persisted query id: |
334 | 334 | $loader = $config->getPersistentQueryLoader(); |
335 | 335 | |
336 | - if (! $loader) { |
|
336 | + if (!$loader) { |
|
337 | 337 | throw new RequestError('Persisted queries are not supported by this server'); |
338 | 338 | } |
339 | 339 | |
340 | 340 | $source = $loader($operationParams->queryId, $operationParams); |
341 | 341 | |
342 | - if (! is_string($source) && ! $source instanceof DocumentNode) { |
|
342 | + if (!is_string($source) && !$source instanceof DocumentNode) { |
|
343 | 343 | throw new InvariantViolation(sprintf( |
344 | 344 | 'Persistent query loader must return query string or instance of %s but got: %s', |
345 | 345 | DocumentNode::class, |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | if (is_callable($validationRules)) { |
368 | 368 | $validationRules = $validationRules($params, $doc, $operationType); |
369 | 369 | |
370 | - if (! is_array($validationRules)) { |
|
370 | + if (!is_array($validationRules)) { |
|
371 | 371 | throw new InvariantViolation(sprintf( |
372 | 372 | 'Expecting validation rules to be array or callable returning array, but got: %s', |
373 | 373 | Utils::printSafe($validationRules) |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | public function sendResponse($result, $exitWhenDone = false) |
426 | 426 | { |
427 | 427 | if ($result instanceof Promise) { |
428 | - $result->then(function ($actualResult) use ($exitWhenDone) { |
|
428 | + $result->then(function($actualResult) use ($exitWhenDone) { |
|
429 | 429 | $this->doSendResponse($actualResult, $exitWhenDone); |
430 | 430 | }); |
431 | 431 | } else { |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | if (is_array($result) && isset($result[0])) { |
474 | 474 | Utils::each( |
475 | 475 | $result, |
476 | - static function ($executionResult, $index) { |
|
477 | - if (! $executionResult instanceof ExecutionResult) { |
|
476 | + static function($executionResult, $index) { |
|
477 | + if (!$executionResult instanceof ExecutionResult) { |
|
478 | 478 | throw new InvariantViolation(sprintf( |
479 | 479 | 'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s', |
480 | 480 | ExecutionResult::class, |
@@ -486,14 +486,14 @@ discard block |
||
486 | 486 | ); |
487 | 487 | $httpStatus = 200; |
488 | 488 | } else { |
489 | - if (! $result instanceof ExecutionResult) { |
|
489 | + if (!$result instanceof ExecutionResult) { |
|
490 | 490 | throw new InvariantViolation(sprintf( |
491 | 491 | 'Expecting query result to be instance of %s but got %s', |
492 | 492 | ExecutionResult::class, |
493 | 493 | Utils::printSafe($result) |
494 | 494 | )); |
495 | 495 | } |
496 | - if ($result->data === null && ! empty($result->errors)) { |
|
496 | + if ($result->data === null && !empty($result->errors)) { |
|
497 | 497 | $httpStatus = 400; |
498 | 498 | } else { |
499 | 499 | $httpStatus = 200; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | } else { |
520 | 520 | $contentType = $request->getHeader('content-type'); |
521 | 521 | |
522 | - if (! isset($contentType[0])) { |
|
522 | + if (!isset($contentType[0])) { |
|
523 | 523 | throw new RequestError('Missing "Content-Type" header'); |
524 | 524 | } |
525 | 525 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | ); |
535 | 535 | } |
536 | 536 | |
537 | - if (! is_array($bodyParams)) { |
|
537 | + if (!is_array($bodyParams)) { |
|
538 | 538 | throw new RequestError( |
539 | 539 | 'GraphQL Server expects JSON object or array, but got ' . |
540 | 540 | Utils::printSafeJson($bodyParams) |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | } else { |
544 | 544 | $bodyParams = $request->getParsedBody(); |
545 | 545 | |
546 | - if (! is_array($bodyParams)) { |
|
546 | + if (!is_array($bodyParams)) { |
|
547 | 547 | throw new RequestError('Unexpected content type: ' . Utils::printSafeJson($contentType[0])); |
548 | 548 | } |
549 | 549 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | public function toPsrResponse($result, ResponseInterface $response, StreamInterface $writableBodyStream) |
569 | 569 | { |
570 | 570 | if ($result instanceof Promise) { |
571 | - return $result->then(function ($actualResult) use ($response, $writableBodyStream) { |
|
571 | + return $result->then(function($actualResult) use ($response, $writableBodyStream) { |
|
572 | 572 | return $this->doConvertToPsrResponse($actualResult, $response, $writableBodyStream); |
573 | 573 | }); |
574 | 574 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ); |
63 | 63 | $descriptions = $options; |
64 | 64 | } else { |
65 | - $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
65 | + $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
66 | 66 | } |
67 | 67 | $descriptionField = $descriptions ? 'description' : ''; |
68 | 68 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | public static function _schema() |
189 | 189 | { |
190 | - if (! isset(self::$map['__Schema'])) { |
|
190 | + if (!isset(self::$map['__Schema'])) { |
|
191 | 191 | self::$map['__Schema'] = new ObjectType([ |
192 | 192 | 'name' => '__Schema', |
193 | 193 | 'isIntrospection' => true, |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | 'types' => [ |
201 | 201 | 'description' => 'A list of all types supported by this server.', |
202 | 202 | 'type' => new NonNull(new ListOfType(new NonNull(self::_type()))), |
203 | - 'resolve' => static function (Schema $schema) { |
|
203 | + 'resolve' => static function(Schema $schema) { |
|
204 | 204 | return array_values($schema->getTypeMap()); |
205 | 205 | }, |
206 | 206 | ], |
207 | 207 | 'queryType' => [ |
208 | 208 | 'description' => 'The type that query operations will be rooted at.', |
209 | 209 | 'type' => new NonNull(self::_type()), |
210 | - 'resolve' => static function (Schema $schema) { |
|
210 | + 'resolve' => static function(Schema $schema) { |
|
211 | 211 | return $schema->getQueryType(); |
212 | 212 | }, |
213 | 213 | ], |
@@ -216,21 +216,21 @@ discard block |
||
216 | 216 | 'If this server supports mutation, the type that ' . |
217 | 217 | 'mutation operations will be rooted at.', |
218 | 218 | 'type' => self::_type(), |
219 | - 'resolve' => static function (Schema $schema) { |
|
219 | + 'resolve' => static function(Schema $schema) { |
|
220 | 220 | return $schema->getMutationType(); |
221 | 221 | }, |
222 | 222 | ], |
223 | 223 | 'subscriptionType' => [ |
224 | 224 | 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.', |
225 | 225 | 'type' => self::_type(), |
226 | - 'resolve' => static function (Schema $schema) { |
|
226 | + 'resolve' => static function(Schema $schema) { |
|
227 | 227 | return $schema->getSubscriptionType(); |
228 | 228 | }, |
229 | 229 | ], |
230 | 230 | 'directives' => [ |
231 | 231 | 'description' => 'A list of all directives supported by this server.', |
232 | 232 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))), |
233 | - 'resolve' => static function (Schema $schema) { |
|
233 | + 'resolve' => static function(Schema $schema) { |
|
234 | 234 | return $schema->getDirectives(); |
235 | 235 | }, |
236 | 236 | ], |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | public static function _type() |
245 | 245 | { |
246 | - if (! isset(self::$map['__Type'])) { |
|
246 | + if (!isset(self::$map['__Type'])) { |
|
247 | 247 | self::$map['__Type'] = new ObjectType([ |
248 | 248 | 'name' => '__Type', |
249 | 249 | 'isIntrospection' => true, |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | 'Object and Interface types provide the fields they describe. Abstract ' . |
258 | 258 | 'types, Union and Interface, provide the Object types possible ' . |
259 | 259 | 'at runtime. List and NonNull types compose other types.', |
260 | - 'fields' => static function () { |
|
260 | + 'fields' => static function() { |
|
261 | 261 | return [ |
262 | 262 | 'kind' => [ |
263 | 263 | 'type' => Type::nonNull(self::_typeKind()), |
264 | - 'resolve' => static function (Type $type) { |
|
264 | + 'resolve' => static function(Type $type) { |
|
265 | 265 | switch (true) { |
266 | 266 | case $type instanceof ListOfType: |
267 | 267 | return TypeKind::LIST_KIND; |
@@ -291,15 +291,15 @@ discard block |
||
291 | 291 | 'args' => [ |
292 | 292 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
293 | 293 | ], |
294 | - 'resolve' => static function (Type $type, $args) { |
|
294 | + 'resolve' => static function(Type $type, $args) { |
|
295 | 295 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
296 | 296 | $fields = $type->getFields(); |
297 | 297 | |
298 | 298 | if (empty($args['includeDeprecated'])) { |
299 | 299 | $fields = array_filter( |
300 | 300 | $fields, |
301 | - static function (FieldDefinition $field) { |
|
302 | - return ! $field->deprecationReason; |
|
301 | + static function(FieldDefinition $field) { |
|
302 | + return !$field->deprecationReason; |
|
303 | 303 | } |
304 | 304 | ); |
305 | 305 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ], |
313 | 313 | 'interfaces' => [ |
314 | 314 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
315 | - 'resolve' => static function ($type) { |
|
315 | + 'resolve' => static function($type) { |
|
316 | 316 | if ($type instanceof ObjectType) { |
317 | 317 | return $type->getInterfaces(); |
318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | ], |
323 | 323 | 'possibleTypes' => [ |
324 | 324 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
325 | - 'resolve' => static function ($type, $args, $context, ResolveInfo $info) { |
|
325 | + 'resolve' => static function($type, $args, $context, ResolveInfo $info) { |
|
326 | 326 | if ($type instanceof InterfaceType || $type instanceof UnionType) { |
327 | 327 | return $info->schema->getPossibleTypes($type); |
328 | 328 | } |
@@ -335,15 +335,15 @@ discard block |
||
335 | 335 | 'args' => [ |
336 | 336 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
337 | 337 | ], |
338 | - 'resolve' => static function ($type, $args) { |
|
338 | + 'resolve' => static function($type, $args) { |
|
339 | 339 | if ($type instanceof EnumType) { |
340 | 340 | $values = array_values($type->getValues()); |
341 | 341 | |
342 | 342 | if (empty($args['includeDeprecated'])) { |
343 | 343 | $values = array_filter( |
344 | 344 | $values, |
345 | - static function ($value) { |
|
346 | - return ! $value->deprecationReason; |
|
345 | + static function($value) { |
|
346 | + return !$value->deprecationReason; |
|
347 | 347 | } |
348 | 348 | ); |
349 | 349 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | ], |
357 | 357 | 'inputFields' => [ |
358 | 358 | 'type' => Type::listOf(Type::nonNull(self::_inputValue())), |
359 | - 'resolve' => static function ($type) { |
|
359 | + 'resolve' => static function($type) { |
|
360 | 360 | if ($type instanceof InputObjectType) { |
361 | 361 | return array_values($type->getFields()); |
362 | 362 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | ], |
367 | 367 | 'ofType' => [ |
368 | 368 | 'type' => self::_type(), |
369 | - 'resolve' => static function ($type) { |
|
369 | + 'resolve' => static function($type) { |
|
370 | 370 | if ($type instanceof WrappingType) { |
371 | 371 | return $type->getWrappedType(); |
372 | 372 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | public static function _typeKind() |
386 | 386 | { |
387 | - if (! isset(self::$map['__TypeKind'])) { |
|
387 | + if (!isset(self::$map['__TypeKind'])) { |
|
388 | 388 | self::$map['__TypeKind'] = new EnumType([ |
389 | 389 | 'name' => '__TypeKind', |
390 | 390 | 'isIntrospection' => true, |
@@ -431,32 +431,32 @@ discard block |
||
431 | 431 | |
432 | 432 | public static function _field() |
433 | 433 | { |
434 | - if (! isset(self::$map['__Field'])) { |
|
434 | + if (!isset(self::$map['__Field'])) { |
|
435 | 435 | self::$map['__Field'] = new ObjectType([ |
436 | 436 | 'name' => '__Field', |
437 | 437 | 'isIntrospection' => true, |
438 | 438 | 'description' => |
439 | 439 | 'Object and Interface types are described by a list of Fields, each of ' . |
440 | 440 | 'which has a name, potentially a list of arguments, and a return type.', |
441 | - 'fields' => static function () { |
|
441 | + 'fields' => static function() { |
|
442 | 442 | return [ |
443 | 443 | 'name' => ['type' => Type::nonNull(Type::string())], |
444 | 444 | 'description' => ['type' => Type::string()], |
445 | 445 | 'args' => [ |
446 | 446 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
447 | - 'resolve' => static function (FieldDefinition $field) { |
|
447 | + 'resolve' => static function(FieldDefinition $field) { |
|
448 | 448 | return empty($field->args) ? [] : $field->args; |
449 | 449 | }, |
450 | 450 | ], |
451 | 451 | 'type' => [ |
452 | 452 | 'type' => Type::nonNull(self::_type()), |
453 | - 'resolve' => static function (FieldDefinition $field) { |
|
453 | + 'resolve' => static function(FieldDefinition $field) { |
|
454 | 454 | return $field->getType(); |
455 | 455 | }, |
456 | 456 | ], |
457 | 457 | 'isDeprecated' => [ |
458 | 458 | 'type' => Type::nonNull(Type::boolean()), |
459 | - 'resolve' => static function (FieldDefinition $field) { |
|
459 | + 'resolve' => static function(FieldDefinition $field) { |
|
460 | 460 | return (bool) $field->deprecationReason; |
461 | 461 | }, |
462 | 462 | ], |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | public static function _inputValue() |
475 | 475 | { |
476 | - if (! isset(self::$map['__InputValue'])) { |
|
476 | + if (!isset(self::$map['__InputValue'])) { |
|
477 | 477 | self::$map['__InputValue'] = new ObjectType([ |
478 | 478 | 'name' => '__InputValue', |
479 | 479 | 'isIntrospection' => true, |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
482 | 482 | 'InputObject are represented as Input Values which describe their type ' . |
483 | 483 | 'and optionally a default value.', |
484 | - 'fields' => static function () { |
|
484 | + 'fields' => static function() { |
|
485 | 485 | return [ |
486 | 486 | 'name' => ['type' => Type::nonNull(Type::string())], |
487 | 487 | 'description' => ['type' => Type::string()], |
488 | 488 | 'type' => [ |
489 | 489 | 'type' => Type::nonNull(self::_type()), |
490 | - 'resolve' => static function ($value) { |
|
490 | + 'resolve' => static function($value) { |
|
491 | 491 | return method_exists($value, 'getType') ? $value->getType() : $value->type; |
492 | 492 | }, |
493 | 493 | ], |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | 'type' => Type::string(), |
496 | 496 | 'description' => |
497 | 497 | 'A GraphQL-formatted string representing the default value for this input value.', |
498 | - 'resolve' => static function ($inputValue) { |
|
498 | + 'resolve' => static function($inputValue) { |
|
499 | 499 | /** @var FieldArgument|InputObjectField $inputValue */ |
500 | - return ! $inputValue->defaultValueExists() |
|
500 | + return !$inputValue->defaultValueExists() |
|
501 | 501 | ? null |
502 | 502 | : Printer::doPrint(AST::astFromValue( |
503 | 503 | $inputValue->defaultValue, |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | public static function _enumValue() |
517 | 517 | { |
518 | - if (! isset(self::$map['__EnumValue'])) { |
|
518 | + if (!isset(self::$map['__EnumValue'])) { |
|
519 | 519 | self::$map['__EnumValue'] = new ObjectType([ |
520 | 520 | 'name' => '__EnumValue', |
521 | 521 | 'isIntrospection' => true, |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | 'description' => ['type' => Type::string()], |
529 | 529 | 'isDeprecated' => [ |
530 | 530 | 'type' => Type::nonNull(Type::boolean()), |
531 | - 'resolve' => static function ($enumValue) { |
|
531 | + 'resolve' => static function($enumValue) { |
|
532 | 532 | return (bool) $enumValue->deprecationReason; |
533 | 533 | }, |
534 | 534 | ], |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | public static function _directive() |
546 | 546 | { |
547 | - if (! isset(self::$map['__Directive'])) { |
|
547 | + if (!isset(self::$map['__Directive'])) { |
|
548 | 548 | self::$map['__Directive'] = new ObjectType([ |
549 | 549 | 'name' => '__Directive', |
550 | 550 | 'isIntrospection' => true, |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | ], |
565 | 565 | 'args' => [ |
566 | 566 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
567 | - 'resolve' => static function (Directive $directive) { |
|
567 | + 'resolve' => static function(Directive $directive) { |
|
568 | 568 | return $directive->args ?: []; |
569 | 569 | }, |
570 | 570 | ], |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | 'onOperation' => [ |
575 | 575 | 'deprecationReason' => 'Use `locations`.', |
576 | 576 | 'type' => Type::nonNull(Type::boolean()), |
577 | - 'resolve' => static function ($d) { |
|
577 | + 'resolve' => static function($d) { |
|
578 | 578 | return in_array(DirectiveLocation::QUERY, $d->locations, true) || |
579 | 579 | in_array(DirectiveLocation::MUTATION, $d->locations, true) || |
580 | 580 | in_array(DirectiveLocation::SUBSCRIPTION, $d->locations, true); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | 'onFragment' => [ |
584 | 584 | 'deprecationReason' => 'Use `locations`.', |
585 | 585 | 'type' => Type::nonNull(Type::boolean()), |
586 | - 'resolve' => static function ($d) { |
|
586 | + 'resolve' => static function($d) { |
|
587 | 587 | return in_array(DirectiveLocation::FRAGMENT_SPREAD, $d->locations, true) || |
588 | 588 | in_array(DirectiveLocation::INLINE_FRAGMENT, $d->locations, true) || |
589 | 589 | in_array(DirectiveLocation::FRAGMENT_DEFINITION, $d->locations, true); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | 'onField' => [ |
593 | 593 | 'deprecationReason' => 'Use `locations`.', |
594 | 594 | 'type' => Type::nonNull(Type::boolean()), |
595 | - 'resolve' => static function ($d) { |
|
595 | + 'resolve' => static function($d) { |
|
596 | 596 | return in_array(DirectiveLocation::FIELD, $d->locations, true); |
597 | 597 | }, |
598 | 598 | ], |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | |
606 | 606 | public static function _directiveLocation() |
607 | 607 | { |
608 | - if (! isset(self::$map['__DirectiveLocation'])) { |
|
608 | + if (!isset(self::$map['__DirectiveLocation'])) { |
|
609 | 609 | self::$map['__DirectiveLocation'] = new EnumType([ |
610 | 610 | 'name' => '__DirectiveLocation', |
611 | 611 | 'isIntrospection' => true, |
@@ -695,13 +695,13 @@ discard block |
||
695 | 695 | |
696 | 696 | public static function schemaMetaFieldDef() |
697 | 697 | { |
698 | - if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
698 | + if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
699 | 699 | self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([ |
700 | 700 | 'name' => self::SCHEMA_FIELD_NAME, |
701 | 701 | 'type' => Type::nonNull(self::_schema()), |
702 | 702 | 'description' => 'Access the current type schema of this server.', |
703 | 703 | 'args' => [], |
704 | - 'resolve' => static function ( |
|
704 | + 'resolve' => static function( |
|
705 | 705 | $source, |
706 | 706 | $args, |
707 | 707 | $context, |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | |
718 | 718 | public static function typeMetaFieldDef() |
719 | 719 | { |
720 | - if (! isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
720 | + if (!isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
721 | 721 | self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([ |
722 | 722 | 'name' => self::TYPE_FIELD_NAME, |
723 | 723 | 'type' => self::_type(), |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | 'args' => [ |
726 | 726 | ['name' => 'name', 'type' => Type::nonNull(Type::string())], |
727 | 727 | ], |
728 | - 'resolve' => static function ($source, $args, $context, ResolveInfo $info) { |
|
728 | + 'resolve' => static function($source, $args, $context, ResolveInfo $info) { |
|
729 | 729 | return $info->schema->getType($args['name']); |
730 | 730 | }, |
731 | 731 | ]); |
@@ -736,13 +736,13 @@ discard block |
||
736 | 736 | |
737 | 737 | public static function typeNameMetaFieldDef() |
738 | 738 | { |
739 | - if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
739 | + if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
740 | 740 | self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([ |
741 | 741 | 'name' => self::TYPE_NAME_FIELD_NAME, |
742 | 742 | 'type' => Type::nonNull(Type::string()), |
743 | 743 | 'description' => 'The name of the current Object type at runtime.', |
744 | 744 | 'args' => [], |
745 | - 'resolve' => static function ( |
|
745 | + 'resolve' => static function( |
|
746 | 746 | $source, |
747 | 747 | $args, |
748 | 748 | $context, |