@@ -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; |
@@ -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 | } |
@@ -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.', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return $middleware; |
116 | 116 | } |
117 | 117 | |
118 | - return \array_filter($middleware, function (ResolverMiddlewareInterface $mw) use ($resolverMiddleware) { |
|
118 | + return \array_filter($middleware, function(ResolverMiddlewareInterface $mw) use ($resolverMiddleware) { |
|
119 | 119 | return \in_array(\get_class($mw), $resolverMiddleware, true); |
120 | 120 | }); |
121 | 121 | } |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | { |
130 | 130 | return \array_reduce( |
131 | 131 | $middleware, |
132 | - function (callable $resolveCallback, ResolverMiddlewareInterface $middleware) { |
|
133 | - return function ($rootValue, array $arguments, $context = null, ?ResolveInfo $info = null) use ( |
|
132 | + function(callable $resolveCallback, ResolverMiddlewareInterface $middleware) { |
|
133 | + return function($rootValue, array $arguments, $context = null, ?ResolveInfo $info = null) use ( |
|
134 | 134 | $resolveCallback, |
135 | 135 | $middleware |
136 | 136 | ) { |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function getResolveCallback(): ?callable |
32 | 32 | { |
33 | - return function ($rootValue, array $arguments, $context = null, ?ResolveInfo $info = null) { |
|
33 | + return function($rootValue, array $arguments, $context = null, ?ResolveInfo $info = null) { |
|
34 | 34 | return $this->resolve($rootValue, $arguments, $context, $info); |
35 | 35 | }; |
36 | 36 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function getResolveCallback(): ?callable |
13 | 13 | { |
14 | - return function (string $fieldName) { |
|
14 | + return function(string $fieldName) { |
|
15 | 15 | return $this->getResolver($fieldName); |
16 | 16 | }; |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function getTypeResolver(): ?callable |
13 | 13 | { |
14 | - return function ($rootValue, $context = null, ?ResolveInfo $info = null) { |
|
14 | + return function($rootValue, $context = null, ?ResolveInfo $info = null) { |
|
15 | 15 | return $this->resolveType($rootValue, $context, $info); |
16 | 16 | }; |
17 | 17 | } |