@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return $coercedValues; |
58 | 58 | } |
59 | 59 | |
60 | - $argumentNodeMap = keyMap($argumentNodes, function (ArgumentNode $value) { |
|
60 | + $argumentNodeMap = keyMap($argumentNodes, function(ArgumentNode $value) { |
|
61 | 61 | return $value->getNameValue(); |
62 | 62 | }); |
63 | 63 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | array $variableValues = [] |
131 | 131 | ): ?array { |
132 | 132 | $directiveNode = $node->hasDirectives() |
133 | - ? find($node->getDirectives(), function (NameAwareInterface $value) use ($directive) { |
|
133 | + ? find($node->getDirectives(), function(NameAwareInterface $value) use ($directive) { |
|
134 | 134 | return $value->getNameValue() === $directive->getName(); |
135 | 135 | }) : null; |
136 | 136 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | ]); |
331 | 331 | } |
332 | 332 | return new CoercedValue($parseResult, null); |
333 | - } catch (InvalidTypeException|CoercingException $ex) { |
|
333 | + } catch (InvalidTypeException | CoercingException $ex) { |
|
334 | 334 | return new CoercedValue(null, [ |
335 | 335 | $this->buildCoerceException( |
336 | 336 | sprintf('Expected type %s', (string)$type), |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | return new CoercedValue($enumValue, null); |
362 | 362 | } |
363 | 363 | |
364 | - $suggestions = suggestionList((string)$value, \array_map(function (EnumValue $enumValue) { |
|
364 | + $suggestions = suggestionList((string)$value, \array_map(function(EnumValue $enumValue) { |
|
365 | 365 | return $enumValue->getName(); |
366 | 366 | }, $type->getValues())); |
367 | 367 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function getOperationTypesAST(): array |
43 | 43 | { |
44 | - return \array_map(function (OperationTypeDefinitionNode $node) { |
|
44 | + return \array_map(function(OperationTypeDefinitionNode $node) { |
|
45 | 45 | return $node->toAST(); |
46 | 46 | }, $this->operationTypes); |
47 | 47 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @return TypeNodeInterface |
324 | 324 | */ |
325 | - $parseType = function (): TypeNodeInterface { |
|
325 | + $parseType = function(): TypeNodeInterface { |
|
326 | 326 | $this->expect(TokenKindEnum::COLON); |
327 | 327 | return $this->lexType(); |
328 | 328 | }; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | /** |
434 | 434 | * @return ArgumentNode |
435 | 435 | */ |
436 | - $parseFunction = function () use ($isConst): ArgumentNode { |
|
436 | + $parseFunction = function() use ($isConst) : ArgumentNode { |
|
437 | 437 | return $this->lexArgument($isConst); |
438 | 438 | }; |
439 | 439 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | /** |
461 | 461 | * @return NodeInterface|TypeNodeInterface|ValueNodeInterface |
462 | 462 | */ |
463 | - $parseValue = function () use ($isConst): NodeInterface { |
|
463 | + $parseValue = function() use ($isConst): NodeInterface { |
|
464 | 464 | $this->expect(TokenKindEnum::COLON); |
465 | 465 | return $this->lexValue($isConst); |
466 | 466 | }; |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | |
530 | 530 | $this->expectKeyword(KeywordEnum::FRAGMENT); |
531 | 531 | |
532 | - $parseTypeCondition = function () { |
|
532 | + $parseTypeCondition = function() { |
|
533 | 533 | $this->expectKeyword(KeywordEnum::ON); |
534 | 534 | return $this->lexNamedType(); |
535 | 535 | }; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | { |
660 | 660 | $start = $this->lexer->getToken(); |
661 | 661 | |
662 | - $parseFunction = function () use ($isConst) { |
|
662 | + $parseFunction = function() use ($isConst) { |
|
663 | 663 | return $this->lexValue($isConst); |
664 | 664 | }; |
665 | 665 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * @param bool $isConst |
713 | 713 | * @return NodeInterface|TypeNodeInterface|ValueNodeInterface |
714 | 714 | */ |
715 | - $parseValue = function (bool $isConst): NodeInterface { |
|
715 | + $parseValue = function(bool $isConst): NodeInterface { |
|
716 | 716 | $this->expect(TokenKindEnum::COLON); |
717 | 717 | return $this->lexValue($isConst); |
718 | 718 | }; |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | protected function lexArgumentsDefinition(): array |
1055 | 1055 | { |
1056 | - $parseFunction = function (): InputValueDefinitionNode { |
|
1056 | + $parseFunction = function(): InputValueDefinitionNode { |
|
1057 | 1057 | return $this->lexInputValueDefinition(); |
1058 | 1058 | }; |
1059 | 1059 | |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | */ |
1260 | 1260 | protected function lexInputFieldsDefinition(): array |
1261 | 1261 | { |
1262 | - $parseFunction = function (): InputValueDefinitionNode { |
|
1262 | + $parseFunction = function(): InputValueDefinitionNode { |
|
1263 | 1263 | return $this->lexInputValueDefinition(); |
1264 | 1264 | }; |
1265 | 1265 | |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | |
1328 | 1328 | $directives = $this->lexDirectives(true); |
1329 | 1329 | |
1330 | - $parseFunction = function (): OperationTypeDefinitionNode { |
|
1330 | + $parseFunction = function(): OperationTypeDefinitionNode { |
|
1331 | 1331 | return $this->lexOperationTypeDefinition(); |
1332 | 1332 | }; |
1333 | 1333 | |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | $name = $this->lexName(); |
1603 | 1603 | |
1604 | - if (arraySome(DirectiveLocationEnum::values(), function ($value) use ($name) { |
|
1604 | + if (arraySome(DirectiveLocationEnum::values(), function($value) use ($name) { |
|
1605 | 1605 | return $name->getValue() === $value; |
1606 | 1606 | })) { |
1607 | 1607 | return $name; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function buildTypes(array $nodes): array |
109 | 109 | { |
110 | - return \array_map(function (NamedTypeNodeInterface $node) { |
|
110 | + return \array_map(function(NamedTypeNodeInterface $node) { |
|
111 | 111 | return $this->buildType($node); |
112 | 112 | }, $nodes); |
113 | 113 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $directive = newDirective([ |
154 | 154 | 'name' => $node->getNameValue(), |
155 | 155 | 'description' => $node->getDescriptionValue(), |
156 | - 'locations' => \array_map(function (NameNode $node) { |
|
156 | + 'locations' => \array_map(function(NameNode $node) { |
|
157 | 157 | return $node->getValue(); |
158 | 158 | }, $node->getLocations()), |
159 | 159 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | $typesMap = keyMap( |
223 | 223 | \array_merge($customTypes, specifiedScalarTypes(), introspectionTypes()), |
224 | - function (NamedTypeInterface $type) { |
|
224 | + function(NamedTypeInterface $type) { |
|
225 | 225 | return $type->getName(); |
226 | 226 | } |
227 | 227 | ); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $directivesMap = keyMap( |
240 | 240 | \array_merge($customDirectives, specifiedDirectives()), |
241 | - function (Directive $directive) { |
|
241 | + function(Directive $directive) { |
|
242 | 242 | return $directive->getName(); |
243 | 243 | } |
244 | 244 | ); |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | { |
258 | 258 | return keyValueMap( |
259 | 259 | $nodes, |
260 | - function (InputValueDefinitionNode $value) { |
|
260 | + function(InputValueDefinitionNode $value) { |
|
261 | 261 | return $value->getNameValue(); |
262 | 262 | }, |
263 | - function (InputValueDefinitionNode $value): array { |
|
263 | + function(InputValueDefinitionNode $value): array { |
|
264 | 264 | $type = $this->buildWrappedType($value->getType()); |
265 | 265 | $defaultValue = $value->getDefaultValue(); |
266 | 266 | return [ |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | return newObjectType([ |
315 | 315 | 'name' => $node->getNameValue(), |
316 | 316 | 'description' => $node->getDescriptionValue(), |
317 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
317 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
318 | 318 | return $this->buildFields($node); |
319 | 319 | } : [], |
320 | 320 | // Note: While this could make early assertions to get the correctly |
321 | 321 | // typed values, that would throw immediately while type system |
322 | 322 | // validation with validateSchema() will produce more actionable results. |
323 | - 'interfaces' => function () use ($node) { |
|
324 | - return $node->hasInterfaces() ? \array_map(function (NamedTypeNodeInterface $interface) { |
|
323 | + 'interfaces' => function() use ($node) { |
|
324 | + return $node->hasInterfaces() ? \array_map(function(NamedTypeNodeInterface $interface) { |
|
325 | 325 | return $this->buildType($interface); |
326 | 326 | }, $node->getInterfaces()) : []; |
327 | 327 | }, |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | { |
338 | 338 | return keyValueMap( |
339 | 339 | $node->getFields(), |
340 | - function ($value) { |
|
340 | + function($value) { |
|
341 | 341 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
342 | 342 | return $value->getNameValue(); |
343 | 343 | }, |
344 | - function ($value) use ($node) { |
|
344 | + function($value) use ($node) { |
|
345 | 345 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
346 | 346 | return $this->buildField($value, |
347 | 347 | $this->getFieldResolver($node->getNameValue(), $value->getNameValue())); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | return newInterfaceType([ |
372 | 372 | 'name' => $node->getNameValue(), |
373 | 373 | 'description' => $node->getDescriptionValue(), |
374 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
374 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
375 | 375 | return $this->buildFields($node); |
376 | 376 | } : [], |
377 | 377 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | 'description' => $node->getDescriptionValue(), |
392 | 392 | 'values' => $node->hasValues() ? keyValueMap( |
393 | 393 | $node->getValues(), |
394 | - function (EnumValueDefinitionNode $value): ?string { |
|
394 | + function(EnumValueDefinitionNode $value): ?string { |
|
395 | 395 | return $value->getNameValue(); |
396 | 396 | }, |
397 | - function (EnumValueDefinitionNode $value): array { |
|
397 | + function(EnumValueDefinitionNode $value): array { |
|
398 | 398 | return [ |
399 | 399 | 'description' => $value->getDescriptionValue(), |
400 | 400 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | return newUnionType([ |
417 | 417 | 'name' => $node->getNameValue(), |
418 | 418 | 'description' => $node->getDescriptionValue(), |
419 | - 'types' => $node->hasTypes() ? \array_map(function (NamedTypeNodeInterface $type) { |
|
419 | + 'types' => $node->hasTypes() ? \array_map(function(NamedTypeNodeInterface $type) { |
|
420 | 420 | return $this->buildType($type); |
421 | 421 | }, $node->getTypes()) : [], |
422 | 422 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | return newScalarType([ |
446 | 446 | 'name' => $node->getNameValue(), |
447 | 447 | 'description' => $node->getDescriptionValue(), |
448 | - 'serialize' => function ($value) { |
|
448 | + 'serialize' => function($value) { |
|
449 | 449 | return $value; |
450 | 450 | }, |
451 | 451 | 'astNode' => $node, |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | return newInputObjectType([ |
463 | 463 | 'name' => $node->getNameValue(), |
464 | 464 | 'description' => $node->getDescriptionValue(), |
465 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
465 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
466 | 466 | return keyValueMap( |
467 | 467 | $node->getFields(), |
468 | - function (InputValueDefinitionNode $value): ?string { |
|
468 | + function(InputValueDefinitionNode $value): ?string { |
|
469 | 469 | return $value->getNameValue(); |
470 | 470 | }, |
471 | - function (InputValueDefinitionNode $value): array { |
|
471 | + function(InputValueDefinitionNode $value): array { |
|
472 | 472 | $type = $this->buildWrappedType($value->getType()); |
473 | 473 | $defaultValue = $value->getDefaultValue(); |
474 | 474 | return [ |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function buildTypes(): array |
79 | 79 | { |
80 | - return \array_map(function (NamedTypeNodeInterface $definition) { |
|
80 | + return \array_map(function(NamedTypeNodeInterface $definition) { |
|
81 | 81 | return $this->definitionBuilder->buildType($definition); |
82 | 82 | }, \array_values($this->info->getTypeDefinitionMap())); |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function buildDirectives(): array |
89 | 89 | { |
90 | - $directives = \array_map(function (DirectiveDefinitionNode $definition) { |
|
90 | + $directives = \array_map(function(DirectiveDefinitionNode $definition) { |
|
91 | 91 | return $this->definitionBuilder->buildDirective($definition); |
92 | 92 | }, $this->info->getDirectiveDefinitions()); |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ]; |
99 | 99 | |
100 | 100 | foreach ($specifiedDirectivesMap as $name => $directive) { |
101 | - if (!arraySome($directives, function (Directive $directive) use ($name) { |
|
101 | + if (!arraySome($directives, function(Directive $directive) use ($name) { |
|
102 | 102 | return $directive->getName() === $name; |
103 | 103 | })) { |
104 | 104 | $directives[] = $directive; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $promise = new FulfilledPromise([]); |
172 | 172 | |
173 | - $resolve = function ($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) { |
|
173 | + $resolve = function($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) { |
|
174 | 174 | $fieldPath = $path; |
175 | 175 | $fieldPath[] = $fieldName; |
176 | 176 | try { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | if ($this->isPromise($result)) { |
183 | 183 | /** @var ExtendedPromiseInterface $result */ |
184 | - return $result->then(function ($resolvedResult) use ($fieldName, $results) { |
|
184 | + return $result->then(function($resolvedResult) use ($fieldName, $results) { |
|
185 | 185 | $results[$fieldName] = $resolvedResult; |
186 | 186 | return $results; |
187 | 187 | }); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | }; |
194 | 194 | |
195 | 195 | foreach ($fields as $fieldName => $fieldNodes) { |
196 | - $promise = $promise->then(function ($resolvedResults) use ( |
|
196 | + $promise = $promise->then(function($resolvedResults) use ( |
|
197 | 197 | $resolve, |
198 | 198 | $fieldName, |
199 | 199 | $path, |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | }); |
206 | 206 | } |
207 | 207 | |
208 | - $promise->then(function ($resolvedResults) use (&$finalResults) { |
|
208 | + $promise->then(function($resolvedResults) use (&$finalResults) { |
|
209 | 209 | $finalResults = $resolvedResults ?? []; |
210 | - })->otherwise(function ($ex) { |
|
210 | + })->otherwise(function($ex) { |
|
211 | 211 | $this->context->addError($ex); |
212 | 212 | }); |
213 | 213 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($this->isPromise($completed)) { |
285 | 285 | $context = $this->context; |
286 | 286 | /** @var ExtendedPromiseInterface $completed */ |
287 | - return $completed->then(null, function ($error) use ($context, $fieldNodes, $path) { |
|
287 | + return $completed->then(null, function($error) use ($context, $fieldNodes, $path) { |
|
288 | 288 | //@TODO Handle $error better |
289 | 289 | if ($error instanceof \Exception) { |
290 | 290 | $context->addError($this->buildLocatedError($error, $fieldNodes, $path)); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $keys = \array_keys($finalResults); |
379 | 379 | $promise = promiseAll(\array_values($finalResults)); |
380 | 380 | |
381 | - $promise->then(function ($values) use ($keys, &$finalResults) { |
|
381 | + $promise->then(function($values) use ($keys, &$finalResults) { |
|
382 | 382 | /** @noinspection ForeachSourceInspection */ |
383 | 383 | foreach ($values as $i => $value) { |
384 | 384 | $finalResults[$keys[$i]] = $value; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | ) { |
477 | 477 | if ($this->isPromise($result)) { |
478 | 478 | /** @var ExtendedPromiseInterface $result */ |
479 | - return $result->then(function (&$value) use ($returnType, $fieldNodes, $info, $path) { |
|
479 | + return $result->then(function(&$value) use ($returnType, $fieldNodes, $info, $path) { |
|
480 | 480 | return $this->completeValue($returnType, $fieldNodes, $info, $path, $value); |
481 | 481 | }); |
482 | 482 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | |
565 | 565 | if ($this->isPromise($runtimeType)) { |
566 | 566 | /** @var ExtendedPromiseInterface $runtimeType */ |
567 | - return $runtimeType->then(function ($resolvedRuntimeType) use ( |
|
567 | + return $runtimeType->then(function($resolvedRuntimeType) use ( |
|
568 | 568 | $returnType, |
569 | 569 | $fieldNodes, |
570 | 570 | $info, |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | |
693 | 693 | if (!empty($promisedIsTypeOfResults)) { |
694 | 694 | return promiseAll($promisedIsTypeOfResults) |
695 | - ->then(function ($isTypeOfResults) use ($possibleTypes) { |
|
695 | + ->then(function($isTypeOfResults) use ($possibleTypes) { |
|
696 | 696 | /** @noinspection ForeachSourceInspection */ |
697 | 697 | foreach ($isTypeOfResults as $index => $result) { |
698 | 698 | if ($result) { |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | public function register() |
35 | 35 | { |
36 | 36 | $this->container |
37 | - ->share(GraphQL::BOOLEAN, function (BooleanCoercer $coercer) { |
|
37 | + ->share(GraphQL::BOOLEAN, function(BooleanCoercer $coercer) { |
|
38 | 38 | return newScalarType([ |
39 | 39 | 'name' => TypeNameEnum::BOOLEAN, |
40 | 40 | 'description' => 'The `Boolean` scalar type represents `true` or `false`.', |
41 | - 'serialize' => function ($value) use ($coercer) { |
|
41 | + 'serialize' => function($value) use ($coercer) { |
|
42 | 42 | return $coercer->coerce($value); |
43 | 43 | }, |
44 | - 'parseValue' => function ($value) use ($coercer) { |
|
44 | + 'parseValue' => function($value) use ($coercer) { |
|
45 | 45 | return $coercer->coerce($value); |
46 | 46 | }, |
47 | - 'parseLiteral' => function (NodeInterface $node) { |
|
47 | + 'parseLiteral' => function(NodeInterface $node) { |
|
48 | 48 | if ($node instanceof BooleanValueNode) { |
49 | 49 | return $node->getValue(); |
50 | 50 | } |
@@ -55,20 +55,20 @@ discard block |
||
55 | 55 | ->addArgument(BooleanCoercer::class); |
56 | 56 | |
57 | 57 | $this->container |
58 | - ->share(GraphQL::FLOAT, function (FloatCoercer $coercer) { |
|
58 | + ->share(GraphQL::FLOAT, function(FloatCoercer $coercer) { |
|
59 | 59 | return newScalarType([ |
60 | 60 | 'name' => TypeNameEnum::FLOAT, |
61 | 61 | 'description' => |
62 | 62 | 'The `Float` scalar type represents signed double-precision fractional ' . |
63 | 63 | 'values as specified by ' . |
64 | 64 | '[IEEE 754](https://en.wikipedia.org/wiki/IEEE_754).', |
65 | - 'serialize' => function ($value) use ($coercer) { |
|
65 | + 'serialize' => function($value) use ($coercer) { |
|
66 | 66 | return $coercer->coerce($value); |
67 | 67 | }, |
68 | - 'parseValue' => function ($value) use ($coercer) { |
|
68 | + 'parseValue' => function($value) use ($coercer) { |
|
69 | 69 | return $coercer->coerce($value); |
70 | 70 | }, |
71 | - 'parseLiteral' => function (NodeInterface $node) { |
|
71 | + 'parseLiteral' => function(NodeInterface $node) { |
|
72 | 72 | if ($node instanceof FloatValueNode || $node instanceof IntValueNode) { |
73 | 73 | return $node->getValue(); |
74 | 74 | } |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | ->addArgument(FloatCoercer::class); |
80 | 80 | |
81 | 81 | $this->container |
82 | - ->share(GraphQL::INT, function (IntCoercer $coercer) { |
|
82 | + ->share(GraphQL::INT, function(IntCoercer $coercer) { |
|
83 | 83 | return newScalarType([ |
84 | 84 | 'name' => TypeNameEnum::INT, |
85 | 85 | 'description' => |
86 | 86 | 'The `Int` scalar type represents non-fractional signed whole numeric ' . |
87 | 87 | 'values. Int can represent values between -(2^31) and 2^31 - 1.', |
88 | - 'serialize' => function ($value) use ($coercer) { |
|
88 | + 'serialize' => function($value) use ($coercer) { |
|
89 | 89 | return $coercer->coerce($value); |
90 | 90 | }, |
91 | - 'parseValue' => function ($value) use ($coercer) { |
|
91 | + 'parseValue' => function($value) use ($coercer) { |
|
92 | 92 | return $coercer->coerce($value); |
93 | 93 | }, |
94 | - 'parseLiteral' => function (NodeInterface $node) { |
|
94 | + 'parseLiteral' => function(NodeInterface $node) { |
|
95 | 95 | if ($node instanceof IntValueNode) { |
96 | 96 | $value = (int)$node->getValue(); |
97 | 97 | if ((string)$node->getValue() === (string)$value && |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ->addArgument(IntCoercer::class); |
107 | 107 | |
108 | 108 | $this->container |
109 | - ->share(GraphQL::ID, function (StringCoercer $coercer) { |
|
109 | + ->share(GraphQL::ID, function(StringCoercer $coercer) { |
|
110 | 110 | return newScalarType([ |
111 | 111 | 'name' => TypeNameEnum::ID, |
112 | 112 | 'description' => |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | 'response as a String; however, it is not intended to be human-readable. ' . |
116 | 116 | 'When expected as an input type, any string (such as `"4"`) or integer ' . |
117 | 117 | '(such as `4`) input value will be accepted as an ID.', |
118 | - 'serialize' => function ($value) use ($coercer) { |
|
118 | + 'serialize' => function($value) use ($coercer) { |
|
119 | 119 | return $coercer->coerce($value); |
120 | 120 | }, |
121 | - 'parseValue' => function ($value) use ($coercer) { |
|
121 | + 'parseValue' => function($value) use ($coercer) { |
|
122 | 122 | return $coercer->coerce($value); |
123 | 123 | }, |
124 | - 'parseLiteral' => function (NodeInterface $node) { |
|
124 | + 'parseLiteral' => function(NodeInterface $node) { |
|
125 | 125 | if ($node instanceof StringValueNode || $node instanceof IntValueNode) { |
126 | 126 | return $node->getValue(); |
127 | 127 | } |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | ->addArgument(StringCoercer::class); |
133 | 133 | |
134 | 134 | $this->container |
135 | - ->share(GraphQL::STRING, function (StringCoercer $coercer) { |
|
135 | + ->share(GraphQL::STRING, function(StringCoercer $coercer) { |
|
136 | 136 | return newScalarType([ |
137 | 137 | 'name' => TypeNameEnum::STRING, |
138 | 138 | 'description' => |
139 | 139 | 'The `String` scalar type represents textual data, represented as UTF-8 ' . |
140 | 140 | 'character sequences. The String type is most often used by GraphQL to ' . |
141 | 141 | 'represent free-form human-readable text.', |
142 | - 'serialize' => function ($value) use ($coercer) { |
|
142 | + 'serialize' => function($value) use ($coercer) { |
|
143 | 143 | return $coercer->coerce($value); |
144 | 144 | }, |
145 | - 'parseValue' => function ($value) use ($coercer) { |
|
145 | + 'parseValue' => function($value) use ($coercer) { |
|
146 | 146 | return $coercer->coerce($value); |
147 | 147 | }, |
148 | - 'parseLiteral' => function (NodeInterface $node) { |
|
148 | + 'parseLiteral' => function(NodeInterface $node) { |
|
149 | 149 | if ($node instanceof StringValueNode) { |
150 | 150 | return $node->getValue(); |
151 | 151 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | protected function registerIntrospectionTypes() |
59 | 59 | { |
60 | 60 | $this->container |
61 | - ->share(GraphQL::SCHEMA_INTROSPECTION, function () { |
|
61 | + ->share(GraphQL::SCHEMA_INTROSPECTION, function() { |
|
62 | 62 | return newObjectType([ |
63 | 63 | 'name' => GraphQL::SCHEMA_INTROSPECTION, |
64 | 64 | 'isIntrospection' => true, |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
67 | 67 | 'exposes all available types and directives on the server, as well as ' . |
68 | 68 | 'the entry points for query, mutation, and subscription operations.', |
69 | - 'fields' => function () { |
|
69 | + 'fields' => function() { |
|
70 | 70 | return [ |
71 | 71 | 'types' => [ |
72 | 72 | 'description' => 'A list of all types supported by this server.', |
73 | 73 | 'type' => newNonNull(newList(newNonNull(__Type()))), |
74 | - 'resolve' => function (Schema $schema): array { |
|
74 | + 'resolve' => function(Schema $schema): array { |
|
75 | 75 | return \array_values($schema->getTypeMap()); |
76 | 76 | }, |
77 | 77 | ], |
78 | 78 | 'queryType' => [ |
79 | 79 | 'description' => 'The type that query operations will be rooted at.', |
80 | 80 | 'type' => newNonNull(__Type()), |
81 | - 'resolve' => function (Schema $schema): ?TypeInterface { |
|
81 | + 'resolve' => function(Schema $schema): ?TypeInterface { |
|
82 | 82 | return $schema->getQueryType(); |
83 | 83 | }, |
84 | 84 | ], |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'If this server supports mutation, the type that ' . |
88 | 88 | 'mutation operations will be rooted at.', |
89 | 89 | 'type' => __Type(), |
90 | - 'resolve' => function (Schema $schema): ?TypeInterface { |
|
90 | + 'resolve' => function(Schema $schema): ?TypeInterface { |
|
91 | 91 | return $schema->getMutationType(); |
92 | 92 | }, |
93 | 93 | ], |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | 'If this server support subscription, the type that ' . |
97 | 97 | 'subscription operations will be rooted at.', |
98 | 98 | 'type' => __Type(), |
99 | - 'resolve' => function (Schema $schema): ?TypeInterface { |
|
99 | + 'resolve' => function(Schema $schema): ?TypeInterface { |
|
100 | 100 | return $schema->getSubscriptionType(); |
101 | 101 | }, |
102 | 102 | ], |
103 | 103 | 'directives' => [ |
104 | 104 | 'description' => 'A list of all directives supported by this server.', |
105 | 105 | 'type' => newNonNull(newList(newNonNull(__Directive()))), |
106 | - 'resolve' => function (Schema $schema): array { |
|
106 | + 'resolve' => function(Schema $schema): array { |
|
107 | 107 | return $schema->getDirectives(); |
108 | 108 | }, |
109 | 109 | ], |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | }); |
114 | 114 | |
115 | 115 | $this->container |
116 | - ->share(GraphQL::DIRECTIVE_INTROSPECTION, function () { |
|
116 | + ->share(GraphQL::DIRECTIVE_INTROSPECTION, function() { |
|
117 | 117 | return newObjectType([ |
118 | 118 | 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
119 | 119 | 'isIntrospection' => true, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'execution behavior in ways field arguments will not suffice, such as ' . |
125 | 125 | 'conditionally including or skipping a field. Directives provide this by ' . |
126 | 126 | 'describing additional information to the executor.', |
127 | - 'fields' => function () { |
|
127 | + 'fields' => function() { |
|
128 | 128 | return [ |
129 | 129 | 'name' => ['type' => newNonNull(stringType())], |
130 | 130 | 'description' => ['type' => stringType()], |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ], |
134 | 134 | 'args' => [ |
135 | 135 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
136 | - 'resolve' => function (Directive $directive): array { |
|
136 | + 'resolve' => function(Directive $directive): array { |
|
137 | 137 | return $directive->getArguments() ?: []; |
138 | 138 | }, |
139 | 139 | ], |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | }); |
144 | 144 | |
145 | 145 | $this->container |
146 | - ->share(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function () { |
|
146 | + ->share(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function() { |
|
147 | 147 | return newEnumType([ |
148 | 148 | 'name' => GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
149 | 149 | 'isIntrospection' => true, |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | }); |
211 | 211 | |
212 | 212 | $this->container |
213 | - ->share(GraphQL::TYPE_INTROSPECTION, function () { |
|
213 | + ->share(GraphQL::TYPE_INTROSPECTION, function() { |
|
214 | 214 | return newObjectType([ |
215 | 215 | 'name' => GraphQL::TYPE_INTROSPECTION, |
216 | 216 | 'isIntrospection' => true, |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | 'Object and Interface types provide the fields they describe. Abstract ' . |
224 | 224 | 'types, Union and Interface, provide the Object types possible ' . |
225 | 225 | 'at runtime. List and NonNull types compose other types.', |
226 | - 'fields' => function () { |
|
226 | + 'fields' => function() { |
|
227 | 227 | return [ |
228 | 228 | 'kind' => [ |
229 | 229 | 'type' => newNonNull(__TypeKind()), |
230 | - 'resolve' => function (TypeInterface $type) { |
|
230 | + 'resolve' => function(TypeInterface $type) { |
|
231 | 231 | if ($type instanceof ScalarType) { |
232 | 232 | return TypeKindEnum::SCALAR; |
233 | 233 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | 'args' => [ |
264 | 264 | 'includeDeprecated' => ['type' => booleanType(), 'defaultValue' => false], |
265 | 265 | ], |
266 | - 'resolve' => function (TypeInterface $type, array $args): |
|
266 | + 'resolve' => function(TypeInterface $type, array $args): |
|
267 | 267 | ?array { |
268 | 268 | ['includeDeprecated' => $includeDeprecated] = $args; |
269 | 269 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $fields = \array_values($type->getFields()); |
272 | 272 | |
273 | 273 | if (!$includeDeprecated) { |
274 | - $fields = \array_filter($fields, function (Field $field) { |
|
274 | + $fields = \array_filter($fields, function(Field $field) { |
|
275 | 275 | return !$field->isDeprecated(); |
276 | 276 | }); |
277 | 277 | } |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | ], |
285 | 285 | 'interfaces' => [ |
286 | 286 | 'type' => newList(newNonNull(__Type())), |
287 | - 'resolve' => function (TypeInterface $type): ?array { |
|
287 | + 'resolve' => function(TypeInterface $type): ?array { |
|
288 | 288 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
289 | 289 | }, |
290 | 290 | ], |
291 | 291 | 'possibleTypes' => [ |
292 | 292 | 'type' => newList(newNonNull(__Type())), |
293 | - 'resolve' => function ( |
|
293 | + 'resolve' => function( |
|
294 | 294 | TypeInterface $type, |
295 | 295 | array $args, |
296 | 296 | array $context, |
@@ -308,14 +308,14 @@ discard block |
||
308 | 308 | 'args' => [ |
309 | 309 | 'includeDeprecated' => ['type' => booleanType(), 'defaultValue' => false], |
310 | 310 | ], |
311 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
311 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
312 | 312 | ['includeDeprecated' => $includeDeprecated] = $args; |
313 | 313 | |
314 | 314 | if ($type instanceof EnumType) { |
315 | 315 | $values = \array_values($type->getValues()); |
316 | 316 | |
317 | 317 | if (!$includeDeprecated) { |
318 | - $values = \array_filter($values, function (Field $field) { |
|
318 | + $values = \array_filter($values, function(Field $field) { |
|
319 | 319 | return !$field->isDeprecated(); |
320 | 320 | }); |
321 | 321 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ], |
329 | 329 | 'inputFields' => [ |
330 | 330 | 'type' => newList(newNonNull(__InputValue())), |
331 | - 'resolve' => function (TypeInterface $type): ?array { |
|
331 | + 'resolve' => function(TypeInterface $type): ?array { |
|
332 | 332 | return $type instanceof InputObjectType ? $type->getFields() : null; |
333 | 333 | }, |
334 | 334 | ], |
@@ -339,20 +339,20 @@ discard block |
||
339 | 339 | }); |
340 | 340 | |
341 | 341 | $this->container |
342 | - ->share(GraphQL::FIELD_INTROSPECTION, function () { |
|
342 | + ->share(GraphQL::FIELD_INTROSPECTION, function() { |
|
343 | 343 | return newObjectType([ |
344 | 344 | 'name' => GraphQL::FIELD_INTROSPECTION, |
345 | 345 | 'isIntrospection' => true, |
346 | 346 | 'description' => |
347 | 347 | 'Object and Interface types are described by a list of Fields, each of ' . |
348 | 348 | 'which has a name, potentially a list of arguments, and a return type.', |
349 | - 'fields' => function () { |
|
349 | + 'fields' => function() { |
|
350 | 350 | return [ |
351 | 351 | 'name' => ['type' => newNonNull(stringType())], |
352 | 352 | 'description' => ['type' => stringType()], |
353 | 353 | 'args' => [ |
354 | 354 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
355 | - 'resolve' => function (ArgumentsAwareInterface $directive): array { |
|
355 | + 'resolve' => function(ArgumentsAwareInterface $directive): array { |
|
356 | 356 | return $directive->getArguments() ?? []; |
357 | 357 | }, |
358 | 358 | ], |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | }); |
366 | 366 | |
367 | 367 | $this->container |
368 | - ->share(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
|
368 | + ->share(GraphQL::INPUT_VALUE_INTROSPECTION, function() { |
|
369 | 369 | return newObjectType([ |
370 | 370 | 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
371 | 371 | 'isIntrospection' => true, |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
374 | 374 | 'InputObject are represented as Input Values which describe their type ' . |
375 | 375 | 'and optionally a default value.', |
376 | - 'fields' => function () { |
|
376 | + 'fields' => function() { |
|
377 | 377 | return [ |
378 | 378 | 'name' => ['type' => newNonNull(stringType())], |
379 | 379 | 'description' => ['type' => stringType()], |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | 'description' => |
384 | 384 | 'A GraphQL-formatted string representing the default value for this ' . |
385 | 385 | 'input value.', |
386 | - 'resolve' => function (/*$inputValue*/) { |
|
386 | + 'resolve' => function(/*$inputValue*/) { |
|
387 | 387 | // TODO: Implement this when we have support for printing AST. |
388 | 388 | return null; |
389 | 389 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | }); |
395 | 395 | |
396 | 396 | $this->container |
397 | - ->share(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
|
397 | + ->share(GraphQL::ENUM_VALUE_INTROSPECTION, function() { |
|
398 | 398 | return newObjectType([ |
399 | 399 | 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
400 | 400 | 'isIntrospection' => true, |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
403 | 403 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
404 | 404 | 'returned in a JSON response as a string.', |
405 | - 'fields' => function () { |
|
405 | + 'fields' => function() { |
|
406 | 406 | return [ |
407 | 407 | 'name' => ['type' => newNonNull(stringType())], |
408 | 408 | 'description' => ['type' => stringType()], |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | }); |
415 | 415 | |
416 | 416 | $this->container |
417 | - ->share(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
|
417 | + ->share(GraphQL::TYPE_KIND_INTROSPECTION, function() { |
|
418 | 418 | return newEnumType([ |
419 | 419 | 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
420 | 420 | 'isIntrospection' => true, |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | protected function registerMetaFields() |
456 | 456 | { |
457 | 457 | $this->container |
458 | - ->share(GraphQL::SCHEMA_META_FIELD_DEFINITION, function ($__Schema) { |
|
458 | + ->share(GraphQL::SCHEMA_META_FIELD_DEFINITION, function($__Schema) { |
|
459 | 459 | return newField([ |
460 | 460 | 'name' => '__schema', |
461 | 461 | 'description' => 'Access the current type schema of this server.', |
462 | 462 | 'type' => newNonNull($__Schema), |
463 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): Schema { |
|
463 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): Schema { |
|
464 | 464 | return $info->getSchema(); |
465 | 465 | }, |
466 | 466 | ]); |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | ->addArgument(GraphQL::SCHEMA_INTROSPECTION); |
469 | 469 | |
470 | 470 | $this->container |
471 | - ->share(GraphQL::TYPE_META_FIELD_DEFINITION, function ($__Type) { |
|
471 | + ->share(GraphQL::TYPE_META_FIELD_DEFINITION, function($__Type) { |
|
472 | 472 | return newField([ |
473 | 473 | 'name' => '__type', |
474 | 474 | 'description' => 'Request the type information of a single type.', |
475 | 475 | 'type' => $__Type, |
476 | 476 | 'args' => ['name' => ['type' => newNonNull(stringType())]], |
477 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): ?TypeInterface { |
|
477 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): ?TypeInterface { |
|
478 | 478 | ['name' => $name] = $args; |
479 | 479 | return $info->getSchema()->getType($name); |
480 | 480 | }, |
@@ -483,12 +483,12 @@ discard block |
||
483 | 483 | ->addArgument(GraphQL::TYPE_INTROSPECTION); |
484 | 484 | |
485 | 485 | $this->container |
486 | - ->share(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function () { |
|
486 | + ->share(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function() { |
|
487 | 487 | return newField([ |
488 | 488 | 'name' => '__typename', |
489 | 489 | 'description' => 'The name of the current Object type at runtime.', |
490 | 490 | 'type' => newNonNull(stringType()), |
491 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): string { |
|
491 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): string { |
|
492 | 492 | return $info->getParentType()->getName(); |
493 | 493 | }, |
494 | 494 | ]); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function register() |
24 | 24 | { |
25 | 25 | $this->container |
26 | - ->share(GraphQL::INCLUDE_DIRECTIVE, function () { |
|
26 | + ->share(GraphQL::INCLUDE_DIRECTIVE, function() { |
|
27 | 27 | return newDirective([ |
28 | 28 | 'name' => 'include', |
29 | 29 | 'description' => |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | }); |
45 | 45 | |
46 | 46 | $this->container |
47 | - ->share(GraphQL::SKIP_DIRECTIVE, function () { |
|
47 | + ->share(GraphQL::SKIP_DIRECTIVE, function() { |
|
48 | 48 | return newDirective([ |
49 | 49 | 'name' => 'skip', |
50 | 50 | 'description' => |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | }); |
66 | 66 | |
67 | 67 | $this->container |
68 | - ->share(GraphQL::DEPRECATED_DIRECTIVE, function () { |
|
68 | + ->share(GraphQL::DEPRECATED_DIRECTIVE, function() { |
|
69 | 69 | return newDirective([ |
70 | 70 | 'name' => 'deprecated', |
71 | 71 | 'description' => 'Marks an element of a GraphQL schema as no longer supported.', |