@@ -124,7 +124,7 @@ |
||
124 | 124 | { |
125 | 125 | return arraySome( |
126 | 126 | introspectionTypes(), |
127 | - function (TypeInterface $introspectionType) use ($type) { |
|
127 | + function(TypeInterface $introspectionType) use ($type) { |
|
128 | 128 | /** @noinspection PhpUndefinedMethodInspection */ |
129 | 129 | return $type->getName() === $introspectionType->getName(); |
130 | 130 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected function registerIntrospectionTypes() |
58 | 58 | { |
59 | - $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function () { |
|
59 | + $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function() { |
|
60 | 60 | return GraphQLObjectType([ |
61 | 61 | 'name' => GraphQL::SCHEMA_INTROSPECTION, |
62 | 62 | 'isIntrospection' => true, |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
65 | 65 | 'exposes all available types and directives on the server, as well as ' . |
66 | 66 | 'the entry points for query, mutation, and subscription operations.', |
67 | - 'fields' => function () { |
|
67 | + 'fields' => function() { |
|
68 | 68 | return [ |
69 | 69 | 'types' => [ |
70 | 70 | 'description' => 'A list of all types supported by this server.', |
71 | 71 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))), |
72 | - 'resolve' => function (SchemaInterface $schema): array { |
|
72 | + 'resolve' => function(SchemaInterface $schema): array { |
|
73 | 73 | return array_values($schema->getTypeMap()); |
74 | 74 | }, |
75 | 75 | ], |
76 | 76 | 'queryType' => [ |
77 | 77 | 'description' => 'The type that query operations will be rooted at.', |
78 | 78 | 'type' => GraphQLNonNull(__Type()), |
79 | - 'resolve' => function (SchemaInterface $schema): ?TypeInterface { |
|
79 | + 'resolve' => function(SchemaInterface $schema): ?TypeInterface { |
|
80 | 80 | return $schema->getQueryType(); |
81 | 81 | }, |
82 | 82 | ], |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'If this server supports mutation, the type that ' . |
86 | 86 | 'mutation operations will be rooted at.', |
87 | 87 | 'type' => __Type(), |
88 | - 'resolve' => function (SchemaInterface $schema): ?TypeInterface { |
|
88 | + 'resolve' => function(SchemaInterface $schema): ?TypeInterface { |
|
89 | 89 | return $schema->getMutationType(); |
90 | 90 | }, |
91 | 91 | ], |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | 'If this server support subscription, the type that ' . |
95 | 95 | 'subscription operations will be rooted at.', |
96 | 96 | 'type' => __Type(), |
97 | - 'resolve' => function (SchemaInterface $schema): ?TypeInterface { |
|
97 | + 'resolve' => function(SchemaInterface $schema): ?TypeInterface { |
|
98 | 98 | return $schema->getSubscriptionType(); |
99 | 99 | }, |
100 | 100 | ], |
101 | 101 | 'directives' => [ |
102 | 102 | 'description' => 'A list of all directives supported by this server.', |
103 | 103 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))), |
104 | - 'resolve' => function (SchemaInterface $schema): array { |
|
104 | + 'resolve' => function(SchemaInterface $schema): array { |
|
105 | 105 | return $schema->getDirectives(); |
106 | 106 | }, |
107 | 107 | ], |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]); |
111 | 111 | }, true/* $shared */); |
112 | 112 | |
113 | - $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function () { |
|
113 | + $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function() { |
|
114 | 114 | return GraphQLObjectType([ |
115 | 115 | 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
116 | 116 | 'isIntrospection' => true, |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'execution behavior in ways field arguments will not suffice, such as ' . |
122 | 122 | 'conditionally including or skipping a field. Directives provide this by ' . |
123 | 123 | 'describing additional information to the executor.', |
124 | - 'fields' => function () { |
|
124 | + 'fields' => function() { |
|
125 | 125 | return [ |
126 | 126 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
127 | 127 | 'description' => ['type' => GraphQLString()], |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ], |
131 | 131 | 'args' => [ |
132 | 132 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
133 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
133 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
134 | 134 | return $directive->getArguments() ?: []; |
135 | 135 | }, |
136 | 136 | ], |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ]); |
140 | 140 | }, true/* $shared */); |
141 | 141 | |
142 | - $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function () { |
|
142 | + $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function() { |
|
143 | 143 | return GraphQLEnumType([ |
144 | 144 | 'name' => GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
145 | 145 | 'isIntrospection' => true, |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ]); |
206 | 206 | }, true/* $shared */); |
207 | 207 | |
208 | - $this->container->add(GraphQL::TYPE_INTROSPECTION, function () { |
|
208 | + $this->container->add(GraphQL::TYPE_INTROSPECTION, function() { |
|
209 | 209 | return GraphQLObjectType([ |
210 | 210 | 'name' => GraphQL::TYPE_INTROSPECTION, |
211 | 211 | 'isIntrospection' => true, |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | 'Object and Interface types provide the fields they describe. Abstract ' . |
219 | 219 | 'types, Union and Interface, provide the Object types possible ' . |
220 | 220 | 'at runtime. List and NonNull types compose other types.', |
221 | - 'fields' => function () { |
|
221 | + 'fields' => function() { |
|
222 | 222 | return [ |
223 | 223 | 'kind' => [ |
224 | 224 | 'type' => GraphQLNonNull(__TypeKind()), |
225 | - 'resolve' => function (TypeInterface $type) { |
|
225 | + 'resolve' => function(TypeInterface $type) { |
|
226 | 226 | if ($type instanceof ScalarType) { |
227 | 227 | return TypeKindEnum::SCALAR; |
228 | 228 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'args' => [ |
259 | 259 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
260 | 260 | ], |
261 | - 'resolve' => function (TypeInterface $type, array $args): |
|
261 | + 'resolve' => function(TypeInterface $type, array $args): |
|
262 | 262 | ?array { |
263 | 263 | $includeDeprecated = $args[0] ?? null; |
264 | 264 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $fields = array_values($type->getFields()); |
267 | 267 | |
268 | 268 | if (!$includeDeprecated) { |
269 | - $fields = array_filter($fields, function (Field $field) { |
|
269 | + $fields = array_filter($fields, function(Field $field) { |
|
270 | 270 | return !$field->getIsDeprecated(); |
271 | 271 | }); |
272 | 272 | } |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | ], |
280 | 280 | 'interfaces' => [ |
281 | 281 | 'type' => GraphQLList(GraphQLNonNull(__Type())), |
282 | - 'resolve' => function (TypeInterface $type): ?array { |
|
282 | + 'resolve' => function(TypeInterface $type): ?array { |
|
283 | 283 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
284 | 284 | }, |
285 | 285 | ], |
286 | 286 | 'possibleTypes' => [ |
287 | 287 | 'type' => GraphQLList(GraphQLNonNull(__Type())), |
288 | - 'resolve' => function ( |
|
288 | + 'resolve' => function( |
|
289 | 289 | TypeInterface $type, |
290 | 290 | array $args, |
291 | 291 | array $context, |
@@ -303,14 +303,14 @@ discard block |
||
303 | 303 | 'args' => [ |
304 | 304 | 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false], |
305 | 305 | ], |
306 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
306 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
307 | 307 | [$includeDeprecated] = $args; |
308 | 308 | |
309 | 309 | if ($type instanceof EnumType) { |
310 | 310 | $values = array_values($type->getValues()); |
311 | 311 | |
312 | 312 | if (!$includeDeprecated) { |
313 | - $values = array_filter($values, function (Field $field) { |
|
313 | + $values = array_filter($values, function(Field $field) { |
|
314 | 314 | return !$field->getIsDeprecated(); |
315 | 315 | }); |
316 | 316 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | ], |
324 | 324 | 'inputFields' => [ |
325 | 325 | 'type' => GraphQLList(GraphQLNonNull(__InputValue())), |
326 | - 'resolve' => function (TypeInterface $type): ?array { |
|
326 | + 'resolve' => function(TypeInterface $type): ?array { |
|
327 | 327 | return $type instanceof InputObjectType ? $type->getFields() : null; |
328 | 328 | }, |
329 | 329 | ], |
@@ -333,20 +333,20 @@ discard block |
||
333 | 333 | ]); |
334 | 334 | }, true/* $shared */); |
335 | 335 | |
336 | - $this->container->add(GraphQL::FIELD_INTROSPECTION, function () { |
|
336 | + $this->container->add(GraphQL::FIELD_INTROSPECTION, function() { |
|
337 | 337 | return GraphQLObjectType([ |
338 | 338 | 'name' => GraphQL::FIELD_INTROSPECTION, |
339 | 339 | 'isIntrospection' => true, |
340 | 340 | 'description' => |
341 | 341 | 'Object and Interface types are described by a list of Fields, each of ' . |
342 | 342 | 'which has a name, potentially a list of arguments, and a return type.', |
343 | - 'fields' => function () { |
|
343 | + 'fields' => function() { |
|
344 | 344 | return [ |
345 | 345 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
346 | 346 | 'description' => ['type' => GraphQLString()], |
347 | 347 | 'args' => [ |
348 | 348 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
349 | - 'resolve' => function (ArgumentsAwareInterface $directive): array { |
|
349 | + 'resolve' => function(ArgumentsAwareInterface $directive): array { |
|
350 | 350 | return $directive->getArguments() ?? []; |
351 | 351 | }, |
352 | 352 | ], |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | ]); |
359 | 359 | }, true/* $shared */); |
360 | 360 | |
361 | - $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
|
361 | + $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function() { |
|
362 | 362 | return GraphQLObjectType([ |
363 | 363 | 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
364 | 364 | 'isIntrospection' => true, |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
367 | 367 | 'InputObject are represented as Input Values which describe their type ' . |
368 | 368 | 'and optionally a default value.', |
369 | - 'fields' => function () { |
|
369 | + 'fields' => function() { |
|
370 | 370 | return [ |
371 | 371 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
372 | 372 | 'description' => ['type' => GraphQLString()], |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | 'description' => |
377 | 377 | 'A GraphQL-formatted string representing the default value for this ' . |
378 | 378 | 'input value.', |
379 | - 'resolve' => function ($inputValue) { |
|
379 | + 'resolve' => function($inputValue) { |
|
380 | 380 | // TODO: Implement this when we have support for printing AST. |
381 | 381 | return null; |
382 | 382 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | ]); |
387 | 387 | }, true/* $shared */); |
388 | 388 | |
389 | - $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
|
389 | + $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function() { |
|
390 | 390 | return GraphQLObjectType([ |
391 | 391 | 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
392 | 392 | 'isIntrospection' => true, |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
395 | 395 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
396 | 396 | 'returned in a JSON response as a string.', |
397 | - 'fields' => function () { |
|
397 | + 'fields' => function() { |
|
398 | 398 | return [ |
399 | 399 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
400 | 400 | 'description' => ['type' => GraphQLString()], |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | ]); |
406 | 406 | }, true/* $shared */); |
407 | 407 | |
408 | - $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
|
408 | + $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function() { |
|
409 | 409 | return GraphQLEnumType([ |
410 | 410 | 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
411 | 411 | 'isIntrospection' => true, |
@@ -445,19 +445,19 @@ discard block |
||
445 | 445 | */ |
446 | 446 | protected function registerMetaFields() |
447 | 447 | { |
448 | - $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, function ($__Schema) { |
|
448 | + $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, function($__Schema) { |
|
449 | 449 | return new Field([ |
450 | 450 | 'name' => '__schema', |
451 | 451 | 'type' => GraphQLNonNull($__Schema), |
452 | 452 | 'description' => 'Access the current type schema of this server.', |
453 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): SchemaInterface { |
|
453 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): SchemaInterface { |
|
454 | 454 | return $info->getSchema(); |
455 | 455 | } |
456 | 456 | ]); |
457 | 457 | }) |
458 | 458 | ->withArgument(GraphQL::SCHEMA_INTROSPECTION); |
459 | 459 | |
460 | - $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, function ($__Type) { |
|
460 | + $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, function($__Type) { |
|
461 | 461 | return new Field([ |
462 | 462 | 'name' => '__type', |
463 | 463 | 'type' => $__Type, |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | 'args' => [ |
466 | 466 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
467 | 467 | ], |
468 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): TypeInterface { |
|
468 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): TypeInterface { |
|
469 | 469 | ['name' => $name] = $args; |
470 | 470 | $schema = $info->getSchema(); |
471 | 471 | return $schema->getType($name); |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | }) |
475 | 475 | ->withArgument(GraphQL::TYPE_INTROSPECTION); |
476 | 476 | |
477 | - $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function () { |
|
477 | + $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function() { |
|
478 | 478 | return new Field([ |
479 | 479 | 'name' => '__typename', |
480 | 480 | 'type' => GraphQLNonNull(GraphQLString()), |
481 | 481 | 'description' => 'The name of the current Object type at runtime.', |
482 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): string { |
|
482 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): string { |
|
483 | 483 | $parentType = $info->getParentType(); |
484 | 484 | return null !== $parentType ? $parentType->getName() : null; |
485 | 485 | } |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function register() |
33 | 33 | { |
34 | - $this->container->add(ASTDirectorInterface::class, function () { |
|
34 | + $this->container->add(ASTDirectorInterface::class, function() { |
|
35 | 35 | return new ASTDirector(SupportedASTBuilders::get()); |
36 | 36 | }); |
37 | 37 | |
38 | - $this->container->add(NodeDirectorInterface::class, function () { |
|
38 | + $this->container->add(NodeDirectorInterface::class, function() { |
|
39 | 39 | return new NodeDirector(SupportedNodeBuilders::get()); |
40 | 40 | }); |
41 | 41 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ->withArgument(ASTDirectorInterface::class) |
44 | 44 | ->withArgument(NodeDirectorInterface::class); |
45 | 45 | |
46 | - $this->container->add(LexerInterface::class, function () { |
|
46 | + $this->container->add(LexerInterface::class, function() { |
|
47 | 47 | return new Lexer(SupportedReaders::get()); |
48 | 48 | }); |
49 | 49 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $name = $this->buildAST(ASTKindEnum::NAME, $lexer); |
31 | 31 | $interfaces = $this->buildAST(ASTKindEnum::IMPLEMENTS_INTERFACES, $lexer); |
32 | 32 | $directives = $this->buildAST(ASTKindEnum::DIRECTIVES, $lexer); |
33 | - $fields = $this->buildAST(ASTKindEnum::FIELDS_DEFINITION, $lexer);; |
|
33 | + $fields = $this->buildAST(ASTKindEnum::FIELDS_DEFINITION, $lexer); ; |
|
34 | 34 | |
35 | 35 | if (count($interfaces) === 0 && count($directives) === 0 && count($fields) === 0) { |
36 | 36 | throw $this->unexpected($lexer); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | $this->expectKeyword($lexer, KeywordEnum::FRAGMENT); |
28 | 28 | |
29 | - $parseTypeCondition = function (LexerInterface $lexer) { |
|
29 | + $parseTypeCondition = function(LexerInterface $lexer) { |
|
30 | 30 | $this->expectKeyword($lexer, 'on'); |
31 | 31 | return $this->buildAST(ASTKindEnum::NAMED_TYPE, $lexer); |
32 | 32 | }; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function build(LexerInterface $lexer, array $params): ?array |
22 | 22 | { |
23 | - $parseFunction = function (LexerInterface $lexer): array { |
|
23 | + $parseFunction = function(LexerInterface $lexer): array { |
|
24 | 24 | return $this->buildAST(ASTKindEnum::INPUT_VALUE_DEFINITION, $lexer); |
25 | 25 | }; |
26 | 26 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return mixed |
42 | 42 | * @throws SyntaxErrorException |
43 | 43 | */ |
44 | - $parseType = function (LexerInterface $lexer) { |
|
44 | + $parseType = function(LexerInterface $lexer) { |
|
45 | 45 | $this->expect($lexer, TokenKindEnum::COLON); |
46 | 46 | return $this->buildAST(ASTKindEnum::TYPE_REFERENCE, $lexer); |
47 | 47 | }; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function build(LexerInterface $lexer, array $params): ?array |
22 | 22 | { |
23 | - $parseFunction = function (LexerInterface $lexer): array { |
|
23 | + $parseFunction = function(LexerInterface $lexer): array { |
|
24 | 24 | return $this->buildAST(ASTKindEnum::INPUT_VALUE_DEFINITION, $lexer); |
25 | 25 | }; |
26 | 26 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return mixed |
53 | 53 | * @throws SyntaxErrorException |
54 | 54 | */ |
55 | - $parseValue = function (LexerInterface $lexer) { |
|
55 | + $parseValue = function(LexerInterface $lexer) { |
|
56 | 56 | $this->expect($lexer, TokenKindEnum::COLON); |
57 | 57 | return $this->buildAST(ASTKindEnum::VALUE_LITERAL, $lexer); |
58 | 58 | }; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return mixed |
80 | 80 | * @throws SyntaxErrorException |
81 | 81 | */ |
82 | - $parseValue = function (LexerInterface $lexer) { |
|
82 | + $parseValue = function(LexerInterface $lexer) { |
|
83 | 83 | $this->expect($lexer, TokenKindEnum::COLON); |
84 | 84 | return $this->buildAST(ASTKindEnum::VALUE_LITERAL, $lexer); |
85 | 85 | }; |