@@ -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' => static function (Directive $directive): iterable { |
|
136 | + 'resolve' => static function(Directive $directive): iterable { |
|
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, |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | }); |
214 | 214 | |
215 | 215 | $this->container |
216 | - ->share(GraphQL::TYPE_INTROSPECTION, function () { |
|
216 | + ->share(GraphQL::TYPE_INTROSPECTION, function() { |
|
217 | 217 | return newObjectType([ |
218 | 218 | 'name' => GraphQL::TYPE_INTROSPECTION, |
219 | 219 | 'isIntrospection' => true, |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | 'Enum types provide their values. Object and Interface types provide the fields ' . |
226 | 226 | 'they describe. Abstract types, Union and Interface, provide the Object types ' . |
227 | 227 | 'possible at runtime. List and NonNull types compose other types.', |
228 | - 'fields' => function () { |
|
228 | + 'fields' => function() { |
|
229 | 229 | return [ |
230 | 230 | 'kind' => [ |
231 | 231 | 'type' => newNonNull(__TypeKind()), |
232 | - 'resolve' => function (TypeInterface $type) { |
|
232 | + 'resolve' => function(TypeInterface $type) { |
|
233 | 233 | if ($type instanceof ScalarType) { |
234 | 234 | return TypeKindEnum::SCALAR; |
235 | 235 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'args' => [ |
266 | 266 | 'includeDeprecated' => ['type' => booleanType(), 'defaultValue' => false], |
267 | 267 | ], |
268 | - 'resolve' => function (TypeInterface $type, array $args): |
|
268 | + 'resolve' => function(TypeInterface $type, array $args): |
|
269 | 269 | ?array { |
270 | 270 | ['includeDeprecated' => $includeDeprecated] = $args; |
271 | 271 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $fields = \array_values($type->getFields()); |
274 | 274 | |
275 | 275 | if (!$includeDeprecated) { |
276 | - $fields = \array_filter($fields, function (Field $field) { |
|
276 | + $fields = \array_filter($fields, function(Field $field) { |
|
277 | 277 | return !$field->isDeprecated(); |
278 | 278 | }); |
279 | 279 | } |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | ], |
287 | 287 | 'interfaces' => [ |
288 | 288 | 'type' => newList(newNonNull(__Type())), |
289 | - 'resolve' => function (TypeInterface $type): ?array { |
|
289 | + 'resolve' => function(TypeInterface $type): ?array { |
|
290 | 290 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
291 | 291 | }, |
292 | 292 | ], |
293 | 293 | 'possibleTypes' => [ |
294 | 294 | 'type' => newList(newNonNull(__Type())), |
295 | - 'resolve' => function ( |
|
295 | + 'resolve' => function( |
|
296 | 296 | TypeInterface $type, |
297 | 297 | array $args, |
298 | 298 | array $context, |
@@ -310,14 +310,14 @@ discard block |
||
310 | 310 | 'args' => [ |
311 | 311 | 'includeDeprecated' => ['type' => booleanType(), 'defaultValue' => false], |
312 | 312 | ], |
313 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
313 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
314 | 314 | ['includeDeprecated' => $includeDeprecated] = $args; |
315 | 315 | |
316 | 316 | if ($type instanceof EnumType) { |
317 | 317 | $values = \array_values($type->getValues()); |
318 | 318 | |
319 | 319 | if (!$includeDeprecated) { |
320 | - $values = \array_filter($values, function (Field $field) { |
|
320 | + $values = \array_filter($values, function(Field $field) { |
|
321 | 321 | return !$field->isDeprecated(); |
322 | 322 | }); |
323 | 323 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | ], |
331 | 331 | 'inputFields' => [ |
332 | 332 | 'type' => newList(newNonNull(__InputValue())), |
333 | - 'resolve' => function (TypeInterface $type): ?array { |
|
333 | + 'resolve' => function(TypeInterface $type): ?array { |
|
334 | 334 | return $type instanceof InputObjectType ? $type->getFields() : null; |
335 | 335 | }, |
336 | 336 | ], |
@@ -341,20 +341,20 @@ discard block |
||
341 | 341 | }); |
342 | 342 | |
343 | 343 | $this->container |
344 | - ->share(GraphQL::FIELD_INTROSPECTION, function () { |
|
344 | + ->share(GraphQL::FIELD_INTROSPECTION, function() { |
|
345 | 345 | return newObjectType([ |
346 | 346 | 'name' => GraphQL::FIELD_INTROSPECTION, |
347 | 347 | 'isIntrospection' => true, |
348 | 348 | 'description' => |
349 | 349 | 'Object and Interface types are described by a list of Fields, each of ' . |
350 | 350 | 'which has a name, potentially a list of arguments, and a return type.', |
351 | - 'fields' => function () { |
|
351 | + 'fields' => function() { |
|
352 | 352 | return [ |
353 | 353 | 'name' => ['type' => newNonNull(stringType())], |
354 | 354 | 'description' => ['type' => stringType()], |
355 | 355 | 'args' => [ |
356 | 356 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
357 | - 'resolve' => function (ArgumentsAwareInterface $directive): array { |
|
357 | + 'resolve' => function(ArgumentsAwareInterface $directive): array { |
|
358 | 358 | return $directive->getArguments() ?? []; |
359 | 359 | }, |
360 | 360 | ], |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | }); |
368 | 368 | |
369 | 369 | $this->container |
370 | - ->share(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
|
370 | + ->share(GraphQL::INPUT_VALUE_INTROSPECTION, function() { |
|
371 | 371 | return newObjectType([ |
372 | 372 | 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
373 | 373 | 'isIntrospection' => true, |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
376 | 376 | 'InputObject are represented as Input Values which describe their type ' . |
377 | 377 | 'and optionally a default value.', |
378 | - 'fields' => function () { |
|
378 | + 'fields' => function() { |
|
379 | 379 | return [ |
380 | 380 | 'name' => ['type' => newNonNull(stringType())], |
381 | 381 | 'description' => ['type' => stringType()], |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | 'description' => |
386 | 386 | 'A GraphQL-formatted string representing the default value for this ' . |
387 | 387 | 'input value.', |
388 | - 'resolve' => function (/*$inputValue*/) { |
|
388 | + 'resolve' => function(/*$inputValue*/) { |
|
389 | 389 | // TODO: Implement this when we have support for printing AST. |
390 | 390 | return null; |
391 | 391 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | }); |
397 | 397 | |
398 | 398 | $this->container |
399 | - ->share(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
|
399 | + ->share(GraphQL::ENUM_VALUE_INTROSPECTION, function() { |
|
400 | 400 | return newObjectType([ |
401 | 401 | 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
402 | 402 | 'isIntrospection' => true, |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
405 | 405 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
406 | 406 | 'returned in a JSON response as a string.', |
407 | - 'fields' => function () { |
|
407 | + 'fields' => function() { |
|
408 | 408 | return [ |
409 | 409 | 'name' => ['type' => newNonNull(stringType())], |
410 | 410 | 'description' => ['type' => stringType()], |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | }); |
417 | 417 | |
418 | 418 | $this->container |
419 | - ->share(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
|
419 | + ->share(GraphQL::TYPE_KIND_INTROSPECTION, function() { |
|
420 | 420 | return newEnumType([ |
421 | 421 | 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
422 | 422 | 'isIntrospection' => true, |
@@ -457,12 +457,12 @@ discard block |
||
457 | 457 | protected function registerMetaFields() |
458 | 458 | { |
459 | 459 | $this->container |
460 | - ->share(GraphQL::SCHEMA_META_FIELD_DEFINITION, function ($__Schema) { |
|
460 | + ->share(GraphQL::SCHEMA_META_FIELD_DEFINITION, function($__Schema) { |
|
461 | 461 | return newField([ |
462 | 462 | 'name' => '__schema', |
463 | 463 | 'description' => 'Access the current type schema of this server.', |
464 | 464 | 'type' => newNonNull($__Schema), |
465 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): Schema { |
|
465 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): Schema { |
|
466 | 466 | return $info->getSchema(); |
467 | 467 | }, |
468 | 468 | ]); |
@@ -470,13 +470,13 @@ discard block |
||
470 | 470 | ->addArgument(GraphQL::SCHEMA_INTROSPECTION); |
471 | 471 | |
472 | 472 | $this->container |
473 | - ->share(GraphQL::TYPE_META_FIELD_DEFINITION, function ($__Type) { |
|
473 | + ->share(GraphQL::TYPE_META_FIELD_DEFINITION, function($__Type) { |
|
474 | 474 | return newField([ |
475 | 475 | 'name' => '__type', |
476 | 476 | 'description' => 'Request the type information of a single type.', |
477 | 477 | 'type' => $__Type, |
478 | 478 | 'args' => ['name' => ['type' => newNonNull(stringType())]], |
479 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): ?TypeInterface { |
|
479 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): ?TypeInterface { |
|
480 | 480 | ['name' => $name] = $args; |
481 | 481 | return $info->getSchema()->getType($name); |
482 | 482 | }, |
@@ -485,12 +485,12 @@ discard block |
||
485 | 485 | ->addArgument(GraphQL::TYPE_INTROSPECTION); |
486 | 486 | |
487 | 487 | $this->container |
488 | - ->share(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function () { |
|
488 | + ->share(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function() { |
|
489 | 489 | return newField([ |
490 | 490 | 'name' => '__typename', |
491 | 491 | 'description' => 'The name of the current Object type at runtime.', |
492 | 492 | 'type' => newNonNull(stringType()), |
493 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): string { |
|
493 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): string { |
|
494 | 494 | return $info->getParentType()->getName(); |
495 | 495 | }, |
496 | 496 | ]); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getDirective(string $name): ?DirectiveInterface |
170 | 170 | { |
171 | - return find($this->directives, static function (Directive $directive) use ($name) { |
|
171 | + return find($this->directives, static function(Directive $directive) use ($name) { |
|
172 | 172 | return $directive->getName() === $name; |
173 | 173 | }); |
174 | 174 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | $this->possibleTypesMap[$abstractTypeName] = \array_reduce( |
226 | 226 | $possibleTypes, |
227 | - static function (array $map, NamedTypeInterface $type) { |
|
227 | + static function(array $map, NamedTypeInterface $type) { |
|
228 | 228 | $map[$type->getName()] = true; |
229 | 229 | |
230 | 230 | return $map; |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
365 | 365 | foreach ($type->getFields() as $field) { |
366 | 366 | if ($field->hasArguments()) { |
367 | - $fieldArgTypes = \array_map(function (Argument $argument) { |
|
367 | + $fieldArgTypes = \array_map(function(Argument $argument) { |
|
368 | 368 | return $argument->getNullableType(); |
369 | 369 | }, $field->getArguments()); |
370 | 370 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | return $map; |
399 | 399 | } |
400 | 400 | |
401 | - return \array_reduce($directive->getArguments(), function ($map, Argument $argument) { |
|
401 | + return \array_reduce($directive->getArguments(), function($map, Argument $argument) { |
|
402 | 402 | return $this->typeMapReducer($map, $argument->getNullableType()); |
403 | 403 | }, $map); |
404 | 404 | } |