@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | ) |
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - $this->_possibleTypeMap = array_reduce($possibleTypes, function (array $map, TypeInterface $type) { |
|
| 167 | + $this->_possibleTypeMap = array_reduce($possibleTypes, function(array $map, TypeInterface $type) { |
|
| 168 | 168 | $map[$type->getName()] = true; |
| 169 | 169 | return $map; |
| 170 | 170 | }); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
| 377 | 377 | foreach ($type->getFields() as $field) { |
| 378 | 378 | if ($field->hasArguments()) { |
| 379 | - $fieldArgTypes = array_map(function (Argument $argument) { |
|
| 379 | + $fieldArgTypes = array_map(function(Argument $argument) { |
|
| 380 | 380 | return $argument->getType(); |
| 381 | 381 | }, $field->getArguments()); |
| 382 | 382 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | return $map; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - return array_reduce($directive->getArguments(), function ($map, Argument $argument) { |
|
| 410 | + return array_reduce($directive->getArguments(), function($map, Argument $argument) { |
|
| 411 | 411 | return typeMapReducer($map, $argument->getType()); |
| 412 | 412 | }, $map); |
| 413 | 413 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $documentNode = parse($source, $options); |
| 25 | 25 | |
| 26 | 26 | if (null === $instance) { |
| 27 | - $resolveType = function (NamedTypeNode $node) { |
|
| 27 | + $resolveType = function(NamedTypeNode $node) { |
|
| 28 | 28 | throw new \Exception(sprintf('Type "%s" not found in document.', $node->getNameValue())); |
| 29 | 29 | }; |
| 30 | 30 | |
@@ -78,27 +78,27 @@ |
||
| 78 | 78 | |
| 79 | 79 | $this->definitionBuilder->setTypeDefinitionMap($nodeMap); |
| 80 | 80 | |
| 81 | - $types = array_map(function (TypeDefinitionNodeInterface $definition) { |
|
| 81 | + $types = array_map(function(TypeDefinitionNodeInterface $definition) { |
|
| 82 | 82 | return $this->definitionBuilder->buildType($definition); |
| 83 | 83 | }, $typeDefinitions); |
| 84 | 84 | |
| 85 | - $directives = array_map(function (DirectiveDefinitionNode $definition) { |
|
| 85 | + $directives = array_map(function(DirectiveDefinitionNode $definition) { |
|
| 86 | 86 | return $this->definitionBuilder->buildDirective($definition); |
| 87 | 87 | }, $directiveDefinitions); |
| 88 | 88 | |
| 89 | - if (!arraySome($directives, function (DirectiveInterface $directive) { |
|
| 89 | + if (!arraySome($directives, function(DirectiveInterface $directive) { |
|
| 90 | 90 | return $directive->getName() === 'skip'; |
| 91 | 91 | })) { |
| 92 | 92 | $directives[] = GraphQLSkipDirective(); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if (!arraySome($directives, function (DirectiveInterface $directive) { |
|
| 95 | + if (!arraySome($directives, function(DirectiveInterface $directive) { |
|
| 96 | 96 | return $directive->getName() === 'include'; |
| 97 | 97 | })) { |
| 98 | 98 | $directives[] = GraphQLIncludeDirective(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if (!arraySome($directives, function (DirectiveInterface $directive) { |
|
| 101 | + if (!arraySome($directives, function(DirectiveInterface $directive) { |
|
| 102 | 102 | return $directive->getName() === 'deprecated'; |
| 103 | 103 | })) { |
| 104 | 104 | $directives[] = GraphQLDeprecatedDirective(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->resolveTypeFunction = $resolveTypeFunction; |
| 75 | 75 | $this->_cache = keyMap( |
| 76 | 76 | array_merge(specifiedScalarTypes()/*, introspectionTypes()*/), |
| 77 | - function (NamedTypeInterface $type) { |
|
| 77 | + function(NamedTypeInterface $type) { |
|
| 78 | 78 | return $type->getName(); |
| 79 | 79 | } |
| 80 | 80 | ); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return GraphQLDirective([ |
| 122 | 122 | 'name' => $node->getNameValue(), |
| 123 | 123 | 'description' => $node->getDescriptionValue(), |
| 124 | - 'locations' => array_map(function (NameNode $node) { |
|
| 124 | + 'locations' => array_map(function(NameNode $node) { |
|
| 125 | 125 | return $node->getValue(); |
| 126 | 126 | }, $node->getLocations()), |
| 127 | 127 | 'arguments' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | return keyValMap( |
| 169 | 169 | $nodes, |
| 170 | - function (InputValueDefinitionNode $value) { |
|
| 170 | + function(InputValueDefinitionNode $value) { |
|
| 171 | 171 | return $value->getNameValue(); |
| 172 | 172 | }, |
| 173 | - function (InputValueDefinitionNode $value): array { |
|
| 173 | + function(InputValueDefinitionNode $value): array { |
|
| 174 | 174 | return [ |
| 175 | 175 | 'type' => $this->buildWrappedType($value->getType()), |
| 176 | 176 | 'description' => $value->getDescriptionValue(), |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | return GraphQLObjectType([ |
| 220 | 220 | 'name' => $node->getNameValue(), |
| 221 | 221 | 'description' => $node->getDescriptionValue(), |
| 222 | - 'fields' => function () use ($node) { |
|
| 222 | + 'fields' => function() use ($node) { |
|
| 223 | 223 | return $this->buildFields($node); |
| 224 | 224 | }, |
| 225 | - 'interfaces' => function () use ($node) { |
|
| 226 | - return $node->hasInterfaces() ? array_map(function (InterfaceTypeDefinitionNode $interface) { |
|
| 225 | + 'interfaces' => function() use ($node) { |
|
| 226 | + return $node->hasInterfaces() ? array_map(function(InterfaceTypeDefinitionNode $interface) { |
|
| 227 | 227 | return $this->buildType($interface); |
| 228 | 228 | }, $node->getInterfaces()) : []; |
| 229 | 229 | }, |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | return $node->hasFields() ? keyValMap( |
| 240 | 240 | $node->getFields(), |
| 241 | - function ($value) { |
|
| 241 | + function($value) { |
|
| 242 | 242 | return $value->getNameValue(); |
| 243 | 243 | }, |
| 244 | - function ($value) { |
|
| 244 | + function($value) { |
|
| 245 | 245 | return $this->buildField($value); |
| 246 | 246 | } |
| 247 | 247 | ) : []; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | return GraphQLInterfaceType([ |
| 257 | 257 | 'name' => $node->getNameValue(), |
| 258 | 258 | 'description' => $node->getDescriptionValue(), |
| 259 | - 'fields' => function () use ($node): array { |
|
| 259 | + 'fields' => function() use ($node): array { |
|
| 260 | 260 | return $this->buildFields($node); |
| 261 | 261 | }, |
| 262 | 262 | 'astNode' => $node, |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | 'description' => $node->getDescriptionValue(), |
| 275 | 275 | 'values' => $node->hasValues() ? keyValMap( |
| 276 | 276 | $node->getValues(), |
| 277 | - function (EnumValueDefinitionNode $value): string { |
|
| 277 | + function(EnumValueDefinitionNode $value): string { |
|
| 278 | 278 | return $value->getNameValue(); |
| 279 | 279 | }, |
| 280 | - function (EnumValueDefinitionNode $value): array { |
|
| 280 | + function(EnumValueDefinitionNode $value): array { |
|
| 281 | 281 | return [ |
| 282 | 282 | 'description' => $value->getDescriptionValue(), |
| 283 | 283 | // TODO: Implement support for deprecation reason |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return GraphQLUnionType([ |
| 296 | 296 | 'name' => $node->getNameValue(), |
| 297 | 297 | 'description' => $node->getDescriptionValue(), |
| 298 | - 'types' => $node->hasTypes() ? array_map(function (TypeNodeInterface $type) { |
|
| 298 | + 'types' => $node->hasTypes() ? array_map(function(TypeNodeInterface $type) { |
|
| 299 | 299 | return $this->buildType($type); |
| 300 | 300 | }, $node->getTypes()) : [], |
| 301 | 301 | 'astNode' => $node, |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | return GraphQLScalarType([ |
| 312 | 312 | 'name' => $node->getNameValue(), |
| 313 | 313 | 'description' => $node->getDescriptionValue(), |
| 314 | - 'serialize' => function ($value) { |
|
| 314 | + 'serialize' => function($value) { |
|
| 315 | 315 | return $value; |
| 316 | 316 | }, |
| 317 | 317 | 'astNode' => $node, |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | 'description' => $node->getDescriptionValue(), |
| 330 | 330 | 'fields' => $node->hasFields() ? keyValMap( |
| 331 | 331 | $node->getFields(), |
| 332 | - function (InputValueDefinitionNode $value): string { |
|
| 332 | + function(InputValueDefinitionNode $value): string { |
|
| 333 | 333 | return $value->getNameValue(); |
| 334 | 334 | }, |
| 335 | - function (InputValueDefinitionNode $value): array { |
|
| 335 | + function(InputValueDefinitionNode $value): array { |
|
| 336 | 336 | return [ |
| 337 | 337 | 'type' => $this->buildWrappedType($value->getType()), |
| 338 | 338 | 'description' => $value->getDescriptionValue(), |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function arraySome(array $array, callable $fn) |
| 25 | 25 | { |
| 26 | - return array_reduce($array, function ($result, $value) use ($fn) { |
|
| 26 | + return array_reduce($array, function($result, $value) use ($fn) { |
|
| 27 | 27 | return $result || $fn($value); |
| 28 | 28 | }); |
| 29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function keyMap(array $array, callable $keyFn): array |
| 37 | 37 | { |
| 38 | - return array_reduce($array, function ($map, $item) use ($keyFn) { |
|
| 38 | + return array_reduce($array, function($map, $item) use ($keyFn) { |
|
| 39 | 39 | $map[$keyFn($item)] = $item; |
| 40 | 40 | return $map; |
| 41 | 41 | }, []); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function keyValMap(array $array, callable $keyFn, callable $valFn): array |
| 51 | 51 | { |
| 52 | - return array_reduce($array, function ($map, $item) use ($keyFn, $valFn) { |
|
| 52 | + return array_reduce($array, function($map, $item) use ($keyFn, $valFn) { |
|
| 53 | 53 | $map[$keyFn($item)] = $valFn($item); |
| 54 | 54 | return $map; |
| 55 | 55 | }, []); |