@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function register() |
| 57 | 57 | { |
| 58 | - $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function () { |
|
| 58 | + $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function() { |
|
| 59 | 59 | return GraphQLObjectType([ |
| 60 | 60 | 'name' => GraphQL::INTROSPECTION_SCHEMA, |
| 61 | 61 | 'isIntrospection' => true, |
@@ -63,19 +63,19 @@ discard block |
||
| 63 | 63 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
| 64 | 64 | 'exposes all available types and directives on the server, as well as ' . |
| 65 | 65 | 'the entry points for query, mutation, and subscription operations.', |
| 66 | - 'fields' => function () { |
|
| 66 | + 'fields' => function() { |
|
| 67 | 67 | return [ |
| 68 | 68 | 'types' => [ |
| 69 | 69 | 'description' => 'A list of all types supported by this server.', |
| 70 | 70 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))), |
| 71 | - 'resolve' => function (SchemaInterface $schema): array { |
|
| 71 | + 'resolve' => function(SchemaInterface $schema): array { |
|
| 72 | 72 | return array_values($schema->getTypeMap()); |
| 73 | 73 | }, |
| 74 | 74 | ], |
| 75 | 75 | 'queryType' => [ |
| 76 | 76 | 'description' => 'The type that query operations will be rooted at.', |
| 77 | 77 | 'type' => GraphQLNonNull(__Type()), |
| 78 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
| 78 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
| 79 | 79 | return $schema->getQuery(); |
| 80 | 80 | }, |
| 81 | 81 | ], |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'If this server supports mutation, the type that ' . |
| 85 | 85 | 'mutation operations will be rooted at.', |
| 86 | 86 | 'type' => __Type(), |
| 87 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
| 87 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
| 88 | 88 | return $schema->getMutation(); |
| 89 | 89 | }, |
| 90 | 90 | ], |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | 'If this server support subscription, the type that ' . |
| 94 | 94 | 'subscription operations will be rooted at.', |
| 95 | 95 | 'type' => __Type(), |
| 96 | - 'resolve' => function (SchemaInterface $schema): ObjectType { |
|
| 96 | + 'resolve' => function(SchemaInterface $schema): ObjectType { |
|
| 97 | 97 | return $schema->getSubscription(); |
| 98 | 98 | }, |
| 99 | 99 | ], |
| 100 | 100 | 'directives' => [ |
| 101 | 101 | 'description' => 'A list of all directives supported by this server.', |
| 102 | 102 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))), |
| 103 | - 'resolve' => function (SchemaInterface $schema): array { |
|
| 103 | + 'resolve' => function(SchemaInterface $schema): array { |
|
| 104 | 104 | return $schema->getDirectives(); |
| 105 | 105 | }, |
| 106 | 106 | ], |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | ]); |
| 110 | 110 | }, true/* $shared */); |
| 111 | 111 | |
| 112 | - $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function () { |
|
| 112 | + $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function() { |
|
| 113 | 113 | return GraphQLObjectType([ |
| 114 | 114 | 'name' => GraphQL::INTROSPECTION_DIRECTIVE, |
| 115 | 115 | 'isIntrospection' => true, |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | 'execution behavior in ways field arguments will not suffice, such as ' . |
| 121 | 121 | 'conditionally including or skipping a field. Directives provide this by ' . |
| 122 | 122 | 'describing additional information to the executor.', |
| 123 | - 'fields' => function () { |
|
| 123 | + 'fields' => function() { |
|
| 124 | 124 | return [ |
| 125 | 125 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 126 | 126 | 'description' => ['type' => GraphQLString()], |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | ], |
| 130 | 130 | 'args' => [ |
| 131 | 131 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
| 132 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
| 132 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
| 133 | 133 | return $directive->getArguments() ?: []; |
| 134 | 134 | }, |
| 135 | 135 | ], |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | ]); |
| 139 | 139 | }, true/* $shared */); |
| 140 | 140 | |
| 141 | - $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function () { |
|
| 141 | + $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function() { |
|
| 142 | 142 | return GraphQLEnumType([ |
| 143 | 143 | 'name' => GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, |
| 144 | 144 | 'isIntrospection' => true, |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | ]); |
| 205 | 205 | }, true/* $shared */); |
| 206 | 206 | |
| 207 | - $this->container->add(GraphQL::INTROSPECTION_TYPE, function () { |
|
| 207 | + $this->container->add(GraphQL::INTROSPECTION_TYPE, function() { |
|
| 208 | 208 | return GraphQLObjectType([ |
| 209 | 209 | 'name' => GraphQL::INTROSPECTION_TYPE, |
| 210 | 210 | 'isIntrospection' => true, |
@@ -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 | [$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 | [$schema] = $info; |
| 289 | 289 | /** @noinspection PhpParamsInspection */ |
@@ -295,14 +295,14 @@ discard block |
||
| 295 | 295 | 'args' => [ |
| 296 | 296 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
| 297 | 297 | ], |
| 298 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
| 298 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
| 299 | 299 | [$includeDeprecated] = $args; |
| 300 | 300 | |
| 301 | 301 | if ($type instanceof EnumType) { |
| 302 | 302 | $values = array_values($type->getValues()); |
| 303 | 303 | |
| 304 | 304 | if (!$includeDeprecated) { |
| 305 | - $values = array_filter($values, function (Field $field) { |
|
| 305 | + $values = array_filter($values, function(Field $field) { |
|
| 306 | 306 | return !$field->isDeprecated(); |
| 307 | 307 | }); |
| 308 | 308 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | ], |
| 316 | 316 | 'inputFields' => [ |
| 317 | 317 | 'type' => GraphQLList(GraphQLNonNull(__InputValue())), |
| 318 | - 'resolve' => function (TypeInterface $type): ?array { |
|
| 318 | + 'resolve' => function(TypeInterface $type): ?array { |
|
| 319 | 319 | return $type instanceof InputObjectType ? $type->getFields() : null; |
| 320 | 320 | }, |
| 321 | 321 | ], |
@@ -325,20 +325,20 @@ discard block |
||
| 325 | 325 | ]); |
| 326 | 326 | }, true/* $shared */); |
| 327 | 327 | |
| 328 | - $this->container->add(GraphQL::INTROSPECTION_FIELD, function () { |
|
| 328 | + $this->container->add(GraphQL::INTROSPECTION_FIELD, function() { |
|
| 329 | 329 | return GraphQLObjectType([ |
| 330 | 330 | 'name' => GraphQL::INTROSPECTION_FIELD, |
| 331 | 331 | 'isIntrospection' => true, |
| 332 | 332 | 'description' => |
| 333 | 333 | 'Object and Interface types are described by a list of Fields, each of ' . |
| 334 | 334 | 'which has a name, potentially a list of arguments, and a return type.', |
| 335 | - 'fields' => function () { |
|
| 335 | + 'fields' => function() { |
|
| 336 | 336 | return [ |
| 337 | 337 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 338 | 338 | 'description' => ['type' => GraphQLString()], |
| 339 | 339 | 'args' => [ |
| 340 | 340 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
| 341 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
| 341 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
| 342 | 342 | return $directive->getArguments() ?: []; |
| 343 | 343 | }, |
| 344 | 344 | ], |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | ]); |
| 351 | 351 | }, true/* $shared */); |
| 352 | 352 | |
| 353 | - $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function () { |
|
| 353 | + $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function() { |
|
| 354 | 354 | return GraphQLObjectType([ |
| 355 | 355 | 'name' => GraphQL::INTROSPECTION_INPUT_VALUE, |
| 356 | 356 | 'isIntrospection' => true, |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
| 359 | 359 | 'InputObject are represented as Input Values which describe their type ' . |
| 360 | 360 | 'and optionally a default value.', |
| 361 | - 'fields' => function () { |
|
| 361 | + 'fields' => function() { |
|
| 362 | 362 | return [ |
| 363 | 363 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 364 | 364 | 'description' => ['type' => GraphQLString()], |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | 'description' => |
| 369 | 369 | 'A GraphQL-formatted string representing the default value for this ' . |
| 370 | 370 | 'input value.', |
| 371 | - 'resolve' => function ($inputValue) { |
|
| 371 | + 'resolve' => function($inputValue) { |
|
| 372 | 372 | // TODO: Implement this when we have support for printing AST. |
| 373 | 373 | return null; |
| 374 | 374 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | ]); |
| 379 | 379 | }, true/* $shared */); |
| 380 | 380 | |
| 381 | - $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function () { |
|
| 381 | + $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function() { |
|
| 382 | 382 | return GraphQLObjectType([ |
| 383 | 383 | 'name' => GraphQL::INTROSPECTION_ENUM_VALUE, |
| 384 | 384 | 'isIntrospection' => true, |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
| 387 | 387 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
| 388 | 388 | 'returned in a JSON response as a string.', |
| 389 | - 'fields' => function () { |
|
| 389 | + 'fields' => function() { |
|
| 390 | 390 | return [ |
| 391 | 391 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 392 | 392 | 'description' => ['type' => GraphQLString()], |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | ]); |
| 398 | 398 | }, true/* $shared */); |
| 399 | 399 | |
| 400 | - $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function () { |
|
| 400 | + $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function() { |
|
| 401 | 401 | return GraphQLEnumType([ |
| 402 | 402 | 'name' => GraphQL::INTROSPECTION_TYPE_KIND, |
| 403 | 403 | 'isIntrospection' => true, |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $this->container->add(DefinitionBuilderInterface::class, DefinitionBuilder::class, true/* $shared */) |
| 31 | 31 | ->withArguments([ |
| 32 | - function (NamedTypeNode $node) { |
|
| 32 | + function(NamedTypeNode $node) { |
|
| 33 | 33 | throw new InvalidTypeException(sprintf('Type "%s" not found in document.', $node->getNameValue())); |
| 34 | 34 | }, |
| 35 | 35 | CacheInterface::class, |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * @return mixed |
| 435 | 435 | * @throws SyntaxErrorException |
| 436 | 436 | */ |
| 437 | - $parseType = function (LexerInterface $lexer) { |
|
| 437 | + $parseType = function(LexerInterface $lexer) { |
|
| 438 | 438 | $this->expect($lexer, TokenKindEnum::COLON); |
| 439 | 439 | return $this->parseTypeReference($lexer); |
| 440 | 440 | }; |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | * @return mixed |
| 565 | 565 | * @throws SyntaxErrorException |
| 566 | 566 | */ |
| 567 | - $parseValue = function (LexerInterface $lexer) { |
|
| 567 | + $parseValue = function(LexerInterface $lexer) { |
|
| 568 | 568 | $this->expect($lexer, TokenKindEnum::COLON); |
| 569 | 569 | return $this->parseValueLiteral($lexer, false); |
| 570 | 570 | }; |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | * @return mixed |
| 592 | 592 | * @throws SyntaxErrorException |
| 593 | 593 | */ |
| 594 | - $parseValue = function (LexerInterface $lexer) { |
|
| 594 | + $parseValue = function(LexerInterface $lexer) { |
|
| 595 | 595 | $this->expect($lexer, TokenKindEnum::COLON); |
| 596 | 596 | return $this->parseConstValue($lexer); |
| 597 | 597 | }; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | $this->expectKeyword($lexer, KeywordEnum::FRAGMENT); |
| 654 | 654 | |
| 655 | - $parseTypeCondition = function (LexerInterface $lexer) { |
|
| 655 | + $parseTypeCondition = function(LexerInterface $lexer) { |
|
| 656 | 656 | $this->expectKeyword($lexer, 'on'); |
| 657 | 657 | return $this->parseNamedType($lexer); |
| 658 | 658 | }; |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | { |
| 849 | 849 | $start = $lexer->getToken(); |
| 850 | 850 | |
| 851 | - $parseValue = function (LexerInterface $lexer, bool $isConst) { |
|
| 851 | + $parseValue = function(LexerInterface $lexer, bool $isConst) { |
|
| 852 | 852 | $this->expect($lexer, TokenKindEnum::COLON); |
| 853 | 853 | return $this->parseValueLiteral($lexer, $isConst); |
| 854 | 854 | }; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function register() |
| 26 | 26 | { |
| 27 | - $this->container->add(ExecutionInterface::class, function () { |
|
| 27 | + $this->container->add(ExecutionInterface::class, function() { |
|
| 28 | 28 | return new Execution(); |
| 29 | 29 | }); |
| 30 | 30 | } |