@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
34 | 34 | 'exposes all available types and directives on the server, as well as ' . |
35 | 35 | 'the entry points for query, mutation, and subscription operations.', |
36 | - 'fields' => function () { |
|
36 | + 'fields' => function() { |
|
37 | 37 | return [ |
38 | 38 | 'types' => [ |
39 | 39 | 'description' => 'A list of all types supported by this server.', |
40 | 40 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))), |
41 | - 'resolve' => function (SchemaInterface $schema): array { |
|
41 | + 'resolve' => function(SchemaInterface $schema): array { |
|
42 | 42 | return array_values($schema->getTypeMap()); |
43 | 43 | }, |
44 | 44 | ], |
45 | 45 | 'queryType' => [ |
46 | 46 | 'description' => 'The type that query operations will be rooted at.', |
47 | 47 | 'type' => GraphQLNonNull(__Type()), |
48 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
48 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
49 | 49 | return $schema->getQuery(); |
50 | 50 | }, |
51 | 51 | ], |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'If this server supports mutation, the type that ' . |
55 | 55 | 'mutation operations will be rooted at.', |
56 | 56 | 'type' => __Type(), |
57 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
57 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
58 | 58 | return $schema->getMutation(); |
59 | 59 | }, |
60 | 60 | ], |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | 'If this server support subscription, the type that ' . |
64 | 64 | 'subscription operations will be rooted at.', |
65 | 65 | 'type' => __Type(), |
66 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
66 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
67 | 67 | return $schema->getSubscription(); |
68 | 68 | }, |
69 | 69 | ], |
70 | 70 | 'directives' => [ |
71 | 71 | 'description' => 'A list of all directives supported by this server.', |
72 | 72 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))), |
73 | - 'resolve' => function (SchemaInterface $schema): array { |
|
73 | + 'resolve' => function(SchemaInterface $schema): array { |
|
74 | 74 | return $schema->getDirectives(); |
75 | 75 | }, |
76 | 76 | ], |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'execution behavior in ways field arguments will not suffice, such as ' . |
101 | 101 | 'conditionally including or skipping a field. Directives provide this by ' . |
102 | 102 | 'describing additional information to the executor.', |
103 | - 'fields' => function () { |
|
103 | + 'fields' => function() { |
|
104 | 104 | return [ |
105 | 105 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
106 | 106 | 'description' => ['type' => GraphQLString()], |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ], |
110 | 110 | 'args' => [ |
111 | 111 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
112 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
112 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
113 | 113 | return $directive->getArgs() ?: []; |
114 | 114 | }, |
115 | 115 | ], |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | 'Object and Interface types provide the fields they describe. Abstract ' . |
218 | 218 | 'types, Union and Interface, provide the Object types possible ' . |
219 | 219 | 'at runtime. List and NonNull types compose other types.', |
220 | - 'fields' => function () { |
|
220 | + 'fields' => function() { |
|
221 | 221 | return [ |
222 | 222 | 'kind' => [ |
223 | 223 | 'type' => GraphQLNonNull(__TypeKind()), |
224 | - 'resolve' => function (TypeInterface $type) { |
|
224 | + 'resolve' => function(TypeInterface $type) { |
|
225 | 225 | if ($type instanceof ScalarType) { |
226 | 226 | return TypeKindEnum::SCALAR; |
227 | 227 | } |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | 'args' => [ |
258 | 258 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
259 | 259 | ], |
260 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
260 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
261 | 261 | list ($includeDeprecated) = $args; |
262 | 262 | |
263 | 263 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
264 | 264 | $fields = array_values($type->getFields()); |
265 | 265 | |
266 | 266 | if (!$includeDeprecated) { |
267 | - $fields = array_filter($fields, function (Field $field) { |
|
267 | + $fields = array_filter($fields, function(Field $field) { |
|
268 | 268 | return !$field->isDeprecated(); |
269 | 269 | }); |
270 | 270 | } |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | ], |
278 | 278 | 'interfaces' => [ |
279 | 279 | 'type' => GraphQLList(GraphQLNonNull(__Type())), |
280 | - 'resolve' => function (TypeInterface $type): ?array { |
|
280 | + 'resolve' => function(TypeInterface $type): ?array { |
|
281 | 281 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
282 | 282 | }, |
283 | 283 | ], |
284 | 284 | 'possibleTypes' => [ |
285 | 285 | 'type' => GraphQLList(GraphQLNonNull(__Type())), |
286 | - 'resolve' => function (TypeInterface $type, $args, $context, $info): ?array { |
|
286 | + 'resolve' => function(TypeInterface $type, $args, $context, $info): ?array { |
|
287 | 287 | /** @var SchemaInterface $schema */ |
288 | 288 | list ($schema) = $info; |
289 | 289 | return $type instanceof AbstractType ? $schema->getPossibleTypes($type) : null; |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | 'args' => [ |
295 | 295 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
296 | 296 | ], |
297 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
297 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
298 | 298 | list ($includeDeprecated) = $args; |
299 | 299 | |
300 | 300 | if ($type instanceof EnumType) { |
301 | 301 | $values = array_values($type->getValues()); |
302 | 302 | |
303 | 303 | if (!$includeDeprecated) { |
304 | - $values = array_filter($values, function (Field $field) { |
|
304 | + $values = array_filter($values, function(Field $field) { |
|
305 | 305 | return !$field->isDeprecated(); |
306 | 306 | }); |
307 | 307 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | ], |
315 | 315 | 'inputFields' => [ |
316 | 316 | 'type' => GraphQLList(GraphQLNonNull(__InputValue())), |
317 | - 'resolve' => function (TypeInterface $type): ?array { |
|
317 | + 'resolve' => function(TypeInterface $type): ?array { |
|
318 | 318 | return $type instanceof InputObjectType ? $type->getFields() : null; |
319 | 319 | }, |
320 | 320 | ], |
@@ -341,13 +341,13 @@ discard block |
||
341 | 341 | 'description' => |
342 | 342 | 'Object and Interface types are described by a list of Fields, each of ' . |
343 | 343 | 'which has a name, potentially a list of arguments, and a return type.', |
344 | - 'fields' => function () { |
|
344 | + 'fields' => function() { |
|
345 | 345 | return [ |
346 | 346 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
347 | 347 | 'description' => ['type' => GraphQLString()], |
348 | 348 | 'args' => [ |
349 | 349 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
350 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
350 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
351 | 351 | return $directive->getArgs() ?: []; |
352 | 352 | }, |
353 | 353 | ], |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
378 | 378 | 'InputObject are represented as Input Values which describe their type ' . |
379 | 379 | 'and optionally a default value.', |
380 | - 'fields' => function () { |
|
380 | + 'fields' => function() { |
|
381 | 381 | return [ |
382 | 382 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
383 | 383 | 'description' => ['type' => GraphQLString()], |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | 'description' => |
388 | 388 | 'A GraphQL-formatted string representing the default value for this ' . |
389 | 389 | 'input value.', |
390 | - 'resolve' => function ($inputValue) { |
|
390 | + 'resolve' => function($inputValue) { |
|
391 | 391 | // TODO: Implement this when we have support for printing AST. |
392 | 392 | return null; |
393 | 393 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
416 | 416 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
417 | 417 | 'returned in a JSON response as a string.', |
418 | - 'fields' => function () { |
|
418 | + 'fields' => function() { |
|
419 | 419 | return [ |
420 | 420 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
421 | 421 | 'description' => ['type' => GraphQLString()], |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | 'name' => '__schema', |
481 | 481 | 'type' => GraphQLNonNull(__Schema()), |
482 | 482 | 'description' => 'Access the current type schema of this server.', |
483 | - 'resolve' => function ($source, $args, $context, $info): SchemaInterface { |
|
483 | + 'resolve' => function($source, $args, $context, $info): SchemaInterface { |
|
484 | 484 | list ($schema) = $info; |
485 | 485 | return $schema; |
486 | 486 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | 'args' => [ |
501 | 501 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
502 | 502 | ], |
503 | - 'resolve' => function ($source, $args, $context, $info): TypeInterface { |
|
503 | + 'resolve' => function($source, $args, $context, $info): TypeInterface { |
|
504 | 504 | /** @var SchemaInterface $schema */ |
505 | 505 | list ($name) = $args; |
506 | 506 | list ($schema) = $info; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | 'name' => '__typename', |
520 | 520 | 'type' => GraphQLNonNull(GraphQLString()), |
521 | 521 | 'description' => 'The name of the current Object type at runtime.', |
522 | - 'resolve' => function ($source, $args, $context, $info): string { |
|
522 | + 'resolve' => function($source, $args, $context, $info): string { |
|
523 | 523 | /** @var TypeInterface $parentType */ |
524 | 524 | list ($parentType) = $info; |
525 | 525 | return $parentType->getName(); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | { |
553 | 553 | return arraySome( |
554 | 554 | introspectionTypes(), |
555 | - function (TypeInterface $introspectionType) use ($type) { |
|
555 | + function(TypeInterface $introspectionType) use ($type) { |
|
556 | 556 | return $type->getName() === $introspectionType->getName(); |
557 | 557 | } |
558 | 558 | ); |