@@ -27,8 +27,8 @@ |
||
27 | 27 | public function getASTVisitor(ASTValidationContext $context) |
28 | 28 | { |
29 | 29 | return [ |
30 | - 'enter' => static function (Node $node) use ($context) { |
|
31 | - if (! isset($node->directives)) { |
|
30 | + 'enter' => static function(Node $node) use ($context) { |
|
31 | + if (!isset($node->directives)) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | { |
20 | 20 | return [ |
21 | 21 | NodeKind::FIELD => [ |
22 | - 'leave' => static function (FieldNode $fieldNode) use ($context) { |
|
22 | + 'leave' => static function(FieldNode $fieldNode) use ($context) { |
|
23 | 23 | $fieldDef = $context->getFieldDef(); |
24 | 24 | |
25 | - if (! $fieldDef) { |
|
25 | + if (!$fieldDef) { |
|
26 | 26 | return Visitor::skipNode(); |
27 | 27 | } |
28 | 28 | $argNodes = $fieldNode->arguments ?: []; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | foreach ($fieldDef->args as $argDef) { |
35 | 35 | $argNode = $argNodeMap[$argDef->name] ?? null; |
36 | - if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
36 | + if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
37 | 37 | continue; |
38 | 38 | } |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | }, |
46 | 46 | ], |
47 | 47 | NodeKind::DIRECTIVE => [ |
48 | - 'leave' => static function (DirectiveNode $directiveNode) use ($context) { |
|
48 | + 'leave' => static function(DirectiveNode $directiveNode) use ($context) { |
|
49 | 49 | $directiveDef = $context->getDirective(); |
50 | - if (! $directiveDef) { |
|
50 | + if (!$directiveDef) { |
|
51 | 51 | return Visitor::skipNode(); |
52 | 52 | } |
53 | 53 | $argNodes = $directiveNode->arguments ?: []; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | foreach ($directiveDef->args as $argDef) { |
60 | 60 | $argNode = $argNodeMap[$argDef->name] ?? null; |
61 | - if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
61 | + if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $this->spreadPathIndexByName = []; |
42 | 42 | |
43 | 43 | return [ |
44 | - NodeKind::OPERATION_DEFINITION => static function () { |
|
44 | + NodeKind::OPERATION_DEFINITION => static function() { |
|
45 | 45 | return Visitor::skipNode(); |
46 | 46 | }, |
47 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) { |
|
47 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) use ($context) { |
|
48 | 48 | $this->detectCycleRecursive($node, $context); |
49 | 49 | |
50 | 50 | return Visitor::skipNode(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | private function detectCycleRecursive(FragmentDefinitionNode $fragment, ValidationContext $context) |
56 | 56 | { |
57 | - if (! empty($this->visitedFrags[$fragment->name->value])) { |
|
57 | + if (!empty($this->visitedFrags[$fragment->name->value])) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | } else { |
84 | 84 | $cyclePath = array_slice($this->spreadPath, $cycleIndex); |
85 | - $fragmentNames = Utils::map(array_slice($cyclePath, 0, -1), static function ($s) { |
|
85 | + $fragmentNames = Utils::map(array_slice($cyclePath, 0, -1), static function($s) { |
|
86 | 86 | return $s->name->value; |
87 | 87 | }); |
88 | 88 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | return sprintf( |
106 | 106 | 'Cannot spread fragment "%s" within itself%s.', |
107 | 107 | $fragName, |
108 | - ! empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
108 | + !empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | } |
@@ -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); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | public function getVisitor(ValidationContext $context) |
26 | 26 | { |
27 | 27 | return [ |
28 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use ($context) { |
|
28 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use ($context) { |
|
29 | 29 | /** @var FragmentDefinitionNode|OperationDefinitionNode|TypeSystemDefinitionNode $definition */ |
30 | 30 | foreach ($node->definitions as $definition) { |
31 | 31 | if ($definition instanceof OperationDefinitionNode || |
@@ -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) |
@@ -101,7 +101,7 @@ |
||
101 | 101 | if (self::$warningHandler !== null) { |
102 | 102 | $fn = self::$warningHandler; |
103 | 103 | $fn($errorMessage, $warningId, $messageLevel); |
104 | - } elseif ((self::$enableWarnings & $warningId) > 0 && ! isset(self::$warned[$warningId])) { |
|
104 | + } elseif ((self::$enableWarnings & $warningId) > 0 && !isset(self::$warned[$warningId])) { |
|
105 | 105 | self::$warned[$warningId] = true; |
106 | 106 | trigger_error($errorMessage, $messageLevel); |
107 | 107 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public static function runQueue() : void |
42 | 42 | { |
43 | 43 | $q = self::$queue; |
44 | - while ($q !== null && ! $q->isEmpty()) { |
|
44 | + while ($q !== null && !$q->isEmpty()) { |
|
45 | 45 | $task = $q->dequeue(); |
46 | 46 | $task(); |
47 | 47 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | } |
57 | 57 | if (is_object($value) && method_exists($value, 'then')) { |
58 | 58 | $value->then( |
59 | - function ($resolvedValue) { |
|
59 | + function($resolvedValue) { |
|
60 | 60 | $this->resolve($resolvedValue); |
61 | 61 | }, |
62 | - function ($reason) { |
|
62 | + function($reason) { |
|
63 | 63 | $this->reject($reason); |
64 | 64 | } |
65 | 65 | ); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function reject($reason) : self |
87 | 87 | { |
88 | - if (! $reason instanceof Throwable) { |
|
88 | + if (!$reason instanceof Throwable) { |
|
89 | 89 | throw new Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); |
90 | 90 | } |
91 | 91 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ); |
116 | 116 | |
117 | 117 | foreach ($this->waiting as $descriptor) { |
118 | - self::getQueue()->enqueue(function () use ($descriptor) { |
|
118 | + self::getQueue()->enqueue(function() use ($descriptor) { |
|
119 | 119 | /** @var self $promise */ |
120 | 120 | [$promise, $onFulfilled, $onRejected] = $descriptor; |
121 | 121 |
@@ -265,23 +265,23 @@ |
||
265 | 265 | ); |
266 | 266 | } elseif ($hasValue) { |
267 | 267 | if ($argumentValueNode instanceof NullValueNode) { |
268 | - // If the explicit value `null` was provided, an entry in the coerced |
|
269 | - // values must exist as the value `null`. |
|
268 | + // If the explicit value `null` was provided, an entry in the coerced |
|
269 | + // values must exist as the value `null`. |
|
270 | 270 | $coercedValues[$name] = null; |
271 | 271 | } elseif ($argumentValueNode instanceof VariableNode) { |
272 | 272 | $variableName = $argumentValueNode->name->value; |
273 | 273 | Utils::invariant($variableValues !== null, 'Must exist for hasValue to be true.'); |
274 | - // Note: This does no further checking that this variable is correct. |
|
275 | - // This assumes that this query has been validated and the variable |
|
276 | - // usage here is of the correct type. |
|
274 | + // Note: This does no further checking that this variable is correct. |
|
275 | + // This assumes that this query has been validated and the variable |
|
276 | + // usage here is of the correct type. |
|
277 | 277 | $coercedValues[$name] = $variableValues[$variableName] ?? null; |
278 | 278 | } else { |
279 | 279 | $valueNode = $argumentValueNode; |
280 | 280 | $coercedValue = AST::valueFromAST($valueNode, $argType, $variableValues); |
281 | 281 | if (Utils::isInvalid($coercedValue)) { |
282 | - // Note: ValuesOfCorrectType validation should catch this before |
|
283 | - // execution. This is a runtime check to ensure execution does not |
|
284 | - // continue with an invalid argument value. |
|
282 | + // Note: ValuesOfCorrectType validation should catch this before |
|
283 | + // execution. This is a runtime check to ensure execution does not |
|
284 | + // continue with an invalid argument value. |
|
285 | 285 | throw new Error( |
286 | 286 | 'Argument "' . $name . '" has invalid value ' . Printer::doPrint($valueNode) . '.', |
287 | 287 | [$argumentValueNode] |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** @var InputType|Type $varType */ |
68 | 68 | $varType = TypeInfo::typeFromAST($schema, $varDefNode->type); |
69 | 69 | |
70 | - if (! Type::isInputType($varType)) { |
|
70 | + if (!Type::isInputType($varType)) { |
|
71 | 71 | // Must use input types for variables. This should be caught during |
72 | 72 | // validation, however is checked again here for safety. |
73 | 73 | $errors[] = new Error( |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $hasValue = array_key_exists($varName, $inputs); |
83 | 83 | $value = $hasValue ? $inputs[$varName] : Utils::undefined(); |
84 | 84 | |
85 | - if (! $hasValue && $varDefNode->defaultValue) { |
|
85 | + if (!$hasValue && $varDefNode->defaultValue) { |
|
86 | 86 | // If no value was provided to a variable with a default value, |
87 | 87 | // use the default value. |
88 | 88 | $coercedValues[$varName] = AST::valueFromAST($varDefNode->defaultValue, $varType); |
89 | - } elseif ((! $hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
89 | + } elseif ((!$hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
90 | 90 | // If no value or a nullish value was provided to a variable with a |
91 | 91 | // non-null type (required), produce an error. |
92 | 92 | $errors[] = new Error( |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - if (! empty($errors)) { |
|
139 | + if (!empty($errors)) { |
|
140 | 140 | return [$errors, null]; |
141 | 141 | } |
142 | 142 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
161 | 161 | $directiveNode = Utils::find( |
162 | 162 | $node->directives, |
163 | - static function (DirectiveNode $directive) use ($directiveDef) { |
|
163 | + static function(DirectiveNode $directive) use ($directiveDef) { |
|
164 | 164 | return $directive->name->value === $directiveDef->name; |
165 | 165 | } |
166 | 166 | ); |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | $isNull = $argumentValueNode instanceof NullValueNode; |
234 | 234 | } |
235 | 235 | |
236 | - if (! $hasValue && $argumentDefinition->defaultValueExists()) { |
|
236 | + if (!$hasValue && $argumentDefinition->defaultValueExists()) { |
|
237 | 237 | // If no argument was provided where the definition has a default value, |
238 | 238 | // use the default value. |
239 | 239 | $coercedValues[$name] = $argumentDefinition->defaultValue; |
240 | - } elseif ((! $hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
240 | + } elseif ((!$hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
241 | 241 | // If no argument or a null value was provided to an argument with a |
242 | 242 | // non-null type (required), produce a field error. |
243 | 243 | if ($isNull) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | return $errors |
329 | 329 | ? array_map( |
330 | - static function (Throwable $error) { |
|
330 | + static function(Throwable $error) { |
|
331 | 331 | return $error->getMessage(); |
332 | 332 | }, |
333 | 333 | $errors |