@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $builtInTypes = keyMap( |
| 79 | 79 | array_merge(specifiedScalarTypes()/*, introspectionTypes()*/), |
| 80 | - function (NamedTypeInterface $type) { |
|
| 80 | + function(NamedTypeInterface $type) { |
|
| 81 | 81 | return $type->getName(); |
| 82 | 82 | } |
| 83 | 83 | ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | return GraphQLDirective([ |
| 133 | 133 | 'name' => $node->getNameValue(), |
| 134 | 134 | 'description' => $node->getDescriptionValue(), |
| 135 | - 'locations' => array_map(function (NameNode $node) { |
|
| 135 | + 'locations' => array_map(function(NameNode $node) { |
|
| 136 | 136 | return $node->getValue(); |
| 137 | 137 | }, $node->getLocations()), |
| 138 | 138 | 'arguments' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | return keyValMap( |
| 181 | 181 | $nodes, |
| 182 | - function (InputValueDefinitionNode $value) { |
|
| 182 | + function(InputValueDefinitionNode $value) { |
|
| 183 | 183 | return $value->getNameValue(); |
| 184 | 184 | }, |
| 185 | - function (InputValueDefinitionNode $value): array { |
|
| 185 | + function(InputValueDefinitionNode $value): array { |
|
| 186 | 186 | $type = $this->buildWrappedType($value->getType()); |
| 187 | 187 | return [ |
| 188 | 188 | 'type' => $type, |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | return GraphQLObjectType([ |
| 232 | 232 | 'name' => $node->getNameValue(), |
| 233 | 233 | 'description' => $node->getDescriptionValue(), |
| 234 | - 'fields' => function () use ($node) { |
|
| 234 | + 'fields' => function() use ($node) { |
|
| 235 | 235 | return $this->buildFields($node); |
| 236 | 236 | }, |
| 237 | - 'interfaces' => function () use ($node) { |
|
| 238 | - return $node->hasInterfaces() ? array_map(function (InterfaceTypeDefinitionNode $interface) { |
|
| 237 | + 'interfaces' => function() use ($node) { |
|
| 238 | + return $node->hasInterfaces() ? array_map(function(InterfaceTypeDefinitionNode $interface) { |
|
| 239 | 239 | return $this->buildType($interface); |
| 240 | 240 | }, $node->getInterfaces()) : []; |
| 241 | 241 | }, |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | { |
| 253 | 253 | return $node->hasFields() ? keyValMap( |
| 254 | 254 | $node->getFields(), |
| 255 | - function ($value) { |
|
| 255 | + function($value) { |
|
| 256 | 256 | /** @noinspection PhpUndefinedMethodInspection */ |
| 257 | 257 | return $value->getNameValue(); |
| 258 | 258 | }, |
| 259 | - function ($value) { |
|
| 259 | + function($value) { |
|
| 260 | 260 | return $this->buildField($value); |
| 261 | 261 | } |
| 262 | 262 | ) : []; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | return GraphQLInterfaceType([ |
| 272 | 272 | 'name' => $node->getNameValue(), |
| 273 | 273 | 'description' => $node->getDescriptionValue(), |
| 274 | - 'fields' => function () use ($node): array { |
|
| 274 | + 'fields' => function() use ($node): array { |
|
| 275 | 275 | return $this->buildFields($node); |
| 276 | 276 | }, |
| 277 | 277 | 'astNode' => $node, |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | 'description' => $node->getDescriptionValue(), |
| 290 | 290 | 'values' => $node->hasValues() ? keyValMap( |
| 291 | 291 | $node->getValues(), |
| 292 | - function (EnumValueDefinitionNode $value): string { |
|
| 292 | + function(EnumValueDefinitionNode $value): string { |
|
| 293 | 293 | return $value->getNameValue(); |
| 294 | 294 | }, |
| 295 | - function (EnumValueDefinitionNode $value): array { |
|
| 295 | + function(EnumValueDefinitionNode $value): array { |
|
| 296 | 296 | return [ |
| 297 | 297 | 'description' => $value->getDescriptionValue(), |
| 298 | 298 | 'deprecationReason' => getDeprecationReason($value), |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | return GraphQLUnionType([ |
| 310 | 310 | 'name' => $node->getNameValue(), |
| 311 | 311 | 'description' => $node->getDescriptionValue(), |
| 312 | - 'types' => $node->hasTypes() ? array_map(function (TypeNodeInterface $type) { |
|
| 312 | + 'types' => $node->hasTypes() ? array_map(function(TypeNodeInterface $type) { |
|
| 313 | 313 | return $this->buildType($type); |
| 314 | 314 | }, $node->getTypes()) : [], |
| 315 | 315 | 'astNode' => $node, |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | return GraphQLScalarType([ |
| 326 | 326 | 'name' => $node->getNameValue(), |
| 327 | 327 | 'description' => $node->getDescriptionValue(), |
| 328 | - 'serialize' => function ($value) { |
|
| 328 | + 'serialize' => function($value) { |
|
| 329 | 329 | return $value; |
| 330 | 330 | }, |
| 331 | 331 | 'astNode' => $node, |
@@ -345,10 +345,10 @@ discard block |
||
| 345 | 345 | 'description' => $node->getDescriptionValue(), |
| 346 | 346 | 'fields' => $node->hasFields() ? keyValMap( |
| 347 | 347 | $node->getFields(), |
| 348 | - function (InputValueDefinitionNode $value): string { |
|
| 348 | + function(InputValueDefinitionNode $value): string { |
|
| 349 | 349 | return $value->getNameValue(); |
| 350 | 350 | }, |
| 351 | - function (InputValueDefinitionNode $value): array { |
|
| 351 | + function(InputValueDefinitionNode $value): array { |
|
| 352 | 352 | $type = $this->buildWrappedType($value->getType()); |
| 353 | 353 | return [ |
| 354 | 354 | 'type' => $type, |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | { |
| 73 | 73 | return arraySome( |
| 74 | 74 | specifiedScalarTypes(), |
| 75 | - function (ScalarType $specifiedScalarType) use ($type) { |
|
| 75 | + function(ScalarType $specifiedScalarType) use ($type) { |
|
| 76 | 76 | /** @noinspection PhpUndefinedMethodInspection */ |
| 77 | 77 | return $type->getName() === $specifiedScalarType->getName(); |
| 78 | 78 | } |
@@ -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->getArguments() ?: []; |
| 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 | [$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 | ], |
@@ -342,13 +342,13 @@ discard block |
||
| 342 | 342 | 'description' => |
| 343 | 343 | 'Object and Interface types are described by a list of Fields, each of ' . |
| 344 | 344 | 'which has a name, potentially a list of arguments, and a return type.', |
| 345 | - 'fields' => function () { |
|
| 345 | + 'fields' => function() { |
|
| 346 | 346 | return [ |
| 347 | 347 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 348 | 348 | 'description' => ['type' => GraphQLString()], |
| 349 | 349 | 'args' => [ |
| 350 | 350 | 'type' => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))), |
| 351 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
| 351 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
| 352 | 352 | return $directive->getArguments() ?: []; |
| 353 | 353 | }, |
| 354 | 354 | ], |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
| 379 | 379 | 'InputObject are represented as Input Values which describe their type ' . |
| 380 | 380 | 'and optionally a default value.', |
| 381 | - 'fields' => function () { |
|
| 381 | + 'fields' => function() { |
|
| 382 | 382 | return [ |
| 383 | 383 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 384 | 384 | 'description' => ['type' => GraphQLString()], |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | 'description' => |
| 389 | 389 | 'A GraphQL-formatted string representing the default value for this ' . |
| 390 | 390 | 'input value.', |
| 391 | - 'resolve' => function ($inputValue) { |
|
| 391 | + 'resolve' => function($inputValue) { |
|
| 392 | 392 | // TODO: Implement this when we have support for printing AST. |
| 393 | 393 | return null; |
| 394 | 394 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
| 417 | 417 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
| 418 | 418 | 'returned in a JSON response as a string.', |
| 419 | - 'fields' => function () { |
|
| 419 | + 'fields' => function() { |
|
| 420 | 420 | return [ |
| 421 | 421 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 422 | 422 | 'description' => ['type' => GraphQLString()], |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | 'name' => '__schema', |
| 482 | 482 | 'type' => GraphQLNonNull(__Schema()), |
| 483 | 483 | 'description' => 'Access the current type schema of this server.', |
| 484 | - 'resolve' => function ($source, $args, $context, $info): SchemaInterface { |
|
| 484 | + 'resolve' => function($source, $args, $context, $info): SchemaInterface { |
|
| 485 | 485 | [$schema] = $info; |
| 486 | 486 | return $schema; |
| 487 | 487 | } |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | 'args' => [ |
| 502 | 502 | 'name' => ['type' => GraphQLNonNull(GraphQLString())], |
| 503 | 503 | ], |
| 504 | - 'resolve' => function ($source, $args, $context, $info): TypeInterface { |
|
| 504 | + 'resolve' => function($source, $args, $context, $info): TypeInterface { |
|
| 505 | 505 | /** @var SchemaInterface $schema */ |
| 506 | 506 | [$name] = $args; |
| 507 | 507 | [$schema] = $info; |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | 'name' => '__typename', |
| 521 | 521 | 'type' => GraphQLNonNull(GraphQLString()), |
| 522 | 522 | 'description' => 'The name of the current Object type at runtime.', |
| 523 | - 'resolve' => function ($source, $args, $context, $info): string { |
|
| 523 | + 'resolve' => function($source, $args, $context, $info): string { |
|
| 524 | 524 | /** @var NamedTypeInterface $parentType */ |
| 525 | 525 | [$parentType] = $info; |
| 526 | 526 | return $parentType->getName(); |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | { |
| 554 | 554 | return arraySome( |
| 555 | 555 | introspectionTypes(), |
| 556 | - function (TypeInterface $introspectionType) use ($type) { |
|
| 556 | + function(TypeInterface $introspectionType) use ($type) { |
|
| 557 | 557 | /** @noinspection PhpUndefinedMethodInspection */ |
| 558 | 558 | return $type->getName() === $introspectionType->getName(); |
| 559 | 559 | } |