@@ -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 | } |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | |
52 | 52 | return [ |
53 | 53 | NodeKind::FIELD => [ |
54 | - 'enter' => static function (FieldNode $node) use (&$fieldName) { |
|
54 | + 'enter' => static function(FieldNode $node) use (&$fieldName) { |
|
55 | 55 | $fieldName = $node->name->value; |
56 | 56 | }, |
57 | 57 | ], |
58 | - NodeKind::NULL => static function (NullValueNode $node) use ($context, &$fieldName) { |
|
58 | + NodeKind::NULL => static function(NullValueNode $node) use ($context, &$fieldName) { |
|
59 | 59 | $type = $context->getInputType(); |
60 | - if (! ($type instanceof NonNull)) { |
|
60 | + if (!($type instanceof NonNull)) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | ) |
69 | 69 | ); |
70 | 70 | }, |
71 | - NodeKind::LST => function (ListValueNode $node) use ($context, &$fieldName) { |
|
71 | + NodeKind::LST => function(ListValueNode $node) use ($context, &$fieldName) { |
|
72 | 72 | // Note: TypeInfo will traverse into a list's item type, so look to the |
73 | 73 | // parent input type to check if it is a list. |
74 | 74 | $type = Type::getNullableType($context->getParentInputType()); |
75 | - if (! $type instanceof ListOfType) { |
|
75 | + if (!$type instanceof ListOfType) { |
|
76 | 76 | $this->isValidScalar($context, $node, $fieldName); |
77 | 77 | |
78 | 78 | return Visitor::skipNode(); |
79 | 79 | } |
80 | 80 | }, |
81 | - NodeKind::OBJECT => function (ObjectValueNode $node) use ($context, &$fieldName) { |
|
81 | + NodeKind::OBJECT => function(ObjectValueNode $node) use ($context, &$fieldName) { |
|
82 | 82 | // Note: TypeInfo will traverse into a list's item type, so look to the |
83 | 83 | // parent input type to check if it is a list. |
84 | 84 | $type = Type::getNamedType($context->getInputType()); |
85 | - if (! $type instanceof InputObjectType) { |
|
85 | + if (!$type instanceof InputObjectType) { |
|
86 | 86 | $this->isValidScalar($context, $node, $fieldName); |
87 | 87 | |
88 | 88 | return Visitor::skipNode(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $nodeFields = iterator_to_array($node->fields); |
94 | 94 | $fieldNodeMap = array_combine( |
95 | 95 | array_map( |
96 | - static function ($field) { |
|
96 | + static function($field) { |
|
97 | 97 | return $field->name->value; |
98 | 98 | }, |
99 | 99 | $nodeFields |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ); |
103 | 103 | foreach ($inputFields as $fieldName => $fieldDef) { |
104 | 104 | $fieldType = $fieldDef->getType(); |
105 | - if (isset($fieldNodeMap[$fieldName]) || ! ($fieldType instanceof NonNull) || ($fieldDef->defaultValueExists())) { |
|
105 | + if (isset($fieldNodeMap[$fieldName]) || !($fieldType instanceof NonNull) || ($fieldDef->defaultValueExists())) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | ); |
115 | 115 | } |
116 | 116 | }, |
117 | - NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) use ($context) { |
|
117 | + NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) use ($context) { |
|
118 | 118 | $parentType = Type::getNamedType($context->getParentInputType()); |
119 | 119 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $fieldType */ |
120 | 120 | $fieldType = $context->getInputType(); |
121 | - if ($fieldType || ! ($parentType instanceof InputObjectType)) { |
|
121 | + if ($fieldType || !($parentType instanceof InputObjectType)) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $node->name->value, |
127 | 127 | array_keys($parentType->getFields()) |
128 | 128 | ); |
129 | - $didYouMean = $suggestions |
|
129 | + $didYouMean = $suggestions |
|
130 | 130 | ? 'Did you mean ' . Utils::orList($suggestions) . '?' |
131 | 131 | : null; |
132 | 132 | |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | ) |
138 | 138 | ); |
139 | 139 | }, |
140 | - NodeKind::ENUM => function (EnumValueNode $node) use ($context, &$fieldName) { |
|
140 | + NodeKind::ENUM => function(EnumValueNode $node) use ($context, &$fieldName) { |
|
141 | 141 | $type = Type::getNamedType($context->getInputType()); |
142 | - if (! $type instanceof EnumType) { |
|
142 | + if (!$type instanceof EnumType) { |
|
143 | 143 | $this->isValidScalar($context, $node, $fieldName); |
144 | - } elseif (! $type->getValue($node->value)) { |
|
144 | + } elseif (!$type->getValue($node->value)) { |
|
145 | 145 | $context->reportError( |
146 | 146 | new Error( |
147 | 147 | self::getBadValueMessage( |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | ); |
157 | 157 | } |
158 | 158 | }, |
159 | - NodeKind::INT => function (IntValueNode $node) use ($context, &$fieldName) { |
|
159 | + NodeKind::INT => function(IntValueNode $node) use ($context, &$fieldName) { |
|
160 | 160 | $this->isValidScalar($context, $node, $fieldName); |
161 | 161 | }, |
162 | - NodeKind::FLOAT => function (FloatValueNode $node) use ($context, &$fieldName) { |
|
162 | + NodeKind::FLOAT => function(FloatValueNode $node) use ($context, &$fieldName) { |
|
163 | 163 | $this->isValidScalar($context, $node, $fieldName); |
164 | 164 | }, |
165 | - NodeKind::STRING => function (StringValueNode $node) use ($context, &$fieldName) { |
|
165 | + NodeKind::STRING => function(StringValueNode $node) use ($context, &$fieldName) { |
|
166 | 166 | $this->isValidScalar($context, $node, $fieldName); |
167 | 167 | }, |
168 | - NodeKind::BOOLEAN => function (BooleanValueNode $node) use ($context, &$fieldName) { |
|
168 | + NodeKind::BOOLEAN => function(BooleanValueNode $node) use ($context, &$fieldName) { |
|
169 | 169 | $this->isValidScalar($context, $node, $fieldName); |
170 | 170 | }, |
171 | 171 | ]; |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $locationType */ |
187 | 187 | $locationType = $context->getInputType(); |
188 | 188 | |
189 | - if (! $locationType) { |
|
189 | + if (!$locationType) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | |
193 | 193 | $type = Type::getNamedType($locationType); |
194 | 194 | |
195 | - if (! $type instanceof ScalarType) { |
|
195 | + if (!$type instanceof ScalarType) { |
|
196 | 196 | $context->reportError( |
197 | 197 | new Error( |
198 | 198 | self::getBadValueMessage( |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $suggestions = Utils::suggestionList( |
240 | 240 | Printer::doPrint($node), |
241 | 241 | array_map( |
242 | - static function (EnumValueDefinition $value) { |
|
242 | + static function(EnumValueDefinition $value) { |
|
243 | 243 | return $value->name; |
244 | 244 | }, |
245 | 245 | $type->getValues() |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return $this->invokeIfNeeded( |
61 | 61 | $context, |
62 | 62 | [ |
63 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
63 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
64 | 64 | $this->fieldNodeAndDefs = $this->collectFieldASTsAndDefs( |
65 | 65 | $context, |
66 | 66 | $context->getParentType(), |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | $this->fieldNodeAndDefs |
70 | 70 | ); |
71 | 71 | }, |
72 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
72 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
73 | 73 | $this->variableDefs[] = $def; |
74 | 74 | |
75 | 75 | return Visitor::skipNode(); |
76 | 76 | }, |
77 | 77 | NodeKind::OPERATION_DEFINITION => [ |
78 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
78 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
79 | 79 | $errors = $context->getErrors(); |
80 | 80 | |
81 | - if (! empty($errors)) { |
|
81 | + if (!empty($errors)) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $this->variableDefs, |
192 | 192 | $this->getRawVariableValues() |
193 | 193 | ); |
194 | - if (! empty($errors)) { |
|
194 | + if (!empty($errors)) { |
|
195 | 195 | throw new Error(implode( |
196 | 196 | "\n\n", |
197 | 197 | array_map( |
198 | - static function ($error) { |
|
198 | + static function($error) { |
|
199 | 199 | return $error->getMessage(); |
200 | 200 | }, |
201 | 201 | $errors |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | /** @var bool $directiveArgsIf */ |
208 | 208 | $directiveArgsIf = Values::getArgumentValues($directive, $directiveNode, $variableValues)['if']; |
209 | 209 | |
210 | - return ! $directiveArgsIf; |
|
210 | + return !$directiveArgsIf; |
|
211 | 211 | } |
212 | 212 | if ($directiveNode->name->value === Directive::SKIP_NAME) { |
213 | 213 | $directive = Directive::skipDirective(); |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | $rawVariableValues |
250 | 250 | ); |
251 | 251 | |
252 | - if (! empty($errors)) { |
|
252 | + if (!empty($errors)) { |
|
253 | 253 | throw new Error(implode( |
254 | 254 | "\n\n", |
255 | 255 | array_map( |
256 | - static function ($error) { |
|
256 | + static function($error) { |
|
257 | 257 | return $error->getMessage(); |
258 | 258 | }, |
259 | 259 | $errors |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $schemaDefinitionsCount = 0; |
42 | 42 | |
43 | 43 | return [ |
44 | - NodeKind::SCHEMA_DEFINITION => static function (SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
44 | + NodeKind::SCHEMA_DEFINITION => static function(SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
45 | 45 | if ($alreadyDefined !== false) { |
46 | 46 | $context->reportError(new Error(self::canNotDefineSchemaWithinExtensionMessage(), $node)); |
47 | 47 |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | { |
33 | 33 | return [ |
34 | 34 | NodeKind::OPERATION_DEFINITION => [ |
35 | - 'enter' => function () { |
|
35 | + 'enter' => function() { |
|
36 | 36 | $this->varDefMap = []; |
37 | 37 | }, |
38 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
38 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
39 | 39 | $usages = $context->getRecursiveVariableUsages($operation); |
40 | 40 | |
41 | 41 | foreach ($usages as $usage) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $schema = $context->getSchema(); |
58 | 58 | $varType = TypeInfo::typeFromAST($schema, $varDef->type); |
59 | 59 | |
60 | - if (! $varType || $this->allowedVariableUsage($schema, $varType, $varDef->defaultValue, $type, $defaultValue)) { |
|
60 | + if (!$varType || $this->allowedVariableUsage($schema, $varType, $varDef->defaultValue, $type, $defaultValue)) { |
|
61 | 61 | continue; |
62 | 62 | } |
63 | 63 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | }, |
70 | 70 | ], |
71 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $varDefNode) { |
|
71 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $varDefNode) { |
|
72 | 72 | $this->varDefMap[$varDefNode->variable->name->value] = $varDefNode; |
73 | 73 | }, |
74 | 74 | ]; |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function allowedVariableUsage(Schema $schema, Type $varType, $varDefaultValue, Type $locationType, $locationDefaultValue) : bool |
102 | 102 | { |
103 | - if ($locationType instanceof NonNull && ! $varType instanceof NonNull) { |
|
104 | - $hasNonNullVariableDefaultValue = $varDefaultValue && ! $varDefaultValue instanceof NullValueNode; |
|
105 | - $hasLocationDefaultValue = ! Utils::isInvalid($locationDefaultValue); |
|
106 | - if (! $hasNonNullVariableDefaultValue && ! $hasLocationDefaultValue) { |
|
103 | + if ($locationType instanceof NonNull && !$varType instanceof NonNull) { |
|
104 | + $hasNonNullVariableDefaultValue = $varDefaultValue && !$varDefaultValue instanceof NullValueNode; |
|
105 | + $hasLocationDefaultValue = !Utils::isInvalid($locationDefaultValue); |
|
106 | + if (!$hasNonNullVariableDefaultValue && !$hasLocationDefaultValue) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | $nullableLocationType = $locationType->getWrappedType(); |
@@ -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 | } |