@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | return $this->printFilteredSchema( |
47 | 47 | $schema, |
48 | - function (Directive $directive): bool { |
|
48 | + function(Directive $directive): bool { |
|
49 | 49 | return !isSpecifiedDirective($directive); |
50 | 50 | }, |
51 | - function (NamedTypeInterface $type): bool { |
|
51 | + function(NamedTypeInterface $type): bool { |
|
52 | 52 | return !isSpecifiedScalarType($type) && !isIntrospectionType($type); |
53 | 53 | } |
54 | 54 | ); |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | |
66 | 66 | return $this->printFilteredSchema( |
67 | 67 | $schema, |
68 | - function (Directive $directive): bool { |
|
68 | + function(Directive $directive): bool { |
|
69 | 69 | return isSpecifiedDirective($directive); |
70 | 70 | }, |
71 | - function (NamedTypeInterface $type): bool { |
|
71 | + function(NamedTypeInterface $type): bool { |
|
72 | 72 | return isIntrospectionType($type); |
73 | 73 | } |
74 | 74 | ); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $types = \array_filter(\array_values($schema->getTypeMap()), $filter); |
137 | 137 | |
138 | - \usort($types, function (NamedTypeInterface $typeA, NamedTypeInterface $typeB) { |
|
138 | + \usort($types, function(NamedTypeInterface $typeA, NamedTypeInterface $typeB) { |
|
139 | 139 | return \strcasecmp($typeA->getName(), $typeB->getName()); |
140 | 140 | }); |
141 | 141 | |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | $description = $this->printDescription($type); |
262 | 262 | $name = $type->getName(); |
263 | 263 | $implements = $type->hasInterfaces() |
264 | - ? ' implements ' . printArray(' & ', \array_map(function (InterfaceType $interface) { |
|
264 | + ? ' implements ' . printArray(' & ', \array_map(function(InterfaceType $interface) { |
|
265 | 265 | return $interface->getName(); |
266 | 266 | }, $type->getInterfaces())) |
267 | 267 | : ''; |
268 | - $fields = $this->printFields($type->getFields()); |
|
268 | + $fields = $this->printFields($type->getFields()); |
|
269 | 269 | |
270 | 270 | return printLines([ |
271 | 271 | $description, |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | protected function printEnumValues(array $values): string |
331 | 331 | { |
332 | - return printLines(\array_map(function (EnumValue $value): string { |
|
332 | + return printLines(\array_map(function(EnumValue $value): string { |
|
333 | 333 | $description = $this->printDescription($value, ' '); |
334 | 334 | $name = $value->getName(); |
335 | 335 | $deprecated = $this->printDeprecated($value); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | protected function printInputObjectType(InputObjectType $type): string |
351 | 351 | { |
352 | 352 | $description = $this->printDescription($type); |
353 | - $fields = \array_map(function (InputField $field): string { |
|
353 | + $fields = \array_map(function(InputField $field): string { |
|
354 | 354 | $description = $this->printDescription($field, ' '); |
355 | 355 | $inputValue = $this->printInputValue($field); |
356 | 356 | return printLines([ |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | protected function printFields(array $fields): string |
393 | 393 | { |
394 | - return printLines(\array_map(function (Field $field): string { |
|
394 | + return printLines(\array_map(function(Field $field): string { |
|
395 | 395 | $description = $this->printDescription($field); |
396 | 396 | $name = $field->getName(); |
397 | 397 | $arguments = $this->printArguments($field->getArguments()); |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | } |
412 | 412 | |
413 | 413 | // If every arg does not have a description, print them on one line. |
414 | - if (arrayEvery($arguments, function (Argument $argument): bool { |
|
414 | + if (arrayEvery($arguments, function(Argument $argument): bool { |
|
415 | 415 | return !$argument->hasDescription(); |
416 | 416 | })) { |
417 | - return printInputFields(\array_map(function (Argument $argument) { |
|
417 | + return printInputFields(\array_map(function(Argument $argument) { |
|
418 | 418 | return $this->printInputValue($argument); |
419 | 419 | }, $arguments)); |
420 | 420 | } |
421 | 421 | |
422 | - $args = \array_map(function (Argument $argument) use ($indentation) { |
|
422 | + $args = \array_map(function(Argument $argument) use ($indentation) { |
|
423 | 423 | $description = $this->printDescription($argument); |
424 | 424 | $inputValue = $this->printInputValue($argument); |
425 | 425 | return printLines([ |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | */ |
548 | 548 | protected function printMany(array $definitions): array |
549 | 549 | { |
550 | - return \array_map(function ($definition) { |
|
550 | + return \array_map(function($definition) { |
|
551 | 551 | return $this->print($definition); |
552 | 552 | }, $definitions); |
553 | 553 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function registerIntrospectionTypes() |
59 | 59 | { |
60 | - $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function () { |
|
60 | + $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function() { |
|
61 | 61 | return newObjectType([ |
62 | 62 | 'name' => GraphQL::SCHEMA_INTROSPECTION, |
63 | 63 | 'isIntrospection' => true, |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
66 | 66 | 'exposes all available types and directives on the server, as well as ' . |
67 | 67 | 'the entry points for query, mutation, and subscription operations.', |
68 | - 'fields' => function () { |
|
68 | + 'fields' => function() { |
|
69 | 69 | return [ |
70 | 70 | 'types' => [ |
71 | 71 | 'description' => 'A list of all types supported by this server.', |
72 | 72 | 'type' => newNonNull(newList(newNonNull(__Type()))), |
73 | - 'resolve' => function (Schema $schema): array { |
|
73 | + 'resolve' => function(Schema $schema): array { |
|
74 | 74 | return \array_values($schema->getTypeMap()); |
75 | 75 | }, |
76 | 76 | ], |
77 | 77 | 'queryType' => [ |
78 | 78 | 'description' => 'The type that query operations will be rooted at.', |
79 | 79 | 'type' => newNonNull(__Type()), |
80 | - 'resolve' => function (Schema $schema): ?TypeInterface { |
|
80 | + 'resolve' => function(Schema $schema): ?TypeInterface { |
|
81 | 81 | return $schema->getQueryType(); |
82 | 82 | }, |
83 | 83 | ], |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'If this server supports mutation, the type that ' . |
87 | 87 | 'mutation operations will be rooted at.', |
88 | 88 | 'type' => __Type(), |
89 | - 'resolve' => function (Schema $schema): ?TypeInterface { |
|
89 | + 'resolve' => function(Schema $schema): ?TypeInterface { |
|
90 | 90 | return $schema->getMutationType(); |
91 | 91 | }, |
92 | 92 | ], |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | 'If this server support subscription, the type that ' . |
96 | 96 | 'subscription operations will be rooted at.', |
97 | 97 | 'type' => __Type(), |
98 | - 'resolve' => function (Schema $schema): ?TypeInterface { |
|
98 | + 'resolve' => function(Schema $schema): ?TypeInterface { |
|
99 | 99 | return $schema->getSubscriptionType(); |
100 | 100 | }, |
101 | 101 | ], |
102 | 102 | 'directives' => [ |
103 | 103 | 'description' => 'A list of all directives supported by this server.', |
104 | 104 | 'type' => newNonNull(newList(newNonNull(__Directive()))), |
105 | - 'resolve' => function (Schema $schema): array { |
|
105 | + 'resolve' => function(Schema $schema): array { |
|
106 | 106 | return $schema->getDirectives(); |
107 | 107 | }, |
108 | 108 | ], |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ]); |
112 | 112 | }, true/* $shared */); |
113 | 113 | |
114 | - $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function () { |
|
114 | + $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function() { |
|
115 | 115 | return newObjectType([ |
116 | 116 | 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
117 | 117 | 'isIntrospection' => true, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'execution behavior in ways field arguments will not suffice, such as ' . |
123 | 123 | 'conditionally including or skipping a field. Directives provide this by ' . |
124 | 124 | 'describing additional information to the executor.', |
125 | - 'fields' => function () { |
|
125 | + 'fields' => function() { |
|
126 | 126 | return [ |
127 | 127 | 'name' => ['type' => newNonNull(stringType())], |
128 | 128 | 'description' => ['type' => stringType()], |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ], |
132 | 132 | 'args' => [ |
133 | 133 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
134 | - 'resolve' => function (Directive $directive): array { |
|
134 | + 'resolve' => function(Directive $directive): array { |
|
135 | 135 | return $directive->getArguments() ?: []; |
136 | 136 | }, |
137 | 137 | ], |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ]); |
141 | 141 | }, true/* $shared */); |
142 | 142 | |
143 | - $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function () { |
|
143 | + $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function() { |
|
144 | 144 | return newEnumType([ |
145 | 145 | 'name' => GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
146 | 146 | 'isIntrospection' => true, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | ]); |
207 | 207 | }, true/* $shared */); |
208 | 208 | |
209 | - $this->container->add(GraphQL::TYPE_INTROSPECTION, function () { |
|
209 | + $this->container->add(GraphQL::TYPE_INTROSPECTION, function() { |
|
210 | 210 | return newObjectType([ |
211 | 211 | 'name' => GraphQL::TYPE_INTROSPECTION, |
212 | 212 | 'isIntrospection' => true, |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | 'Object and Interface types provide the fields they describe. Abstract ' . |
220 | 220 | 'types, Union and Interface, provide the Object types possible ' . |
221 | 221 | 'at runtime. List and NonNull types compose other types.', |
222 | - 'fields' => function () { |
|
222 | + 'fields' => function() { |
|
223 | 223 | return [ |
224 | 224 | 'kind' => [ |
225 | 225 | 'type' => newNonNull(__TypeKind()), |
226 | - 'resolve' => function (TypeInterface $type) { |
|
226 | + 'resolve' => function(TypeInterface $type) { |
|
227 | 227 | if ($type instanceof ScalarType) { |
228 | 228 | return TypeKindEnum::SCALAR; |
229 | 229 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | 'args' => [ |
260 | 260 | 'includeDeprecated' => ['type' => booleanType(), 'defaultValue' => false], |
261 | 261 | ], |
262 | - 'resolve' => function (TypeInterface $type, array $args): |
|
262 | + 'resolve' => function(TypeInterface $type, array $args): |
|
263 | 263 | ?array { |
264 | 264 | ['includeDeprecated' => $includeDeprecated] = $args; |
265 | 265 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $fields = \array_values($type->getFields()); |
268 | 268 | |
269 | 269 | if (!$includeDeprecated) { |
270 | - $fields = \array_filter($fields, function (Field $field) { |
|
270 | + $fields = \array_filter($fields, function(Field $field) { |
|
271 | 271 | return !$field->isDeprecated(); |
272 | 272 | }); |
273 | 273 | } |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | ], |
281 | 281 | 'interfaces' => [ |
282 | 282 | 'type' => newList(newNonNull(__Type())), |
283 | - 'resolve' => function (TypeInterface $type): ?array { |
|
283 | + 'resolve' => function(TypeInterface $type): ?array { |
|
284 | 284 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
285 | 285 | }, |
286 | 286 | ], |
287 | 287 | 'possibleTypes' => [ |
288 | 288 | 'type' => newList(newNonNull(__Type())), |
289 | - 'resolve' => function ( |
|
289 | + 'resolve' => function( |
|
290 | 290 | TypeInterface $type, |
291 | 291 | array $args, |
292 | 292 | array $context, |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | 'args' => [ |
305 | 305 | 'includeDeprecated' => ['type' => booleanType(), 'defaultValue' => false], |
306 | 306 | ], |
307 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
307 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
308 | 308 | ['includeDeprecated' => $includeDeprecated] = $args; |
309 | 309 | |
310 | 310 | if ($type instanceof EnumType) { |
311 | 311 | $values = \array_values($type->getValues()); |
312 | 312 | |
313 | 313 | if (!$includeDeprecated) { |
314 | - $values = \array_filter($values, function (Field $field) { |
|
314 | + $values = \array_filter($values, function(Field $field) { |
|
315 | 315 | return !$field->isDeprecated(); |
316 | 316 | }); |
317 | 317 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | ], |
325 | 325 | 'inputFields' => [ |
326 | 326 | 'type' => newList(newNonNull(__InputValue())), |
327 | - 'resolve' => function (TypeInterface $type): ?array { |
|
327 | + 'resolve' => function(TypeInterface $type): ?array { |
|
328 | 328 | return $type instanceof InputObjectType ? $type->getFields() : null; |
329 | 329 | }, |
330 | 330 | ], |
@@ -334,20 +334,20 @@ discard block |
||
334 | 334 | ]); |
335 | 335 | }, true/* $shared */); |
336 | 336 | |
337 | - $this->container->add(GraphQL::FIELD_INTROSPECTION, function () { |
|
337 | + $this->container->add(GraphQL::FIELD_INTROSPECTION, function() { |
|
338 | 338 | return newObjectType([ |
339 | 339 | 'name' => GraphQL::FIELD_INTROSPECTION, |
340 | 340 | 'isIntrospection' => true, |
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' => newNonNull(stringType())], |
347 | 347 | 'description' => ['type' => stringType()], |
348 | 348 | 'args' => [ |
349 | 349 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
350 | - 'resolve' => function (ArgumentsAwareInterface $directive): array { |
|
350 | + 'resolve' => function(ArgumentsAwareInterface $directive): array { |
|
351 | 351 | return $directive->getArguments() ?? []; |
352 | 352 | }, |
353 | 353 | ], |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | ]); |
360 | 360 | }, true/* $shared */); |
361 | 361 | |
362 | - $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
|
362 | + $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function() { |
|
363 | 363 | return newObjectType([ |
364 | 364 | 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
365 | 365 | 'isIntrospection' => true, |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
368 | 368 | 'InputObject are represented as Input Values which describe their type ' . |
369 | 369 | 'and optionally a default value.', |
370 | - 'fields' => function () { |
|
370 | + 'fields' => function() { |
|
371 | 371 | return [ |
372 | 372 | 'name' => ['type' => newNonNull(stringType())], |
373 | 373 | 'description' => ['type' => stringType()], |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'description' => |
378 | 378 | 'A GraphQL-formatted string representing the default value for this ' . |
379 | 379 | 'input value.', |
380 | - 'resolve' => function (/*$inputValue*/) { |
|
380 | + 'resolve' => function(/*$inputValue*/) { |
|
381 | 381 | // TODO: Implement this when we have support for printing AST. |
382 | 382 | return null; |
383 | 383 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ]); |
388 | 388 | }, true/* $shared */); |
389 | 389 | |
390 | - $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
|
390 | + $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function() { |
|
391 | 391 | return newObjectType([ |
392 | 392 | 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
393 | 393 | 'isIntrospection' => true, |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
396 | 396 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
397 | 397 | 'returned in a JSON response as a string.', |
398 | - 'fields' => function () { |
|
398 | + 'fields' => function() { |
|
399 | 399 | return [ |
400 | 400 | 'name' => ['type' => newNonNull(stringType())], |
401 | 401 | 'description' => ['type' => stringType()], |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | ]); |
407 | 407 | }, true/* $shared */); |
408 | 408 | |
409 | - $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
|
409 | + $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function() { |
|
410 | 410 | return newEnumType([ |
411 | 411 | 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
412 | 412 | 'isIntrospection' => true, |
@@ -446,25 +446,25 @@ discard block |
||
446 | 446 | */ |
447 | 447 | protected function registerMetaFields() |
448 | 448 | { |
449 | - $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, function ($__Schema) { |
|
449 | + $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, function($__Schema) { |
|
450 | 450 | return newField([ |
451 | 451 | 'name' => '__schema', |
452 | 452 | 'description' => 'Access the current type schema of this server.', |
453 | 453 | 'type' => newNonNull($__Schema), |
454 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): Schema { |
|
454 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): Schema { |
|
455 | 455 | return $info->getSchema(); |
456 | 456 | }, |
457 | 457 | ]); |
458 | 458 | }) |
459 | 459 | ->withArgument(GraphQL::SCHEMA_INTROSPECTION); |
460 | 460 | |
461 | - $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, function ($__Type) { |
|
461 | + $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, function($__Type) { |
|
462 | 462 | return newField([ |
463 | 463 | 'name' => '__type', |
464 | 464 | 'description' => 'Request the type information of a single type.', |
465 | 465 | 'type' => $__Type, |
466 | 466 | 'args' => ['name' => ['type' => newNonNull(stringType())]], |
467 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): ?TypeInterface { |
|
467 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): ?TypeInterface { |
|
468 | 468 | ['name' => $name] = $args; |
469 | 469 | return $info->getSchema()->getType($name); |
470 | 470 | }, |
@@ -472,12 +472,12 @@ discard block |
||
472 | 472 | }) |
473 | 473 | ->withArgument(GraphQL::TYPE_INTROSPECTION); |
474 | 474 | |
475 | - $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function () { |
|
475 | + $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function() { |
|
476 | 476 | return newField([ |
477 | 477 | 'name' => '__typename', |
478 | 478 | 'description' => 'The name of the current Object type at runtime.', |
479 | 479 | 'type' => newNonNull(stringType()), |
480 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): string { |
|
480 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): string { |
|
481 | 481 | return $info->getParentType()->getName(); |
482 | 482 | }, |
483 | 483 | ]); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | if (null !== $fieldDefinition && null !== $parentType) { |
56 | 56 | /** @noinspection PhpUnhandledExceptionInspection */ |
57 | - $options = \array_map(function (Argument $argument) { |
|
57 | + $options = \array_map(function(Argument $argument) { |
|
58 | 58 | return $argument->getName(); |
59 | 59 | }, $fieldDefinition->getArguments()); |
60 | 60 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | if (null !== $directive) { |
88 | 88 | /** @noinspection PhpUnhandledExceptionInspection */ |
89 | - $options = \array_map(function (Argument $argument) { |
|
89 | + $options = \array_map(function(Argument $argument) { |
|
90 | 90 | return $argument->getName(); |
91 | 91 | }, $directive->getArguments()); |
92 | 92 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return $coercedValues; |
58 | 58 | } |
59 | 59 | |
60 | - $argumentNodeMap = keyMap($argumentNodes, function (ArgumentNode $value) { |
|
60 | + $argumentNodeMap = keyMap($argumentNodes, function(ArgumentNode $value) { |
|
61 | 61 | return $value->getNameValue(); |
62 | 62 | }); |
63 | 63 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | array $variableValues = [] |
131 | 131 | ): ?array { |
132 | 132 | $directiveNode = $node->hasDirectives() |
133 | - ? find($node->getDirectives(), function (NameAwareInterface $value) use ($directive) { |
|
133 | + ? find($node->getDirectives(), function(NameAwareInterface $value) use ($directive) { |
|
134 | 134 | return $value->getNameValue() === $directive->getName(); |
135 | 135 | }) : null; |
136 | 136 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | ]); |
331 | 331 | } |
332 | 332 | return new CoercedValue($parseResult, null); |
333 | - } catch (InvalidTypeException|CoercingException $ex) { |
|
333 | + } catch (InvalidTypeException | CoercingException $ex) { |
|
334 | 334 | return new CoercedValue(null, [ |
335 | 335 | $this->buildCoerceException( |
336 | 336 | sprintf('Expected type %s', (string)$type), |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | return new CoercedValue($enumValue, null); |
362 | 362 | } |
363 | 363 | |
364 | - $suggestions = suggestionList((string)$value, \array_map(function (EnumValue $enumValue) { |
|
364 | + $suggestions = suggestionList((string)$value, \array_map(function(EnumValue $enumValue) { |
|
365 | 365 | return $enumValue->getName(); |
366 | 366 | }, $type->getValues())); |
367 | 367 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function getOperationTypesAST(): array |
43 | 43 | { |
44 | - return \array_map(function (OperationTypeDefinitionNode $node) { |
|
44 | + return \array_map(function(OperationTypeDefinitionNode $node) { |
|
45 | 45 | return $node->toAST(); |
46 | 46 | }, $this->operationTypes); |
47 | 47 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @return TypeNodeInterface |
324 | 324 | */ |
325 | - $parseType = function (): TypeNodeInterface { |
|
325 | + $parseType = function(): TypeNodeInterface { |
|
326 | 326 | $this->expect(TokenKindEnum::COLON); |
327 | 327 | return $this->lexType(); |
328 | 328 | }; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | /** |
434 | 434 | * @return ArgumentNode |
435 | 435 | */ |
436 | - $parseFunction = function () use ($isConst): ArgumentNode { |
|
436 | + $parseFunction = function() use ($isConst) : ArgumentNode { |
|
437 | 437 | return $this->lexArgument($isConst); |
438 | 438 | }; |
439 | 439 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | /** |
461 | 461 | * @return NodeInterface|TypeNodeInterface|ValueNodeInterface |
462 | 462 | */ |
463 | - $parseValue = function () use ($isConst): NodeInterface { |
|
463 | + $parseValue = function() use ($isConst): NodeInterface { |
|
464 | 464 | $this->expect(TokenKindEnum::COLON); |
465 | 465 | return $this->lexValue($isConst); |
466 | 466 | }; |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | |
530 | 530 | $this->expectKeyword(KeywordEnum::FRAGMENT); |
531 | 531 | |
532 | - $parseTypeCondition = function () { |
|
532 | + $parseTypeCondition = function() { |
|
533 | 533 | $this->expectKeyword(KeywordEnum::ON); |
534 | 534 | return $this->lexNamedType(); |
535 | 535 | }; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | { |
660 | 660 | $start = $this->lexer->getToken(); |
661 | 661 | |
662 | - $parseFunction = function () use ($isConst) { |
|
662 | + $parseFunction = function() use ($isConst) { |
|
663 | 663 | return $this->lexValue($isConst); |
664 | 664 | }; |
665 | 665 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * @param bool $isConst |
713 | 713 | * @return NodeInterface|TypeNodeInterface|ValueNodeInterface |
714 | 714 | */ |
715 | - $parseValue = function (bool $isConst): NodeInterface { |
|
715 | + $parseValue = function(bool $isConst): NodeInterface { |
|
716 | 716 | $this->expect(TokenKindEnum::COLON); |
717 | 717 | return $this->lexValue($isConst); |
718 | 718 | }; |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | protected function lexArgumentsDefinition(): array |
1055 | 1055 | { |
1056 | - $parseFunction = function (): InputValueDefinitionNode { |
|
1056 | + $parseFunction = function(): InputValueDefinitionNode { |
|
1057 | 1057 | return $this->lexInputValueDefinition(); |
1058 | 1058 | }; |
1059 | 1059 | |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | */ |
1260 | 1260 | protected function lexInputFieldsDefinition(): array |
1261 | 1261 | { |
1262 | - $parseFunction = function (): InputValueDefinitionNode { |
|
1262 | + $parseFunction = function(): InputValueDefinitionNode { |
|
1263 | 1263 | return $this->lexInputValueDefinition(); |
1264 | 1264 | }; |
1265 | 1265 | |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | |
1328 | 1328 | $directives = $this->lexDirectives(true); |
1329 | 1329 | |
1330 | - $parseFunction = function (): OperationTypeDefinitionNode { |
|
1330 | + $parseFunction = function(): OperationTypeDefinitionNode { |
|
1331 | 1331 | return $this->lexOperationTypeDefinition(); |
1332 | 1332 | }; |
1333 | 1333 | |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | $name = $this->lexName(); |
1603 | 1603 | |
1604 | - if (arraySome(DirectiveLocationEnum::values(), function ($value) use ($name) { |
|
1604 | + if (arraySome(DirectiveLocationEnum::values(), function($value) use ($name) { |
|
1605 | 1605 | return $name->getValue() === $value; |
1606 | 1606 | })) { |
1607 | 1607 | return $name; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function buildTypes(array $nodes): array |
109 | 109 | { |
110 | - return \array_map(function (NamedTypeNodeInterface $node) { |
|
110 | + return \array_map(function(NamedTypeNodeInterface $node) { |
|
111 | 111 | return $this->buildType($node); |
112 | 112 | }, $nodes); |
113 | 113 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $directive = newDirective([ |
154 | 154 | 'name' => $node->getNameValue(), |
155 | 155 | 'description' => $node->getDescriptionValue(), |
156 | - 'locations' => \array_map(function (NameNode $node) { |
|
156 | + 'locations' => \array_map(function(NameNode $node) { |
|
157 | 157 | return $node->getValue(); |
158 | 158 | }, $node->getLocations()), |
159 | 159 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | $typesMap = keyMap( |
223 | 223 | \array_merge($customTypes, specifiedScalarTypes(), introspectionTypes()), |
224 | - function (NamedTypeInterface $type) { |
|
224 | + function(NamedTypeInterface $type) { |
|
225 | 225 | return $type->getName(); |
226 | 226 | } |
227 | 227 | ); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $directivesMap = keyMap( |
240 | 240 | \array_merge($customDirectives, specifiedDirectives()), |
241 | - function (Directive $directive) { |
|
241 | + function(Directive $directive) { |
|
242 | 242 | return $directive->getName(); |
243 | 243 | } |
244 | 244 | ); |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | { |
258 | 258 | return keyValueMap( |
259 | 259 | $nodes, |
260 | - function (InputValueDefinitionNode $value) { |
|
260 | + function(InputValueDefinitionNode $value) { |
|
261 | 261 | return $value->getNameValue(); |
262 | 262 | }, |
263 | - function (InputValueDefinitionNode $value): array { |
|
263 | + function(InputValueDefinitionNode $value): array { |
|
264 | 264 | $type = $this->buildWrappedType($value->getType()); |
265 | 265 | $defaultValue = $value->getDefaultValue(); |
266 | 266 | return [ |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | return newObjectType([ |
315 | 315 | 'name' => $node->getNameValue(), |
316 | 316 | 'description' => $node->getDescriptionValue(), |
317 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
317 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
318 | 318 | return $this->buildFields($node); |
319 | 319 | } : [], |
320 | 320 | // Note: While this could make early assertions to get the correctly |
321 | 321 | // typed values, that would throw immediately while type system |
322 | 322 | // validation with validateSchema() will produce more actionable results. |
323 | - 'interfaces' => function () use ($node) { |
|
324 | - return $node->hasInterfaces() ? \array_map(function (NamedTypeNodeInterface $interface) { |
|
323 | + 'interfaces' => function() use ($node) { |
|
324 | + return $node->hasInterfaces() ? \array_map(function(NamedTypeNodeInterface $interface) { |
|
325 | 325 | return $this->buildType($interface); |
326 | 326 | }, $node->getInterfaces()) : []; |
327 | 327 | }, |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | { |
338 | 338 | return keyValueMap( |
339 | 339 | $node->getFields(), |
340 | - function ($value) { |
|
340 | + function($value) { |
|
341 | 341 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
342 | 342 | return $value->getNameValue(); |
343 | 343 | }, |
344 | - function ($value) use ($node) { |
|
344 | + function($value) use ($node) { |
|
345 | 345 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
346 | 346 | return $this->buildField($value, |
347 | 347 | $this->getFieldResolver($node->getNameValue(), $value->getNameValue())); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | return newInterfaceType([ |
372 | 372 | 'name' => $node->getNameValue(), |
373 | 373 | 'description' => $node->getDescriptionValue(), |
374 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
374 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
375 | 375 | return $this->buildFields($node); |
376 | 376 | } : [], |
377 | 377 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | 'description' => $node->getDescriptionValue(), |
392 | 392 | 'values' => $node->hasValues() ? keyValueMap( |
393 | 393 | $node->getValues(), |
394 | - function (EnumValueDefinitionNode $value): ?string { |
|
394 | + function(EnumValueDefinitionNode $value): ?string { |
|
395 | 395 | return $value->getNameValue(); |
396 | 396 | }, |
397 | - function (EnumValueDefinitionNode $value): array { |
|
397 | + function(EnumValueDefinitionNode $value): array { |
|
398 | 398 | return [ |
399 | 399 | 'description' => $value->getDescriptionValue(), |
400 | 400 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | return newUnionType([ |
417 | 417 | 'name' => $node->getNameValue(), |
418 | 418 | 'description' => $node->getDescriptionValue(), |
419 | - 'types' => $node->hasTypes() ? \array_map(function (NamedTypeNodeInterface $type) { |
|
419 | + 'types' => $node->hasTypes() ? \array_map(function(NamedTypeNodeInterface $type) { |
|
420 | 420 | return $this->buildType($type); |
421 | 421 | }, $node->getTypes()) : [], |
422 | 422 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | return newScalarType([ |
446 | 446 | 'name' => $node->getNameValue(), |
447 | 447 | 'description' => $node->getDescriptionValue(), |
448 | - 'serialize' => function ($value) { |
|
448 | + 'serialize' => function($value) { |
|
449 | 449 | return $value; |
450 | 450 | }, |
451 | 451 | 'astNode' => $node, |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | return newInputObjectType([ |
463 | 463 | 'name' => $node->getNameValue(), |
464 | 464 | 'description' => $node->getDescriptionValue(), |
465 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
465 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
466 | 466 | return keyValueMap( |
467 | 467 | $node->getFields(), |
468 | - function (InputValueDefinitionNode $value): ?string { |
|
468 | + function(InputValueDefinitionNode $value): ?string { |
|
469 | 469 | return $value->getNameValue(); |
470 | 470 | }, |
471 | - function (InputValueDefinitionNode $value): array { |
|
471 | + function(InputValueDefinitionNode $value): array { |
|
472 | 472 | $type = $this->buildWrappedType($value->getType()); |
473 | 473 | $defaultValue = $value->getDefaultValue(); |
474 | 474 | return [ |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function buildTypes(): array |
79 | 79 | { |
80 | - return \array_map(function (NamedTypeNodeInterface $definition) { |
|
80 | + return \array_map(function(NamedTypeNodeInterface $definition) { |
|
81 | 81 | return $this->definitionBuilder->buildType($definition); |
82 | 82 | }, \array_values($this->info->getTypeDefinitionMap())); |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function buildDirectives(): array |
89 | 89 | { |
90 | - $directives = \array_map(function (DirectiveDefinitionNode $definition) { |
|
90 | + $directives = \array_map(function(DirectiveDefinitionNode $definition) { |
|
91 | 91 | return $this->definitionBuilder->buildDirective($definition); |
92 | 92 | }, $this->info->getDirectiveDefinitions()); |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ]; |
99 | 99 | |
100 | 100 | foreach ($specifiedDirectivesMap as $name => $directive) { |
101 | - if (!arraySome($directives, function (Directive $directive) use ($name) { |
|
101 | + if (!arraySome($directives, function(Directive $directive) use ($name) { |
|
102 | 102 | return $directive->getName() === $name; |
103 | 103 | })) { |
104 | 104 | $directives[] = $directive; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $promise = new FulfilledPromise([]); |
172 | 172 | |
173 | - $resolve = function ($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) { |
|
173 | + $resolve = function($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) { |
|
174 | 174 | $fieldPath = $path; |
175 | 175 | $fieldPath[] = $fieldName; |
176 | 176 | try { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | if ($this->isPromise($result)) { |
183 | 183 | /** @var ExtendedPromiseInterface $result */ |
184 | - return $result->then(function ($resolvedResult) use ($fieldName, $results) { |
|
184 | + return $result->then(function($resolvedResult) use ($fieldName, $results) { |
|
185 | 185 | $results[$fieldName] = $resolvedResult; |
186 | 186 | return $results; |
187 | 187 | }); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | }; |
194 | 194 | |
195 | 195 | foreach ($fields as $fieldName => $fieldNodes) { |
196 | - $promise = $promise->then(function ($resolvedResults) use ( |
|
196 | + $promise = $promise->then(function($resolvedResults) use ( |
|
197 | 197 | $resolve, |
198 | 198 | $fieldName, |
199 | 199 | $path, |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | }); |
206 | 206 | } |
207 | 207 | |
208 | - $promise->then(function ($resolvedResults) use (&$finalResults) { |
|
208 | + $promise->then(function($resolvedResults) use (&$finalResults) { |
|
209 | 209 | $finalResults = $resolvedResults ?? []; |
210 | - })->otherwise(function ($ex) { |
|
210 | + })->otherwise(function($ex) { |
|
211 | 211 | $this->context->addError($ex); |
212 | 212 | }); |
213 | 213 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($this->isPromise($completed)) { |
285 | 285 | $context = $this->context; |
286 | 286 | /** @var ExtendedPromiseInterface $completed */ |
287 | - return $completed->then(null, function ($error) use ($context, $fieldNodes, $path) { |
|
287 | + return $completed->then(null, function($error) use ($context, $fieldNodes, $path) { |
|
288 | 288 | //@TODO Handle $error better |
289 | 289 | if ($error instanceof \Exception) { |
290 | 290 | $context->addError($this->buildLocatedError($error, $fieldNodes, $path)); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $keys = \array_keys($finalResults); |
379 | 379 | $promise = promiseAll(\array_values($finalResults)); |
380 | 380 | |
381 | - $promise->then(function ($values) use ($keys, &$finalResults) { |
|
381 | + $promise->then(function($values) use ($keys, &$finalResults) { |
|
382 | 382 | /** @noinspection ForeachSourceInspection */ |
383 | 383 | foreach ($values as $i => $value) { |
384 | 384 | $finalResults[$keys[$i]] = $value; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | ) { |
477 | 477 | if ($this->isPromise($result)) { |
478 | 478 | /** @var ExtendedPromiseInterface $result */ |
479 | - return $result->then(function (&$value) use ($returnType, $fieldNodes, $info, $path) { |
|
479 | + return $result->then(function(&$value) use ($returnType, $fieldNodes, $info, $path) { |
|
480 | 480 | return $this->completeValue($returnType, $fieldNodes, $info, $path, $value); |
481 | 481 | }); |
482 | 482 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | |
565 | 565 | if ($this->isPromise($runtimeType)) { |
566 | 566 | /** @var ExtendedPromiseInterface $runtimeType */ |
567 | - return $runtimeType->then(function ($resolvedRuntimeType) use ( |
|
567 | + return $runtimeType->then(function($resolvedRuntimeType) use ( |
|
568 | 568 | $returnType, |
569 | 569 | $fieldNodes, |
570 | 570 | $info, |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | |
693 | 693 | if (!empty($promisedIsTypeOfResults)) { |
694 | 694 | return promiseAll($promisedIsTypeOfResults) |
695 | - ->then(function ($isTypeOfResults) use ($possibleTypes) { |
|
695 | + ->then(function($isTypeOfResults) use ($possibleTypes) { |
|
696 | 696 | /** @noinspection ForeachSourceInspection */ |
697 | 697 | foreach ($isTypeOfResults as $index => $result) { |
698 | 698 | if ($result) { |