@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | $astDefinition = $context->getDocument()->definitions; |
34 | 34 | |
35 | 35 | foreach ($astDefinition as $def) { |
36 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
36 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
37 | 37 | continue; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $locationsMap[$def->name->value] = array_map( |
41 | - static function ($name) { |
|
41 | + static function($name) { |
|
42 | 42 | return $name->value; |
43 | 43 | }, |
44 | 44 | $def->locations |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | return [ |
49 | - NodeKind::DIRECTIVE => function ( |
|
49 | + NodeKind::DIRECTIVE => function( |
|
50 | 50 | DirectiveNode $node, |
51 | 51 | $key, |
52 | 52 | $parent, |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $name = $node->name->value; |
60 | 60 | $locations = $locationsMap[$name] ?? null; |
61 | 61 | |
62 | - if (! $locations) { |
|
62 | + if (!$locations) { |
|
63 | 63 | $context->reportError(new Error( |
64 | 64 | self::unknownDirectiveMessage($name), |
65 | 65 | [$node] |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $candidateLocation = $this->getDirectiveLocationForASTPath($ancestors); |
72 | 72 | |
73 | - if (! $candidateLocation || in_array($candidateLocation, $locations, true)) { |
|
73 | + if (!$candidateLocation || in_array($candidateLocation, $locations, true)) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | $context->reportError( |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->collector = new Collector($this->schema, $this); |
185 | 185 | $this->collector->initialize($this->documentNode, $this->operationName); |
186 | 186 | |
187 | - if (! empty($this->errors)) { |
|
187 | + if (!empty($this->errors)) { |
|
188 | 188 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $this->errors)); |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $this->rawVariableValues ?: [] |
195 | 195 | ); |
196 | 196 | |
197 | - if (! empty($errors)) { |
|
197 | + if (!empty($errors)) { |
|
198 | 198 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $errors)); |
199 | 199 | } |
200 | 200 | |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | ); |
216 | 216 | |
217 | 217 | $fieldDefinition = $this->findFieldDefinition($ctx); |
218 | - if (! $fieldDefinition->getType() instanceof NonNull) { |
|
218 | + if (!$fieldDefinition->getType() instanceof NonNull) { |
|
219 | 219 | $ctx->nullFence = [$shared->resultName]; |
220 | 220 | } |
221 | 221 | |
222 | - if ($this->collector->operation->operation === 'mutation' && ! $this->queue->isEmpty()) { |
|
222 | + if ($this->collector->operation->operation === 'mutation' && !$this->queue->isEmpty()) { |
|
223 | 223 | $this->schedule->enqueue($ctx); |
224 | 224 | } else { |
225 | 225 | $this->queue->enqueue(new Strand($this->spawn($ctx))); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $this->run(); |
230 | 230 | |
231 | 231 | if ($this->pending > 0) { |
232 | - return $this->promiseAdapter->create(function (callable $resolve) { |
|
232 | + return $this->promiseAdapter->create(function(callable $resolve) { |
|
233 | 233 | $this->doResolve = $resolve; |
234 | 234 | }); |
235 | 235 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | private function run() |
280 | 280 | { |
281 | 281 | RUN: |
282 | - while (! $this->queue->isEmpty()) { |
|
282 | + while (!$this->queue->isEmpty()) { |
|
283 | 283 | /** @var Strand $strand */ |
284 | 284 | $strand = $this->queue->dequeue(); |
285 | 285 | |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | // !!! increment pending before calling ->then() as it may invoke the callback right away |
310 | 310 | ++$this->pending; |
311 | 311 | |
312 | - if (! $value instanceof Promise) { |
|
312 | + if (!$value instanceof Promise) { |
|
313 | 313 | $value = $this->promiseAdapter->convertThenable($value); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $this->promiseAdapter |
317 | 317 | ->then( |
318 | 318 | $value, |
319 | - function ($value) use ($strand) { |
|
319 | + function($value) use ($strand) { |
|
320 | 320 | $strand->success = true; |
321 | 321 | $strand->value = $value; |
322 | 322 | $this->queue->enqueue($strand); |
323 | 323 | $this->done(); |
324 | 324 | }, |
325 | - function (Throwable $throwable) use ($strand) { |
|
325 | + function(Throwable $throwable) use ($strand) { |
|
326 | 326 | $strand->success = false; |
327 | 327 | $strand->value = $throwable; |
328 | 328 | $this->queue->enqueue($strand); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | $value = $resolve($ctx->value, $arguments, $this->contextValue, $ctx->resolveInfo); |
436 | 436 | |
437 | - if (! $this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
437 | + if (!$this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
438 | 438 | $returnValue = yield $this->completeValue( |
439 | 439 | $ctx, |
440 | 440 | $returnType, |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | if ($returnValue !== self::$undefined) { |
457 | 457 | $ctx->result->{$ctx->shared->resultName} = $returnValue; |
458 | 458 | } elseif ($ctx->resolveInfo !== null && $ctx->resolveInfo->returnType instanceof NonNull) { // !!! $ctx->resolveInfo might not have been initialized yet |
459 | - $result =& $this->rootResult; |
|
459 | + $result = & $this->rootResult; |
|
460 | 460 | foreach ($ctx->nullFence ?? [] as $key) { |
461 | 461 | if (is_string($key)) { |
462 | - $result =& $result->{$key}; |
|
462 | + $result = & $result->{$key}; |
|
463 | 463 | } else { |
464 | - $result =& $result[$key]; |
|
464 | + $result = & $result[$key]; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | $result = null; |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $type = $type->getWrappedType(); |
504 | 504 | } |
505 | 505 | |
506 | - if (! $type instanceof LeafType) { |
|
506 | + if (!$type instanceof LeafType) { |
|
507 | 507 | return false; |
508 | 508 | } |
509 | 509 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $ctx->resolveInfo->path = $itemPath; |
637 | 637 | |
638 | 638 | try { |
639 | - if (! $this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
639 | + if (!$this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
640 | 640 | $itemReturnValue = yield $this->completeValue($ctx, $itemType, $itemValue, $itemPath, $nullFence); |
641 | 641 | } |
642 | 642 | } catch (Throwable $reason) { |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | |
728 | 728 | $returnValue = self::$undefined; |
729 | 729 | goto CHECKED_RETURN; |
730 | - } elseif (! $objectType instanceof ObjectType) { |
|
730 | + } elseif (!$objectType instanceof ObjectType) { |
|
731 | 731 | $this->addError(Error::createLocatedError( |
732 | 732 | new InvariantViolation(sprintf( |
733 | 733 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | |
748 | 748 | $returnValue = null; |
749 | 749 | goto CHECKED_RETURN; |
750 | - } elseif (! $this->schema->isPossibleType($type, $objectType)) { |
|
750 | + } elseif (!$this->schema->isPossibleType($type, $objectType)) { |
|
751 | 751 | $this->addError(Error::createLocatedError( |
752 | 752 | new InvariantViolation(sprintf( |
753 | 753 | 'Runtime Object type "%s" is not a possible type for "%s".', |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | if ($typeCheck !== null) { |
800 | 800 | // !!! $objectType->isTypeOf() might return promise, yield to resolve |
801 | 801 | $typeCheck = yield $typeCheck; |
802 | - if (! $typeCheck) { |
|
802 | + if (!$typeCheck) { |
|
803 | 803 | $this->addError(Error::createLocatedError( |
804 | 804 | sprintf('Expected value of type "%s" but got: %s.', $type->name, Utils::printSafe($value)), |
805 | 805 | $ctx->shared->fieldNodes, |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | $selectedType = null; |
951 | 951 | foreach ($possibleTypes as $type) { |
952 | 952 | $typeCheck = yield $type->isTypeOf($value, $this->contextValue, $ctx->resolveInfo); |
953 | - if ($selectedType !== null || ! $typeCheck) { |
|
953 | + if ($selectedType !== null || !$typeCheck) { |
|
954 | 954 | continue; |
955 | 955 | } |
956 | 956 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $fieldName = $fieldNode->name->value; |
119 | 119 | |
120 | 120 | $argumentValueMap = null; |
121 | - if (! empty($fieldNode->arguments)) { |
|
121 | + if (!empty($fieldNode->arguments)) { |
|
122 | 122 | foreach ($fieldNode->arguments as $argumentNode) { |
123 | 123 | $argumentValueMap = $argumentValueMap ?? []; |
124 | 124 | $argumentValueMap[$argumentNode->name->value] = $argumentNode->value; |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($fieldName !== Introspection::TYPE_NAME_FIELD_NAME && |
129 | - ! ($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
130 | - ! $runtimeType->hasField($fieldName) |
|
129 | + !($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
130 | + !$runtimeType->hasField($fieldName) |
|
131 | 131 | ) { |
132 | 132 | // do not emit error |
133 | 133 | continue; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | foreach ($selectionSet->selections as $selection) { |
147 | 147 | /** @var FieldNode|FragmentSpreadNode|InlineFragmentNode $selection */ |
148 | - if (! empty($selection->directives)) { |
|
148 | + if (!empty($selection->directives)) { |
|
149 | 149 | foreach ($selection->directives as $directiveNode) { |
150 | 150 | if ($directiveNode->name->value === Directive::SKIP_NAME) { |
151 | 151 | /** @var VariableNode|NullValueNode|IntValueNode|FloatValueNode|StringValueNode|BooleanValueNode|EnumValueNode|ListValueNode|ObjectValueNode|null $condition */ |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($selection instanceof FieldNode) { |
195 | 195 | $resultName = $selection->alias === null ? $selection->name->value : $selection->alias->value; |
196 | 196 | |
197 | - if (! isset($this->fields[$resultName])) { |
|
197 | + if (!isset($this->fields[$resultName])) { |
|
198 | 198 | $this->fields[$resultName] = []; |
199 | 199 | } |
200 | 200 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | - if (! isset($this->fragments[$fragmentName])) { |
|
209 | + if (!isset($this->fragments[$fragmentName])) { |
|
210 | 210 | $this->runtime->addError(new Error( |
211 | 211 | sprintf('Fragment "%s" does not exist.', $fragmentName), |
212 | 212 | $selection |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $fragmentDefinition = $this->fragments[$fragmentName]; |
220 | 220 | $conditionTypeName = $fragmentDefinition->typeCondition->name->value; |
221 | 221 | |
222 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
222 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
223 | 223 | $this->runtime->addError(new Error( |
224 | 224 | sprintf('Cannot spread fragment "%s", type "%s" does not exist.', $fragmentName, $conditionTypeName), |
225 | 225 | $selection |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | } elseif ($conditionType instanceof AbstractType) { |
237 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
237 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
238 | 238 | continue; |
239 | 239 | } |
240 | 240 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if ($selection->typeCondition !== null) { |
245 | 245 | $conditionTypeName = $selection->typeCondition->name->value; |
246 | 246 | |
247 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
247 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
248 | 248 | $this->runtime->addError(new Error( |
249 | 249 | sprintf('Cannot spread inline fragment, type "%s" does not exist.', $conditionTypeName), |
250 | 250 | $selection |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | } elseif ($conditionType instanceof AbstractType) { |
262 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
262 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
263 | 263 | continue; |
264 | 264 | } |
265 | 265 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this->cachedFieldsAndFragmentNames = new SplObjectStorage(); |
61 | 61 | |
62 | 62 | return [ |
63 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
63 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
64 | 64 | $conflicts = $this->findConflictsWithinSelectionSet( |
65 | 65 | $context, |
66 | 66 | $context->getParentType(), |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | $responseName = $selection->alias ? $selection->alias->value : $fieldName; |
261 | 261 | |
262 | - if (! isset($astAndDefs[$responseName])) { |
|
262 | + if (!isset($astAndDefs[$responseName])) { |
|
263 | 263 | $astAndDefs[$responseName] = []; |
264 | 264 | } |
265 | 265 | $astAndDefs[$responseName][] = [$parentType, $selection, $fieldDef]; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $fields[$i], |
319 | 319 | $fields[$j] |
320 | 320 | ); |
321 | - if (! $conflict) { |
|
321 | + if (!$conflict) { |
|
322 | 322 | continue; |
323 | 323 | } |
324 | 324 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $type1 = $def1 === null ? null : $def1->getType(); |
370 | 370 | $type2 = $def2 === null ? null : $def2->getType(); |
371 | 371 | |
372 | - if (! $areMutuallyExclusive) { |
|
372 | + if (!$areMutuallyExclusive) { |
|
373 | 373 | // Two aliases must refer to the same field. |
374 | 374 | $name1 = $ast1->name->value; |
375 | 375 | $name2 = $ast2->name->value; |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ]; |
382 | 382 | } |
383 | 383 | |
384 | - if (! $this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
384 | + if (!$this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
385 | 385 | return [ |
386 | 386 | [$responseName, 'they have differing arguments'], |
387 | 387 | [$ast1], |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | break; |
444 | 444 | } |
445 | 445 | } |
446 | - if (! $argument2) { |
|
446 | + if (!$argument2) { |
|
447 | 447 | return false; |
448 | 448 | } |
449 | 449 | |
450 | - if (! $this->sameValue($argument1->value, $argument2->value)) { |
|
450 | + if (!$this->sameValue($argument1->value, $argument2->value)) { |
|
451 | 451 | return false; |
452 | 452 | } |
453 | 453 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | private function sameValue(Node $value1, Node $value2) |
462 | 462 | { |
463 | - return (! $value1 && ! $value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
463 | + return (!$value1 && !$value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | // maps, each field from the first field map must be compared to every field |
616 | 616 | // in the second field map to find potential conflicts. |
617 | 617 | foreach ($fieldMap1 as $responseName => $fields1) { |
618 | - if (! isset($fieldMap2[$responseName])) { |
|
618 | + if (!isset($fieldMap2[$responseName])) { |
|
619 | 619 | continue; |
620 | 620 | } |
621 | 621 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | $fields1[$i], |
632 | 632 | $fields2[$j] |
633 | 633 | ); |
634 | - if (! $conflict) { |
|
634 | + if (!$conflict) { |
|
635 | 635 | continue; |
636 | 636 | } |
637 | 637 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $comparedFragments[$fragmentName] = true; |
666 | 666 | |
667 | 667 | $fragment = $context->getFragment($fragmentName); |
668 | - if (! $fragment) { |
|
668 | + if (!$fragment) { |
|
669 | 669 | return; |
670 | 670 | } |
671 | 671 | |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | |
766 | 766 | $fragment1 = $context->getFragment($fragmentName1); |
767 | 767 | $fragment2 = $context->getFragment($fragmentName2); |
768 | - if (! $fragment1 || ! $fragment2) { |
|
768 | + if (!$fragment1 || !$fragment2) { |
|
769 | 769 | return; |
770 | 770 | } |
771 | 771 | |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | [ |
839 | 839 | $responseName, |
840 | 840 | array_map( |
841 | - static function ($conflict) { |
|
841 | + static function($conflict) { |
|
842 | 842 | return $conflict[0]; |
843 | 843 | }, |
844 | 844 | $conflicts |
@@ -846,14 +846,14 @@ discard block |
||
846 | 846 | ], |
847 | 847 | array_reduce( |
848 | 848 | $conflicts, |
849 | - static function ($allFields, $conflict) { |
|
849 | + static function($allFields, $conflict) { |
|
850 | 850 | return array_merge($allFields, $conflict[1]); |
851 | 851 | }, |
852 | 852 | [$ast1] |
853 | 853 | ), |
854 | 854 | array_reduce( |
855 | 855 | $conflicts, |
856 | - static function ($allFields, $conflict) { |
|
856 | + static function($allFields, $conflict) { |
|
857 | 857 | return array_merge($allFields, $conflict[2]); |
858 | 858 | }, |
859 | 859 | [$ast2] |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | { |
881 | 881 | if (is_array($reason)) { |
882 | 882 | $tmp = array_map( |
883 | - static function ($tmp) { |
|
883 | + static function($tmp) { |
|
884 | 884 | [$responseName, $subReason] = $tmp; |
885 | 885 | |
886 | 886 | $reasonMessage = self::reasonMessage($subReason); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public static function allRules() |
126 | 126 | { |
127 | - if (! self::$initRules) { |
|
127 | + if (!self::$initRules) { |
|
128 | 128 | static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); |
129 | 129 | static::$initRules = true; |
130 | 130 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | return is_array($value) |
265 | 265 | ? count(array_filter( |
266 | 266 | $value, |
267 | - static function ($item) { |
|
267 | + static function($item) { |
|
268 | 268 | return $item instanceof Throwable; |
269 | 269 | } |
270 | 270 | )) === count($value) |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | Utils::getVariableType($config) |
110 | 110 | ); |
111 | 111 | Utils::invariant( |
112 | - ! $config->types || is_array($config->types) || is_callable($config->types), |
|
112 | + !$config->types || is_array($config->types) || is_callable($config->types), |
|
113 | 113 | '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types) |
114 | 114 | ); |
115 | 115 | Utils::invariant( |
116 | - ! $config->directives || is_array($config->directives), |
|
116 | + !$config->directives || is_array($config->directives), |
|
117 | 117 | '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives) |
118 | 118 | ); |
119 | 119 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $types = $types(); |
166 | 166 | } |
167 | 167 | |
168 | - if (! is_array($types) && ! $types instanceof Traversable) { |
|
168 | + if (!is_array($types) && !$types instanceof Traversable) { |
|
169 | 169 | throw new InvariantViolation(sprintf( |
170 | 170 | 'Schema types callable must return array or instance of Traversable but got: %s', |
171 | 171 | Utils::getVariableType($types) |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | foreach ($types as $index => $type) { |
176 | - if (! $type instanceof Type) { |
|
176 | + if (!$type instanceof Type) { |
|
177 | 177 | throw new InvariantViolation(sprintf( |
178 | 178 | 'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s', |
179 | 179 | $index, |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function getTypeMap() |
198 | 198 | { |
199 | - if (! $this->fullyLoaded) { |
|
199 | + if (!$this->fullyLoaded) { |
|
200 | 200 | $this->resolvedTypes = $this->collectAllTypes(); |
201 | 201 | $this->fullyLoaded = true; |
202 | 202 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $typeMap = TypeInfo::extractTypes($type, $typeMap); |
215 | 215 | } |
216 | 216 | foreach ($this->getDirectives() as $directive) { |
217 | - if (! ($directive instanceof Directive)) { |
|
217 | + if (!($directive instanceof Directive)) { |
|
218 | 218 | continue; |
219 | 219 | } |
220 | 220 | |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function getType(string $name) : ?Type |
316 | 316 | { |
317 | - if (! isset($this->resolvedTypes[$name])) { |
|
317 | + if (!isset($this->resolvedTypes[$name])) { |
|
318 | 318 | $type = $this->loadType($name); |
319 | - if (! $type) { |
|
319 | + if (!$type) { |
|
320 | 320 | return null; |
321 | 321 | } |
322 | 322 | $this->resolvedTypes[$name] = $type; |
@@ -334,13 +334,13 @@ discard block |
||
334 | 334 | { |
335 | 335 | $typeLoader = $this->config->typeLoader; |
336 | 336 | |
337 | - if (! $typeLoader) { |
|
337 | + if (!$typeLoader) { |
|
338 | 338 | return $this->defaultTypeLoader($typeName); |
339 | 339 | } |
340 | 340 | |
341 | 341 | $type = $typeLoader($typeName); |
342 | 342 | |
343 | - if (! $type instanceof Type) { |
|
343 | + if (!$type instanceof Type) { |
|
344 | 344 | throw new InvariantViolation( |
345 | 345 | sprintf( |
346 | 346 | 'Type loader is expected to return valid type "%s", but it returned %s', |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | foreach ($this->getTypeMap() as $type) { |
396 | 396 | if ($type instanceof ObjectType) { |
397 | 397 | foreach ($type->getInterfaces() as $interface) { |
398 | - if (! ($interface instanceof InterfaceType)) { |
|
398 | + if (!($interface instanceof InterfaceType)) { |
|
399 | 399 | continue; |
400 | 400 | } |
401 | 401 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $type->assertValid(); |
482 | 482 | |
483 | 483 | // Make sure type loader returns the same instance as registered in other places of schema |
484 | - if (! $this->config->typeLoader) { |
|
484 | + if (!$this->config->typeLoader) { |
|
485 | 485 | continue; |
486 | 486 | } |
487 | 487 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function hasType(string $type) : bool |
81 | 81 | { |
82 | - return count(array_filter($this->getReferencedTypes(), static function (string $referencedType) use ($type) { |
|
82 | + return count(array_filter($this->getReferencedTypes(), static function(string $referencedType) use ($type) { |
|
83 | 83 | return $type === $referencedType; |
84 | 84 | })) > 0; |
85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function hasField(string $field) : bool |
96 | 96 | { |
97 | - return count(array_filter($this->getReferencedFields(), static function (string $referencedField) use ($field) { |
|
97 | + return count(array_filter($this->getReferencedFields(), static function(string $referencedField) use ($field) { |
|
98 | 98 | return $field === $referencedField; |
99 | 99 | })) > 0; |
100 | 100 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function subFields(string $typename) : array |
106 | 106 | { |
107 | - if (! array_key_exists($typename, $this->types)) { |
|
107 | + if (!array_key_exists($typename, $this->types)) { |
|
108 | 108 | return []; |
109 | 109 | } |
110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $implementors = []; |
121 | 121 | /** @var FieldNode $fieldNode */ |
122 | 122 | foreach ($fieldNodes as $fieldNode) { |
123 | - if (! $fieldNode->selectionSet) { |
|
123 | + if (!$fieldNode->selectionSet) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | private function mergeFields(Type $parentType, Type $type, array $fields, array $subfields, array &$implementors) : array |
230 | 230 | { |
231 | - if ($this->groupImplementorFields && $parentType instanceof AbstractType && ! $type instanceof AbstractType) { |
|
231 | + if ($this->groupImplementorFields && $parentType instanceof AbstractType && !$type instanceof AbstractType) { |
|
232 | 232 | $implementors[$type->name] = [ |
233 | 233 | 'type' => $type, |
234 | 234 | 'fields' => $this->arrayMergeDeep( |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | foreach ($array2 as $key => & $value) { |
270 | 270 | if (is_numeric($key)) { |
271 | - if (! in_array($value, $merged, true)) { |
|
271 | + if (!in_array($value, $merged, true)) { |
|
272 | 272 | $merged[] = $value; |
273 | 273 | } |
274 | 274 | } elseif (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { |
@@ -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 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (Type::isCompositeType($initialType)) { |
95 | 95 | $this->parentTypeStack[] = $initialType; |
96 | 96 | } |
97 | - if (! Type::isOutputType($initialType)) { |
|
97 | + if (!Type::isOutputType($initialType)) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public static function extractTypes($type, ?array $typeMap = null) |
151 | 151 | { |
152 | - if (! $typeMap) { |
|
152 | + if (!$typeMap) { |
|
153 | 153 | $typeMap = []; |
154 | 154 | } |
155 | - if (! $type) { |
|
155 | + if (!$type) { |
|
156 | 156 | return $typeMap; |
157 | 157 | } |
158 | 158 | |
159 | 159 | if ($type instanceof WrappingType) { |
160 | 160 | return self::extractTypes($type->getWrappedType(true), $typeMap); |
161 | 161 | } |
162 | - if (! $type instanceof Type) { |
|
162 | + if (!$type instanceof Type) { |
|
163 | 163 | // Preserve these invalid types in map (at numeric index) to make them |
164 | 164 | // detectable during $schema->validate() |
165 | 165 | $i = 0; |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | $alreadyInMap = $alreadyInMap || $typeMap[$i] === $type; |
169 | 169 | $i++; |
170 | 170 | } |
171 | - if (! $alreadyInMap) { |
|
171 | + if (!$alreadyInMap) { |
|
172 | 172 | $typeMap[$i] = $type; |
173 | 173 | } |
174 | 174 | |
175 | 175 | return $typeMap; |
176 | 176 | } |
177 | 177 | |
178 | - if (! empty($typeMap[$type->name])) { |
|
178 | + if (!empty($typeMap[$type->name])) { |
|
179 | 179 | Utils::invariant( |
180 | 180 | $typeMap[$type->name] === $type, |
181 | 181 | sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) . |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | } |
197 | 197 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
198 | 198 | foreach ($type->getFields() as $fieldName => $field) { |
199 | - if (! empty($field->args)) { |
|
199 | + if (!empty($field->args)) { |
|
200 | 200 | $fieldArgTypes = array_map( |
201 | - static function (FieldArgument $arg) { |
|
201 | + static function(FieldArgument $arg) { |
|
202 | 202 | return $arg->getType(); |
203 | 203 | }, |
204 | 204 | $field->args |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | /** @var FieldArgument $argDef */ |
324 | 324 | $argDef = Utils::find( |
325 | 325 | $fieldOrDirective->args, |
326 | - static function ($arg) use ($node) { |
|
326 | + static function($arg) use ($node) { |
|
327 | 327 | return $arg->name === $node->name->value; |
328 | 328 | } |
329 | 329 | ); |