@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | // Assert each interface field arg is implemented. |
317 | 317 | foreach ($interfaceField->getArguments() as $interfaceArgument) { |
318 | 318 | $argumentName = $interfaceArgument->getName(); |
319 | - $objectArgument = find($objectField->getArguments(), function (Argument $argument) use ($argumentName) { |
|
319 | + $objectArgument = find($objectField->getArguments(), function(Argument $argument) use ($argumentName) { |
|
320 | 320 | return $argument->getName() === $argumentName; |
321 | 321 | }); |
322 | 322 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $argumentName = $objectArgument->getName(); |
376 | 376 | $interfaceArgument = find( |
377 | 377 | $interfaceField->getArguments(), |
378 | - function (Argument $argument) use ($argumentName) { |
|
378 | + function(Argument $argument) use ($argumentName) { |
|
379 | 379 | return $argument->getName() === $argumentName; |
380 | 380 | } |
381 | 381 | ); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | return null; |
715 | 715 | } |
716 | 716 | |
717 | - return \array_filter($node->getTypes(), function (NamedTypeNode $type) use ($memberTypeName) { |
|
717 | + return \array_filter($node->getTypes(), function(NamedTypeNode $type) use ($memberTypeName) { |
|
718 | 718 | return $type->getNameValue() === $memberTypeName; |
719 | 719 | }); |
720 | 720 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | return null; |
734 | 734 | } |
735 | 735 | |
736 | - return \array_filter($node->getValues(), function (NameAwareInterface $type) use ($valueName) { |
|
736 | + return \array_filter($node->getValues(), function(NameAwareInterface $type) use ($valueName) { |
|
737 | 737 | return $type->getNameValue() === $valueName; |
738 | 738 | }); |
739 | 739 | } |
@@ -89,7 +89,7 @@ |
||
89 | 89 | /** @var OperationTypeDefinitionNode $operationTypeNode */ |
90 | 90 | $operationTypeNode = find( |
91 | 91 | $node->getOperationTypes(), |
92 | - function (OperationTypeDefinitionNode $operationType) use ($operation) { |
|
92 | + function(OperationTypeDefinitionNode $operationType) use ($operation) { |
|
93 | 93 | return $operationType->getOperation() === $operation; |
94 | 94 | } |
95 | 95 | ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function register() |
28 | 28 | { |
29 | - $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function () { |
|
29 | + $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function() { |
|
30 | 30 | return newDirective([ |
31 | 31 | 'name' => 'include', |
32 | 32 | 'description' => |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ]); |
47 | 47 | }, true/* $shared */); |
48 | 48 | |
49 | - $this->container->add(GraphQL::SKIP_DIRECTIVE, function () { |
|
49 | + $this->container->add(GraphQL::SKIP_DIRECTIVE, function() { |
|
50 | 50 | return newDirective([ |
51 | 51 | 'name' => 'skip', |
52 | 52 | 'description' => |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ]); |
67 | 67 | }, true/* $shared */); |
68 | 68 | |
69 | - $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function () { |
|
69 | + $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function() { |
|
70 | 70 | return newDirective([ |
71 | 71 | 'name' => 'deprecated', |
72 | 72 | 'description' => 'Marks an element of a GraphQL schema as no longer supported.', |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function register() |
35 | 35 | { |
36 | - $this->container->add(GraphQL::BOOLEAN, function (BooleanCoercer $coercer) { |
|
36 | + $this->container->add(GraphQL::BOOLEAN, function(BooleanCoercer $coercer) { |
|
37 | 37 | return newScalarType([ |
38 | 38 | 'name' => TypeNameEnum::BOOLEAN, |
39 | 39 | 'description' => 'The `Boolean` scalar type represents `true` or `false`.', |
40 | - 'serialize' => function ($value) use ($coercer) { |
|
40 | + 'serialize' => function($value) use ($coercer) { |
|
41 | 41 | return $coercer->coerce($value); |
42 | 42 | }, |
43 | - 'parseValue' => function ($value) use ($coercer) { |
|
43 | + 'parseValue' => function($value) use ($coercer) { |
|
44 | 44 | return $coercer->coerce($value); |
45 | 45 | }, |
46 | - 'parseLiteral' => function (NodeInterface $node) { |
|
46 | + 'parseLiteral' => function(NodeInterface $node) { |
|
47 | 47 | if ($node instanceof BooleanValueNode) { |
48 | 48 | return $node->getValue(); |
49 | 49 | } |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | }, true/* $shared */) |
54 | 54 | ->withArgument(BooleanCoercer::class); |
55 | 55 | |
56 | - $this->container->add(GraphQL::FLOAT, function (FloatCoercer $coercer) { |
|
56 | + $this->container->add(GraphQL::FLOAT, function(FloatCoercer $coercer) { |
|
57 | 57 | return newScalarType([ |
58 | 58 | 'name' => TypeNameEnum::FLOAT, |
59 | 59 | 'description' => |
60 | 60 | 'The `Float` scalar type represents signed double-precision fractional ' . |
61 | 61 | 'values as specified by ' . |
62 | 62 | '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).', |
63 | - 'serialize' => function ($value) use ($coercer) { |
|
63 | + 'serialize' => function($value) use ($coercer) { |
|
64 | 64 | return $coercer->coerce($value); |
65 | 65 | }, |
66 | - 'parseValue' => function ($value) use ($coercer) { |
|
66 | + 'parseValue' => function($value) use ($coercer) { |
|
67 | 67 | return $coercer->coerce($value); |
68 | 68 | }, |
69 | - 'parseLiteral' => function (NodeInterface $node) { |
|
69 | + 'parseLiteral' => function(NodeInterface $node) { |
|
70 | 70 | if ($node instanceof FloatValueNode || $node instanceof IntValueNode) { |
71 | 71 | return $node->getValue(); |
72 | 72 | } |
@@ -76,19 +76,19 @@ discard block |
||
76 | 76 | }, true/* $shared */) |
77 | 77 | ->withArgument(FloatCoercer::class); |
78 | 78 | |
79 | - $this->container->add(GraphQL::INT, function (IntCoercer $coercer) { |
|
79 | + $this->container->add(GraphQL::INT, function(IntCoercer $coercer) { |
|
80 | 80 | return newScalarType([ |
81 | 81 | 'name' => TypeNameEnum::INT, |
82 | 82 | 'description' => |
83 | 83 | 'The `Int` scalar type represents non-fractional signed whole numeric ' . |
84 | 84 | 'values. Int can represent values between -(2^31) and 2^31 - 1.', |
85 | - 'serialize' => function ($value) use ($coercer) { |
|
85 | + 'serialize' => function($value) use ($coercer) { |
|
86 | 86 | return $coercer->coerce($value); |
87 | 87 | }, |
88 | - 'parseValue' => function ($value) use ($coercer) { |
|
88 | + 'parseValue' => function($value) use ($coercer) { |
|
89 | 89 | return $coercer->coerce($value); |
90 | 90 | }, |
91 | - 'parseLiteral' => function (NodeInterface $node) { |
|
91 | + 'parseLiteral' => function(NodeInterface $node) { |
|
92 | 92 | if ($node instanceof IntValueNode) { |
93 | 93 | $value = (int)$node->getValue(); |
94 | 94 | if ((string)$node->getValue() === (string)$value && |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | }, true/* $shared */) |
103 | 103 | ->withArgument(IntCoercer::class); |
104 | 104 | |
105 | - $this->container->add(GraphQL::ID, function (StringCoercer $coercer) { |
|
105 | + $this->container->add(GraphQL::ID, function(StringCoercer $coercer) { |
|
106 | 106 | return newScalarType([ |
107 | 107 | 'name' => TypeNameEnum::ID, |
108 | 108 | 'description' => |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | 'response as a String; however, it is not intended to be human-readable. ' . |
112 | 112 | 'When expected as an input type, any string (such as `"4"`) or integer ' . |
113 | 113 | '(such as `4`) input value will be accepted as an ID.', |
114 | - 'serialize' => function ($value) use ($coercer) { |
|
114 | + 'serialize' => function($value) use ($coercer) { |
|
115 | 115 | return $coercer->coerce($value); |
116 | 116 | }, |
117 | - 'parseValue' => function ($value) use ($coercer) { |
|
117 | + 'parseValue' => function($value) use ($coercer) { |
|
118 | 118 | return $coercer->coerce($value); |
119 | 119 | }, |
120 | - 'parseLiteral' => function (NodeInterface $node) { |
|
120 | + 'parseLiteral' => function(NodeInterface $node) { |
|
121 | 121 | if ($node instanceof StringValueNode || $node instanceof IntValueNode) { |
122 | 122 | return $node->getValue(); |
123 | 123 | } |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | }, true/* $shared */) |
128 | 128 | ->withArgument(StringCoercer::class); |
129 | 129 | |
130 | - $this->container->add(GraphQL::STRING, function (StringCoercer $coercer) { |
|
130 | + $this->container->add(GraphQL::STRING, function(StringCoercer $coercer) { |
|
131 | 131 | return newScalarType([ |
132 | 132 | 'name' => TypeNameEnum::STRING, |
133 | 133 | 'description' => |
134 | 134 | 'The `String` scalar type represents textual data, represented as UTF-8 ' . |
135 | 135 | 'character sequences. The String type is most often used by GraphQL to ' . |
136 | 136 | 'represent free-form human-readable text.', |
137 | - 'serialize' => function ($value) use ($coercer) { |
|
137 | + 'serialize' => function($value) use ($coercer) { |
|
138 | 138 | return $coercer->coerce($value); |
139 | 139 | }, |
140 | - 'parseValue' => function ($value) use ($coercer) { |
|
140 | + 'parseValue' => function($value) use ($coercer) { |
|
141 | 141 | return $coercer->coerce($value); |
142 | 142 | }, |
143 | - 'parseLiteral' => function (NodeInterface $node) { |
|
143 | + 'parseLiteral' => function(NodeInterface $node) { |
|
144 | 144 | if ($node instanceof StringValueNode) { |
145 | 145 | return $node->getValue(); |
146 | 146 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | $context = $this->createContext($schema, $document, $typeInfo); |
48 | 48 | |
49 | - $visitors = \array_map(function (RuleInterface $rule) use ($context) { |
|
49 | + $visitors = \array_map(function(RuleInterface $rule) use ($context) { |
|
50 | 50 | return $rule->setContext($context); |
51 | 51 | }, $rules); |
52 | 52 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function buildTypes(): array |
79 | 79 | { |
80 | - return \array_map(function (TypeDefinitionNodeInterface $definition) { |
|
80 | + return \array_map(function(TypeDefinitionNodeInterface $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; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return $coercedValues; |
57 | 57 | } |
58 | 58 | |
59 | - $argumentNodeMap = keyMap($argumentNodes, function (ArgumentNode $value) { |
|
59 | + $argumentNodeMap = keyMap($argumentNodes, function(ArgumentNode $value) { |
|
60 | 60 | return $value->getNameValue(); |
61 | 61 | }); |
62 | 62 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | array $variableValues = [] |
132 | 132 | ): ?array { |
133 | 133 | $directiveNode = $node->hasDirectives() |
134 | - ? find($node->getDirectives(), function (NameAwareInterface $value) use ($directive) { |
|
134 | + ? find($node->getDirectives(), function(NameAwareInterface $value) use ($directive) { |
|
135 | 135 | return $value->getNameValue() === $directive->getName(); |
136 | 136 | }) : null; |
137 | 137 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | ]); |
330 | 330 | } |
331 | 331 | return new CoercedValue($parseResult, null); |
332 | - } catch (InvalidTypeException|CoercingException $ex) { |
|
332 | + } catch (InvalidTypeException | CoercingException $ex) { |
|
333 | 333 | return new CoercedValue(null, [ |
334 | 334 | $this->buildCoerceException( |
335 | 335 | sprintf('Expected type %s', (string)$type), |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | - $suggestions = suggestionList((string)$value, array_map(function (EnumValue $enumValue) { |
|
366 | + $suggestions = suggestionList((string)$value, array_map(function(EnumValue $enumValue) { |
|
367 | 367 | return $enumValue->getName(); |
368 | 368 | }, $type->getValues())); |
369 | 369 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getTypeResolver(): ?callable |
27 | 27 | { |
28 | - return function ($rootValue, $contextValues, ResolveInfo $info) { |
|
28 | + return function($rootValue, $contextValues, ResolveInfo $info) { |
|
29 | 29 | return $this->resolveType($rootValue, $contextValues, $info); |
30 | 30 | }; |
31 | 31 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $builtInTypes = keyMap( |
98 | 98 | \array_merge(specifiedScalarTypes(), introspectionTypes()), |
99 | - function (NamedTypeInterface $type) { |
|
99 | + function(NamedTypeInterface $type) { |
|
100 | 100 | return $type->getName(); |
101 | 101 | } |
102 | 102 | ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function buildTypes(array $nodes): array |
113 | 113 | { |
114 | - return \array_map(function (NodeInterface $node) { |
|
114 | + return \array_map(function(NodeInterface $node) { |
|
115 | 115 | return $this->buildType($node); |
116 | 116 | }, $nodes); |
117 | 117 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | return newDirective([ |
148 | 148 | 'name' => $node->getNameValue(), |
149 | 149 | 'description' => $node->getDescriptionValue(), |
150 | - 'locations' => \array_map(function (NameNode $node) { |
|
150 | + 'locations' => \array_map(function(NameNode $node) { |
|
151 | 151 | return $node->getValue(); |
152 | 152 | }, $node->getLocations()), |
153 | 153 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | { |
192 | 192 | return keyValueMap( |
193 | 193 | $nodes, |
194 | - function (InputValueDefinitionNode $value) { |
|
194 | + function(InputValueDefinitionNode $value) { |
|
195 | 195 | return $value->getNameValue(); |
196 | 196 | }, |
197 | - function (InputValueDefinitionNode $value): array { |
|
197 | + function(InputValueDefinitionNode $value): array { |
|
198 | 198 | $type = $this->buildWrappedType($value->getType()); |
199 | 199 | $defaultValue = $value->getDefaultValue(); |
200 | 200 | return [ |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | return newObjectType([ |
247 | 247 | 'name' => $node->getNameValue(), |
248 | 248 | 'description' => $node->getDescriptionValue(), |
249 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
249 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
250 | 250 | return $this->buildFields($node); |
251 | 251 | } : [], |
252 | 252 | // Note: While this could make early assertions to get the correctly |
253 | 253 | // typed values, that would throw immediately while type system |
254 | 254 | // validation with validateSchema() will produce more actionable results. |
255 | - 'interfaces' => function () use ($node) { |
|
256 | - return $node->hasInterfaces() ? \array_map(function (NodeInterface $interface) { |
|
255 | + 'interfaces' => function() use ($node) { |
|
256 | + return $node->hasInterfaces() ? \array_map(function(NodeInterface $interface) { |
|
257 | 257 | return $this->buildType($interface); |
258 | 258 | }, $node->getInterfaces()) : []; |
259 | 259 | }, |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | { |
270 | 270 | return keyValueMap( |
271 | 271 | $node->getFields(), |
272 | - function ($value) { |
|
272 | + function($value) { |
|
273 | 273 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
274 | 274 | return $value->getNameValue(); |
275 | 275 | }, |
276 | - function ($value) use ($node) { |
|
276 | + function($value) use ($node) { |
|
277 | 277 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
278 | 278 | return $this->buildField($value, $this->getFieldResolver($node->getNameValue(), $value->getNameValue())); |
279 | 279 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | return newInterfaceType([ |
302 | 302 | 'name' => $node->getNameValue(), |
303 | 303 | 'description' => $node->getDescriptionValue(), |
304 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
304 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
305 | 305 | return $this->buildFields($node); |
306 | 306 | } : [], |
307 | 307 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | 'description' => $node->getDescriptionValue(), |
321 | 321 | 'values' => $node->hasValues() ? keyValueMap( |
322 | 322 | $node->getValues(), |
323 | - function (EnumValueDefinitionNode $value): string { |
|
323 | + function(EnumValueDefinitionNode $value): string { |
|
324 | 324 | return $value->getNameValue(); |
325 | 325 | }, |
326 | - function (EnumValueDefinitionNode $value): array { |
|
326 | + function(EnumValueDefinitionNode $value): array { |
|
327 | 327 | return [ |
328 | 328 | 'description' => $value->getDescriptionValue(), |
329 | 329 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | return newUnionType([ |
345 | 345 | 'name' => $node->getNameValue(), |
346 | 346 | 'description' => $node->getDescriptionValue(), |
347 | - 'types' => $node->hasTypes() ? \array_map(function (TypeNodeInterface $type) { |
|
347 | + 'types' => $node->hasTypes() ? \array_map(function(TypeNodeInterface $type) { |
|
348 | 348 | return $this->buildType($type); |
349 | 349 | }, $node->getTypes()) : [], |
350 | 350 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return newScalarType([ |
373 | 373 | 'name' => $node->getNameValue(), |
374 | 374 | 'description' => $node->getDescriptionValue(), |
375 | - 'serialize' => function ($value) { |
|
375 | + 'serialize' => function($value) { |
|
376 | 376 | return $value; |
377 | 377 | }, |
378 | 378 | 'astNode' => $node, |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | return newInputObjectType([ |
389 | 389 | 'name' => $node->getNameValue(), |
390 | 390 | 'description' => $node->getDescriptionValue(), |
391 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
391 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
392 | 392 | return keyValueMap( |
393 | 393 | $node->getFields(), |
394 | - function (InputValueDefinitionNode $value): string { |
|
394 | + function(InputValueDefinitionNode $value): string { |
|
395 | 395 | return $value->getNameValue(); |
396 | 396 | }, |
397 | - function (InputValueDefinitionNode $value): array { |
|
397 | + function(InputValueDefinitionNode $value): array { |
|
398 | 398 | $type = $this->buildWrappedType($value->getType()); |
399 | 399 | $defaultValue = $value->getDefaultValue(); |
400 | 400 | return [ |