@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function getFieldsAsArray(): array |
| 28 | 28 | { |
| 29 | - return array_map(function (SerializationInterface $node) { |
|
| 29 | + return array_map(function(SerializationInterface $node) { |
|
| 30 | 30 | return $node->toArray(); |
| 31 | 31 | }, $this->fields); |
| 32 | 32 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * @return mixed |
| 440 | 440 | * @throws GraphQLError |
| 441 | 441 | */ |
| 442 | - $parseType = function (LexerInterface $lexer) { |
|
| 442 | + $parseType = function(LexerInterface $lexer) { |
|
| 443 | 443 | $this->expect($lexer, TokenKindEnum::COLON); |
| 444 | 444 | return $this->parseTypeReference($lexer); |
| 445 | 445 | }; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | * @return mixed |
| 570 | 570 | * @throws GraphQLError |
| 571 | 571 | */ |
| 572 | - $parseValue = function (LexerInterface $lexer) { |
|
| 572 | + $parseValue = function(LexerInterface $lexer) { |
|
| 573 | 573 | $this->expect($lexer, TokenKindEnum::COLON); |
| 574 | 574 | return $this->parseValueLiteral($lexer, false); |
| 575 | 575 | }; |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * @return mixed |
| 597 | 597 | * @throws GraphQLError |
| 598 | 598 | */ |
| 599 | - $parseValue = function (LexerInterface $lexer) { |
|
| 599 | + $parseValue = function(LexerInterface $lexer) { |
|
| 600 | 600 | $this->expect($lexer, TokenKindEnum::COLON); |
| 601 | 601 | return $this->parseConstValue($lexer); |
| 602 | 602 | }; |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $this->expectKeyword($lexer, KeywordEnum::FRAGMENT); |
| 659 | 659 | |
| 660 | - $parseTypeCondition = function (LexerInterface $lexer) { |
|
| 660 | + $parseTypeCondition = function(LexerInterface $lexer) { |
|
| 661 | 661 | $this->expectKeyword($lexer, 'on'); |
| 662 | 662 | return $this->parseNamedType($lexer); |
| 663 | 663 | }; |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | { |
| 855 | 855 | $start = $lexer->getToken(); |
| 856 | 856 | |
| 857 | - $parseValue = function (LexerInterface $lexer, bool $isConst) { |
|
| 857 | + $parseValue = function(LexerInterface $lexer, bool $isConst) { |
|
| 858 | 858 | $this->expect($lexer, TokenKindEnum::COLON); |
| 859 | 859 | return $this->parseValueLiteral($lexer, $isConst); |
| 860 | 860 | }; |
@@ -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 | } |
@@ -29,14 +29,14 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function register() |
| 31 | 31 | { |
| 32 | - $this->container->add(NodeBuilderInterface::class, function () { |
|
| 32 | + $this->container->add(NodeBuilderInterface::class, function() { |
|
| 33 | 33 | return new NodeBuilder(SupportedBuilders::get()); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | 36 | $this->container->add(ParserInterface::class, Parser::class, true/* $shared */) |
| 37 | 37 | ->withArgument(NodeBuilderInterface::class); |
| 38 | 38 | |
| 39 | - $this->container->add(LexerInterface::class, function () { |
|
| 39 | + $this->container->add(LexerInterface::class, function() { |
|
| 40 | 40 | return new Lexer(SupportedReaders::get()); |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function register() |
| 29 | 29 | { |
| 30 | - $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function () { |
|
| 30 | + $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function() { |
|
| 31 | 31 | return GraphQLDirective([ |
| 32 | 32 | 'name' => 'include', |
| 33 | 33 | 'description' => |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ]); |
| 48 | 48 | }, true/* $shared */); |
| 49 | 49 | |
| 50 | - $this->container->add(GraphQL::SKIP_DIRECTIVE, function () { |
|
| 50 | + $this->container->add(GraphQL::SKIP_DIRECTIVE, function() { |
|
| 51 | 51 | return GraphQLDirective([ |
| 52 | 52 | 'name' => 'skip', |
| 53 | 53 | 'description' => |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ]); |
| 68 | 68 | }, true/* $shared */); |
| 69 | 69 | |
| 70 | - $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function () { |
|
| 70 | + $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function() { |
|
| 71 | 71 | return GraphQLDirective([ |
| 72 | 72 | 'name' => 'deprecated', |
| 73 | 73 | 'description' => 'Marks an element of a GraphQL schema as no longer supported.', |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $this->container->add(DefinitionBuilderInterface::class, DefinitionBuilder::class, true/* $shared */) |
| 30 | 30 | ->withArguments([ |
| 31 | - function (NamedTypeNode $node) { |
|
| 31 | + function(NamedTypeNode $node) { |
|
| 32 | 32 | throw new \Exception(sprintf('Type "%s" not found in document.', $node->getNameValue())); |
| 33 | 33 | }, |
| 34 | 34 | CacheInterface::class, |
@@ -36,38 +36,38 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function register() |
| 38 | 38 | { |
| 39 | - $this->container->add(GraphQL::BOOLEAN, function () { |
|
| 39 | + $this->container->add(GraphQL::BOOLEAN, function() { |
|
| 40 | 40 | return GraphQLScalarType([ |
| 41 | 41 | 'name' => TypeNameEnum::BOOLEAN, |
| 42 | 42 | 'description' => 'The `Boolean` scalar type represents `true` or `false`.', |
| 43 | - 'serialize' => function ($value) { |
|
| 43 | + 'serialize' => function($value) { |
|
| 44 | 44 | return coerceBoolean($value); |
| 45 | 45 | }, |
| 46 | - 'parseValue' => function ($value) { |
|
| 46 | + 'parseValue' => function($value) { |
|
| 47 | 47 | return coerceBoolean($value); |
| 48 | 48 | }, |
| 49 | 49 | |
| 50 | - 'parseLiteral' => function (NodeInterface $astNode) { |
|
| 50 | + 'parseLiteral' => function(NodeInterface $astNode) { |
|
| 51 | 51 | /** @var BooleanValueNode $astNode */ |
| 52 | 52 | return $astNode->getKind() === NodeKindEnum::BOOLEAN ? $astNode->getValue() : null; |
| 53 | 53 | }, |
| 54 | 54 | ]); |
| 55 | 55 | }, true/* $shared */); |
| 56 | 56 | |
| 57 | - $this->container->add(GraphQL::FLOAT, function () { |
|
| 57 | + $this->container->add(GraphQL::FLOAT, function() { |
|
| 58 | 58 | return GraphQLScalarType([ |
| 59 | 59 | 'name' => TypeNameEnum::FLOAT, |
| 60 | 60 | 'description' => |
| 61 | 61 | 'The `Float` scalar type represents signed double-precision fractional ' . |
| 62 | 62 | 'values as specified by ' . |
| 63 | 63 | '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).', |
| 64 | - 'serialize' => function ($value) { |
|
| 64 | + 'serialize' => function($value) { |
|
| 65 | 65 | return coerceFloat($value); |
| 66 | 66 | }, |
| 67 | - 'parseValue' => function ($value) { |
|
| 67 | + 'parseValue' => function($value) { |
|
| 68 | 68 | return coerceFloat($value); |
| 69 | 69 | }, |
| 70 | - 'parseLiteral' => function (NodeInterface $astNode) { |
|
| 70 | + 'parseLiteral' => function(NodeInterface $astNode) { |
|
| 71 | 71 | /** @var FloatValueNode $astNode */ |
| 72 | 72 | return $astNode->getKind() === NodeKindEnum::FLOAT || $astNode->getKind() === NodeKindEnum::INT |
| 73 | 73 | ? $astNode->getValue() |
@@ -76,26 +76,26 @@ discard block |
||
| 76 | 76 | ]); |
| 77 | 77 | }, true/* $shared */); |
| 78 | 78 | |
| 79 | - $this->container->add(GraphQL::INT, function () { |
|
| 79 | + $this->container->add(GraphQL::INT, function() { |
|
| 80 | 80 | return GraphQLScalarType([ |
| 81 | 81 | 'name' => TypeNameEnum::INT, |
| 82 | 82 | 'description' => |
| 83 | 83 | 'The `Int` scalar type represents non-fractional signed whole numeric ' . |
| 84 | 84 | 'values. Int can represent values between -(2^31) and 2^31 - 1.', |
| 85 | - 'serialize' => function ($value) { |
|
| 85 | + 'serialize' => function($value) { |
|
| 86 | 86 | return coerceInt($value); |
| 87 | 87 | }, |
| 88 | - 'parseValue' => function ($value) { |
|
| 88 | + 'parseValue' => function($value) { |
|
| 89 | 89 | return coerceInt($value); |
| 90 | 90 | }, |
| 91 | - 'parseLiteral' => function (NodeInterface $astNode) { |
|
| 91 | + 'parseLiteral' => function(NodeInterface $astNode) { |
|
| 92 | 92 | /** @var IntValueNode $astNode */ |
| 93 | 93 | return $astNode->getKind() === NodeKindEnum::INT ? $astNode->getValue() : null; |
| 94 | 94 | }, |
| 95 | 95 | ]); |
| 96 | 96 | }, true/* $shared */); |
| 97 | 97 | |
| 98 | - $this->container->add(GraphQL::ID, function () { |
|
| 98 | + $this->container->add(GraphQL::ID, function() { |
|
| 99 | 99 | return GraphQLScalarType([ |
| 100 | 100 | 'name' => TypeNameEnum::ID, |
| 101 | 101 | 'description' => |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | 'response as a String; however, it is not intended to be human-readable. ' . |
| 105 | 105 | 'When expected as an input type, any string (such as `"4"`) or integer ' . |
| 106 | 106 | '(such as `4`) input value will be accepted as an ID.', |
| 107 | - 'serialize' => function ($value) { |
|
| 107 | + 'serialize' => function($value) { |
|
| 108 | 108 | return coerceString($value); |
| 109 | 109 | }, |
| 110 | - 'parseValue' => function ($value) { |
|
| 110 | + 'parseValue' => function($value) { |
|
| 111 | 111 | return coerceString($value); |
| 112 | 112 | }, |
| 113 | - 'parseLiteral' => function (NodeInterface $astNode) { |
|
| 113 | + 'parseLiteral' => function(NodeInterface $astNode) { |
|
| 114 | 114 | /** @var StringValueNode $astNode */ |
| 115 | 115 | return $astNode->getKind() === NodeKindEnum::STRING || $astNode->getKind() === NodeKindEnum::INT |
| 116 | 116 | ? $astNode->getValue() |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | ]); |
| 120 | 120 | }, true/* $shared */); |
| 121 | 121 | |
| 122 | - $this->container->add(GraphQL::STRING, function () { |
|
| 122 | + $this->container->add(GraphQL::STRING, function() { |
|
| 123 | 123 | return GraphQLScalarType([ |
| 124 | 124 | 'name' => TypeNameEnum::STRING, |
| 125 | 125 | 'description' => |
| 126 | 126 | 'The `String` scalar type represents textual data, represented as UTF-8 ' . |
| 127 | 127 | 'character sequences. The String type is most often used by GraphQL to ' . |
| 128 | 128 | 'represent free-form human-readable text.', |
| 129 | - 'serialize' => function ($value) { |
|
| 129 | + 'serialize' => function($value) { |
|
| 130 | 130 | return coerceString($value); |
| 131 | 131 | }, |
| 132 | - 'parseValue' => function ($value) { |
|
| 132 | + 'parseValue' => function($value) { |
|
| 133 | 133 | return coerceString($value); |
| 134 | 134 | }, |
| 135 | - 'parseLiteral' => function (NodeInterface $astNode) { |
|
| 135 | + 'parseLiteral' => function(NodeInterface $astNode) { |
|
| 136 | 136 | /** @var StringValueNode $astNode */ |
| 137 | 137 | return $astNode->getKind() === NodeKindEnum::STRING ? $astNode->getValue() : null; |
| 138 | 138 | }, |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $builtInTypes = keyMap( |
| 80 | 80 | array_merge(specifiedScalarTypes(), introspectionTypes()), |
| 81 | - function (NamedTypeInterface $type) { |
|
| 81 | + function(NamedTypeInterface $type) { |
|
| 82 | 82 | return $type->getName(); |
| 83 | 83 | } |
| 84 | 84 | ); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return GraphQLDirective([ |
| 134 | 134 | 'name' => $node->getNameValue(), |
| 135 | 135 | 'description' => $node->getDescriptionValue(), |
| 136 | - 'locations' => array_map(function (NameNode $node) { |
|
| 136 | + 'locations' => array_map(function(NameNode $node) { |
|
| 137 | 137 | return $node->getValue(); |
| 138 | 138 | }, $node->getLocations()), |
| 139 | 139 | 'arguments' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | return keyValMap( |
| 182 | 182 | $nodes, |
| 183 | - function (InputValueDefinitionNode $value) { |
|
| 183 | + function(InputValueDefinitionNode $value) { |
|
| 184 | 184 | return $value->getNameValue(); |
| 185 | 185 | }, |
| 186 | - function (InputValueDefinitionNode $value): array { |
|
| 186 | + function(InputValueDefinitionNode $value): array { |
|
| 187 | 187 | $type = $this->buildWrappedType($value->getType()); |
| 188 | 188 | return [ |
| 189 | 189 | 'type' => $type, |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | return GraphQLObjectType([ |
| 233 | 233 | 'name' => $node->getNameValue(), |
| 234 | 234 | 'description' => $node->getDescriptionValue(), |
| 235 | - 'fields' => function () use ($node) { |
|
| 235 | + 'fields' => function() use ($node) { |
|
| 236 | 236 | return $this->buildFields($node); |
| 237 | 237 | }, |
| 238 | - 'interfaces' => function () use ($node) { |
|
| 239 | - return $node->hasInterfaces() ? array_map(function (InterfaceTypeDefinitionNode $interface) { |
|
| 238 | + 'interfaces' => function() use ($node) { |
|
| 239 | + return $node->hasInterfaces() ? array_map(function(InterfaceTypeDefinitionNode $interface) { |
|
| 240 | 240 | return $this->buildType($interface); |
| 241 | 241 | }, $node->getInterfaces()) : []; |
| 242 | 242 | }, |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | { |
| 254 | 254 | return $node->hasFields() ? keyValMap( |
| 255 | 255 | $node->getFields(), |
| 256 | - function ($value) { |
|
| 256 | + function($value) { |
|
| 257 | 257 | /** @noinspection PhpUndefinedMethodInspection */ |
| 258 | 258 | return $value->getNameValue(); |
| 259 | 259 | }, |
| 260 | - function ($value) { |
|
| 260 | + function($value) { |
|
| 261 | 261 | return $this->buildField($value); |
| 262 | 262 | } |
| 263 | 263 | ) : []; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | return GraphQLInterfaceType([ |
| 273 | 273 | 'name' => $node->getNameValue(), |
| 274 | 274 | 'description' => $node->getDescriptionValue(), |
| 275 | - 'fields' => function () use ($node): array { |
|
| 275 | + 'fields' => function() use ($node): array { |
|
| 276 | 276 | return $this->buildFields($node); |
| 277 | 277 | }, |
| 278 | 278 | 'astNode' => $node, |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | 'description' => $node->getDescriptionValue(), |
| 291 | 291 | 'values' => $node->hasValues() ? keyValMap( |
| 292 | 292 | $node->getValues(), |
| 293 | - function (EnumValueDefinitionNode $value): string { |
|
| 293 | + function(EnumValueDefinitionNode $value): string { |
|
| 294 | 294 | return $value->getNameValue(); |
| 295 | 295 | }, |
| 296 | - function (EnumValueDefinitionNode $value): array { |
|
| 296 | + function(EnumValueDefinitionNode $value): array { |
|
| 297 | 297 | return [ |
| 298 | 298 | 'description' => $value->getDescriptionValue(), |
| 299 | 299 | 'deprecationReason' => getDeprecationReason($value), |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | return GraphQLUnionType([ |
| 311 | 311 | 'name' => $node->getNameValue(), |
| 312 | 312 | 'description' => $node->getDescriptionValue(), |
| 313 | - 'types' => $node->hasTypes() ? array_map(function (TypeNodeInterface $type) { |
|
| 313 | + 'types' => $node->hasTypes() ? array_map(function(TypeNodeInterface $type) { |
|
| 314 | 314 | return $this->buildType($type); |
| 315 | 315 | }, $node->getTypes()) : [], |
| 316 | 316 | 'astNode' => $node, |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | return GraphQLScalarType([ |
| 327 | 327 | 'name' => $node->getNameValue(), |
| 328 | 328 | 'description' => $node->getDescriptionValue(), |
| 329 | - 'serialize' => function ($value) { |
|
| 329 | + 'serialize' => function($value) { |
|
| 330 | 330 | return $value; |
| 331 | 331 | }, |
| 332 | 332 | 'astNode' => $node, |
@@ -346,10 +346,10 @@ discard block |
||
| 346 | 346 | 'description' => $node->getDescriptionValue(), |
| 347 | 347 | 'fields' => $node->hasFields() ? keyValMap( |
| 348 | 348 | $node->getFields(), |
| 349 | - function (InputValueDefinitionNode $value): string { |
|
| 349 | + function(InputValueDefinitionNode $value): string { |
|
| 350 | 350 | return $value->getNameValue(); |
| 351 | 351 | }, |
| 352 | - function (InputValueDefinitionNode $value): array { |
|
| 352 | + function(InputValueDefinitionNode $value): array { |
|
| 353 | 353 | $type = $this->buildWrappedType($value->getType()); |
| 354 | 354 | return [ |
| 355 | 355 | 'type' => $type, |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function getDirective(string $name): ?Directive |
| 126 | 126 | { |
| 127 | - return find($this->directives, function (Directive $directive) use ($name) { |
|
| 127 | + return find($this->directives, function(Directive $directive) use ($name) { |
|
| 128 | 128 | return $directive->getName() === $name; |
| 129 | 129 | }); |
| 130 | 130 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | ) |
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | - $this->_possibleTypeMap = array_reduce($possibleTypes, function (array $map, TypeInterface $type) { |
|
| 180 | + $this->_possibleTypeMap = array_reduce($possibleTypes, function(array $map, TypeInterface $type) { |
|
| 181 | 181 | $map[$type->getName()] = true; |
| 182 | 182 | return $map; |
| 183 | 183 | }); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
| 390 | 390 | foreach ($type->getFields() as $field) { |
| 391 | 391 | if ($field->hasArguments()) { |
| 392 | - $fieldArgTypes = array_map(function (Argument $argument) { |
|
| 392 | + $fieldArgTypes = array_map(function(Argument $argument) { |
|
| 393 | 393 | return $argument->getType(); |
| 394 | 394 | }, $field->getArguments()); |
| 395 | 395 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | return $map; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - return array_reduce($directive->getArguments(), function ($map, Argument $argument) { |
|
| 423 | + return array_reduce($directive->getArguments(), function($map, Argument $argument) { |
|
| 424 | 424 | return typeMapReducer($map, $argument->getType()); |
| 425 | 425 | }, $map); |
| 426 | 426 | } |