@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getDirective(string $name): ?Directive |
128 | 128 | { |
129 | - return find($this->directives, function (Directive $directive) use ($name) { |
|
129 | + return find($this->directives, function(Directive $directive) use ($name) { |
|
130 | 130 | return $directive->getName() === $name; |
131 | 131 | }); |
132 | 132 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | ); |
180 | 180 | |
181 | 181 | $this->possibleTypesMap[$abstractTypeName] = \array_reduce($possibleTypes, |
182 | - function (array $map, TypeInterface $type) { |
|
182 | + function(array $map, TypeInterface $type) { |
|
183 | 183 | /** @var NameAwareInterface $type */ |
184 | 184 | $map[$type->getName()] = true; |
185 | 185 | return $map; |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
385 | 385 | foreach ($type->getFields() as $field) { |
386 | 386 | if ($field->hasArguments()) { |
387 | - $fieldArgTypes = \array_map(function (Argument $argument) { |
|
387 | + $fieldArgTypes = \array_map(function(Argument $argument) { |
|
388 | 388 | return $argument->getType(); |
389 | 389 | }, $field->getArguments()); |
390 | 390 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | return $map; |
419 | 419 | } |
420 | 420 | |
421 | - return \array_reduce($directive->getArguments(), function ($map, Argument $argument) { |
|
421 | + return \array_reduce($directive->getArguments(), function($map, Argument $argument) { |
|
422 | 422 | return $this->typeMapReducer($map, $argument->getType()); |
423 | 423 | }, $map); |
424 | 424 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function register() |
43 | 43 | { |
44 | - $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function () { |
|
44 | + $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function() { |
|
45 | 45 | return GraphQLObjectType([ |
46 | 46 | 'name' => GraphQL::INTROSPECTION_SCHEMA, |
47 | 47 | 'isIntrospection' => true, |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
50 | 50 | 'exposes all available types and directives on the server, as well as ' . |
51 | 51 | 'the entry points for query, mutation, and subscription operations.', |
52 | - 'fields' => function () { |
|
52 | + 'fields' => function() { |
|
53 | 53 | return [ |
54 | 54 | 'types' => [ |
55 | 55 | 'description' => 'A list of all types supported by this server.', |
56 | 56 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))), |
57 | - 'resolve' => function (SchemaInterface $schema): array { |
|
57 | + 'resolve' => function(SchemaInterface $schema): array { |
|
58 | 58 | return array_values($schema->getTypeMap()); |
59 | 59 | }, |
60 | 60 | ], |
61 | 61 | 'queryType' => [ |
62 | 62 | 'description' => 'The type that query operations will be rooted at.', |
63 | 63 | 'type' => GraphQLNonNull(__Type()), |
64 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
64 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
65 | 65 | return $schema->getQueryType(); |
66 | 66 | }, |
67 | 67 | ], |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'If this server supports mutation, the type that ' . |
71 | 71 | 'mutation operations will be rooted at.', |
72 | 72 | 'type' => __Type(), |
73 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
73 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
74 | 74 | return $schema->getMutationType(); |
75 | 75 | }, |
76 | 76 | ], |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | 'If this server support subscription, the type that ' . |
80 | 80 | 'subscription operations will be rooted at.', |
81 | 81 | 'type' => __Type(), |
82 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
82 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
83 | 83 | return $schema->getSubscriptionType(); |
84 | 84 | }, |
85 | 85 | ], |
86 | 86 | 'directives' => [ |
87 | 87 | 'description' => 'A list of all directives supported by this server.', |
88 | 88 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))), |
89 | - 'resolve' => function (SchemaInterface $schema): array { |
|
89 | + 'resolve' => function(SchemaInterface $schema): array { |
|
90 | 90 | return $schema->getDirectives(); |
91 | 91 | }, |
92 | 92 | ], |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ]); |
96 | 96 | }, true/* $shared */); |
97 | 97 | |
98 | - $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function () { |
|
98 | + $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function() { |
|
99 | 99 | return GraphQLObjectType([ |
100 | 100 | 'name' => GraphQL::INTROSPECTION_DIRECTIVE, |
101 | 101 | 'isIntrospection' => true, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'execution behavior in ways field arguments will not suffice, such as ' . |
107 | 107 | 'conditionally including or skipping a field. Directives provide this by ' . |
108 | 108 | 'describing additional information to the executor.', |
109 | - 'fields' => function () { |
|
109 | + 'fields' => function() { |
|
110 | 110 | return [ |
111 | 111 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
112 | 112 | 'description' => ['type' => GraphQLString()], |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ], |
116 | 116 | 'args' => [ |
117 | 117 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
118 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
118 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
119 | 119 | return $directive->getArguments() ?: []; |
120 | 120 | }, |
121 | 121 | ], |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ]); |
125 | 125 | }, true/* $shared */); |
126 | 126 | |
127 | - $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function () { |
|
127 | + $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function() { |
|
128 | 128 | return GraphQLEnumType([ |
129 | 129 | 'name' => GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, |
130 | 130 | 'isIntrospection' => true, |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ]); |
191 | 191 | }, true/* $shared */); |
192 | 192 | |
193 | - $this->container->add(GraphQL::INTROSPECTION_TYPE, function () { |
|
193 | + $this->container->add(GraphQL::INTROSPECTION_TYPE, function() { |
|
194 | 194 | return GraphQLObjectType([ |
195 | 195 | 'name' => GraphQL::INTROSPECTION_TYPE, |
196 | 196 | 'isIntrospection' => true, |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | 'Object and Interface types provide the fields they describe. Abstract ' . |
204 | 204 | 'types, Union and Interface, provide the Object types possible ' . |
205 | 205 | 'at runtime. List and NonNull types compose other types.', |
206 | - 'fields' => function () { |
|
206 | + 'fields' => function() { |
|
207 | 207 | return [ |
208 | 208 | 'kind' => [ |
209 | 209 | 'type' => GraphQLNonNull(__TypeKind()), |
210 | - 'resolve' => function (TypeInterface $type) { |
|
210 | + 'resolve' => function(TypeInterface $type) { |
|
211 | 211 | if ($type instanceof ScalarType) { |
212 | 212 | return TypeKindEnum::SCALAR; |
213 | 213 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | 'args' => [ |
244 | 244 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
245 | 245 | ], |
246 | - 'resolve' => function (TypeInterface $type, array $args): |
|
246 | + 'resolve' => function(TypeInterface $type, array $args): |
|
247 | 247 | ?array { |
248 | 248 | $includeDeprecated = $args[0] ?? null; |
249 | 249 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $fields = array_values($type->getFields()); |
252 | 252 | |
253 | 253 | if (!$includeDeprecated) { |
254 | - $fields = array_filter($fields, function (Field $field) { |
|
254 | + $fields = array_filter($fields, function(Field $field) { |
|
255 | 255 | return !$field->isDeprecated(); |
256 | 256 | }); |
257 | 257 | } |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | ], |
265 | 265 | 'interfaces' => [ |
266 | 266 | 'type' => GraphQLList(GraphQLNonNull(__Type())), |
267 | - 'resolve' => function (TypeInterface $type): ?array { |
|
267 | + 'resolve' => function(TypeInterface $type): ?array { |
|
268 | 268 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
269 | 269 | }, |
270 | 270 | ], |
271 | 271 | 'possibleTypes' => [ |
272 | 272 | 'type' => GraphQLList(GraphQLNonNull(__Type())), |
273 | - 'resolve' => function (TypeInterface $type, array $args, array $context, ResolveInfo |
|
273 | + 'resolve' => function(TypeInterface $type, array $args, array $context, ResolveInfo |
|
274 | 274 | $info): |
275 | 275 | ?array { |
276 | 276 | /** @var SchemaInterface $schema */ |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | 'args' => [ |
285 | 285 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
286 | 286 | ], |
287 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
287 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
288 | 288 | [$includeDeprecated] = $args; |
289 | 289 | |
290 | 290 | if ($type instanceof EnumType) { |
291 | 291 | $values = array_values($type->getValues()); |
292 | 292 | |
293 | 293 | if (!$includeDeprecated) { |
294 | - $values = array_filter($values, function (Field $field) { |
|
294 | + $values = array_filter($values, function(Field $field) { |
|
295 | 295 | return !$field->isDeprecated(); |
296 | 296 | }); |
297 | 297 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | ], |
305 | 305 | 'inputFields' => [ |
306 | 306 | 'type' => GraphQLList(GraphQLNonNull(__InputValue())), |
307 | - 'resolve' => function (TypeInterface $type): ?array { |
|
307 | + 'resolve' => function(TypeInterface $type): ?array { |
|
308 | 308 | return $type instanceof InputObjectType ? $type->getFields() : null; |
309 | 309 | }, |
310 | 310 | ], |
@@ -314,20 +314,20 @@ discard block |
||
314 | 314 | ]); |
315 | 315 | }, true/* $shared */); |
316 | 316 | |
317 | - $this->container->add(GraphQL::INTROSPECTION_FIELD, function () { |
|
317 | + $this->container->add(GraphQL::INTROSPECTION_FIELD, function() { |
|
318 | 318 | return GraphQLObjectType([ |
319 | 319 | 'name' => GraphQL::INTROSPECTION_FIELD, |
320 | 320 | 'isIntrospection' => true, |
321 | 321 | 'description' => |
322 | 322 | 'Object and Interface types are described by a list of Fields, each of ' . |
323 | 323 | 'which has a name, potentially a list of arguments, and a return type.', |
324 | - 'fields' => function () { |
|
324 | + 'fields' => function() { |
|
325 | 325 | return [ |
326 | 326 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
327 | 327 | 'description' => ['type' => GraphQLString()], |
328 | 328 | 'args' => [ |
329 | 329 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
330 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
330 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
331 | 331 | return $directive->getArguments() ?: []; |
332 | 332 | }, |
333 | 333 | ], |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | ]); |
340 | 340 | }, true/* $shared */); |
341 | 341 | |
342 | - $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function () { |
|
342 | + $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function() { |
|
343 | 343 | return GraphQLObjectType([ |
344 | 344 | 'name' => GraphQL::INTROSPECTION_INPUT_VALUE, |
345 | 345 | 'isIntrospection' => true, |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
348 | 348 | 'InputObject are represented as Input Values which describe their type ' . |
349 | 349 | 'and optionally a default value.', |
350 | - 'fields' => function () { |
|
350 | + 'fields' => function() { |
|
351 | 351 | return [ |
352 | 352 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
353 | 353 | 'description' => ['type' => GraphQLString()], |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | 'description' => |
358 | 358 | 'A GraphQL-formatted string representing the default value for this ' . |
359 | 359 | 'input value.', |
360 | - 'resolve' => function ($inputValue) { |
|
360 | + 'resolve' => function($inputValue) { |
|
361 | 361 | // TODO: Implement this when we have support for printing AST. |
362 | 362 | return null; |
363 | 363 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ]); |
368 | 368 | }, true/* $shared */); |
369 | 369 | |
370 | - $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function () { |
|
370 | + $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function() { |
|
371 | 371 | return GraphQLObjectType([ |
372 | 372 | 'name' => GraphQL::INTROSPECTION_ENUM_VALUE, |
373 | 373 | 'isIntrospection' => true, |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
376 | 376 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
377 | 377 | 'returned in a JSON response as a string.', |
378 | - 'fields' => function () { |
|
378 | + 'fields' => function() { |
|
379 | 379 | return [ |
380 | 380 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
381 | 381 | 'description' => ['type' => GraphQLString()], |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | ]); |
387 | 387 | }, true/* $shared */); |
388 | 388 | |
389 | - $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function () { |
|
389 | + $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function() { |
|
390 | 390 | return GraphQLEnumType([ |
391 | 391 | 'name' => GraphQL::INTROSPECTION_TYPE_KIND, |
392 | 392 | 'isIntrospection' => true, |