@@ -168,7 +168,7 @@ |
||
| 168 | 168 | $resolvedValues = []; |
| 169 | 169 | |
| 170 | 170 | /** @var ObjectFieldNode[] $fieldNodes */ |
| 171 | - $fieldNodes = keyMap($node->getFields(), function (ObjectFieldNode $value) { |
|
| 171 | + $fieldNodes = keyMap($node->getFields(), function(ObjectFieldNode $value) { |
|
| 172 | 172 | return $value->getNameValue(); |
| 173 | 173 | }); |
| 174 | 174 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | return $count === 1 |
| 34 | 34 | ? $selected[0] |
| 35 | - : \array_reduce($selected, function ($list, $item) use ($count, &$index) { |
|
| 35 | + : \array_reduce($selected, function($list, $item) use ($count, &$index) { |
|
| 36 | 36 | $list .= ($index > 0 && $index < ($count - 1) ? ', ' : '') . ($index === ($count - 1) ? ' or ' : '') . |
| 37 | 37 | $item; |
| 38 | 38 | $index++; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $result = \array_keys($optionsByDistance); |
| 68 | 68 | |
| 69 | - \usort($result, function ($a, $b) use ($optionsByDistance) { |
|
| 69 | + \usort($result, function($a, $b) use ($optionsByDistance) { |
|
| 70 | 70 | return $optionsByDistance[$a] - $optionsByDistance[$b]; |
| 71 | 71 | }); |
| 72 | 72 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | function quotedOrList(array $items): string |
| 83 | 83 | { |
| 84 | - return orList(array_map(function ($item) { |
|
| 84 | + return orList(array_map(function($item) { |
|
| 85 | 85 | return '"' . $item . '"'; |
| 86 | 86 | }, $items)); |
| 87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | function arrayEvery(array $array, callable $fn): bool |
| 97 | 97 | { |
| 98 | - return array_reduce($array, function ($result, $value) use ($fn) { |
|
| 98 | + return array_reduce($array, function($result, $value) use ($fn) { |
|
| 99 | 99 | return $result && $fn($value); |
| 100 | 100 | }, true); |
| 101 | 101 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | function arraySome(array $array, callable $fn) |
| 109 | 109 | { |
| 110 | - return array_reduce($array, function ($result, $value) use ($fn) { |
|
| 110 | + return array_reduce($array, function($result, $value) use ($fn) { |
|
| 111 | 111 | return $result || $fn($value); |
| 112 | 112 | }); |
| 113 | 113 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | function keyMap(array $array, callable $keyFn): array |
| 137 | 137 | { |
| 138 | - return array_reduce($array, function ($map, $item) use ($keyFn) { |
|
| 138 | + return array_reduce($array, function($map, $item) use ($keyFn) { |
|
| 139 | 139 | $map[$keyFn($item)] = $item; |
| 140 | 140 | return $map; |
| 141 | 141 | }, []); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | function keyValueMap(array $array, callable $keyFn, callable $valFn): array |
| 151 | 151 | { |
| 152 | - return array_reduce($array, function ($map, $item) use ($keyFn, $valFn) { |
|
| 152 | + return array_reduce($array, function($map, $item) use ($keyFn, $valFn) { |
|
| 153 | 153 | $map[$keyFn($item)] = $valFn($item); |
| 154 | 154 | return $map; |
| 155 | 155 | }, []); |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | // If both types are abstract, then determine if there is any intersection |
| 93 | 93 | // between possible concrete types of each. |
| 94 | 94 | return arraySome($schema->getPossibleTypes($typeA), |
| 95 | - function (TypeInterface $type) use ($schema, $typeB) { |
|
| 95 | + function(TypeInterface $type) use ($schema, $typeB) { |
|
| 96 | 96 | return $schema->isPossibleType($typeB, $type); |
| 97 | 97 | }); |
| 98 | 98 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function buildTypes(): array |
| 121 | 121 | { |
| 122 | - return \array_map(function (TypeDefinitionNodeInterface $definition) { |
|
| 122 | + return \array_map(function(TypeDefinitionNodeInterface $definition) { |
|
| 123 | 123 | return $this->definitionBuilder->buildType($definition); |
| 124 | 124 | }, \array_values($this->typeDefinitionMap)); |
| 125 | 125 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function buildDirectives(): array |
| 131 | 131 | { |
| 132 | - $directives = \array_map(function (DirectiveDefinitionNode $definition) { |
|
| 132 | + $directives = \array_map(function(DirectiveDefinitionNode $definition) { |
|
| 133 | 133 | return $this->definitionBuilder->buildDirective($definition); |
| 134 | 134 | }, $this->directiveDefinitions); |
| 135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | ]; |
| 141 | 141 | |
| 142 | 142 | foreach ($specifiedDirectivesMap as $name => $directive) { |
| 143 | - if (!arraySome($directives, function (Directive $directive) use ($name) { |
|
| 143 | + if (!arraySome($directives, function(Directive $directive) use ($name) { |
|
| 144 | 144 | return $directive->getName() === $name; |
| 145 | 145 | })) { |
| 146 | 146 | $directives[] = $directive; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function getDirective(string $name): ?Directive |
| 128 | 128 | { |
| 129 | - return find($this->directives, function (Directive $directive) use ($name) { |
|
| 129 | + return find($this->directives, function(Directive $directive) use ($name) { |
|
| 130 | 130 | return $directive->getName() === $name; |
| 131 | 131 | }); |
| 132 | 132 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | 181 | $this->possibleTypesMap[$abstractTypeName] = \array_reduce($possibleTypes, |
| 182 | - function (array $map, TypeInterface $type) { |
|
| 182 | + function(array $map, TypeInterface $type) { |
|
| 183 | 183 | /** @var NameAwareInterface $type */ |
| 184 | 184 | $map[$type->getName()] = true; |
| 185 | 185 | return $map; |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
| 385 | 385 | foreach ($type->getFields() as $field) { |
| 386 | 386 | if ($field->hasArguments()) { |
| 387 | - $fieldArgTypes = \array_map(function (Argument $argument) { |
|
| 387 | + $fieldArgTypes = \array_map(function(Argument $argument) { |
|
| 388 | 388 | return $argument->getType(); |
| 389 | 389 | }, $field->getArguments()); |
| 390 | 390 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | return $map; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - return \array_reduce($directive->getArguments(), function ($map, Argument $argument) { |
|
| 421 | + return \array_reduce($directive->getArguments(), function($map, Argument $argument) { |
|
| 422 | 422 | return $this->typeMapReducer($map, $argument->getType()); |
| 423 | 423 | }, $map); |
| 424 | 424 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $errors = $this->validate($schema); |
| 51 | 51 | |
| 52 | 52 | if (!empty($errors)) { |
| 53 | - $message = \implode("\n", \array_map(function (SchemaValidationException $error) { |
|
| 53 | + $message = \implode("\n", \array_map(function(SchemaValidationException $error) { |
|
| 54 | 54 | return $error->getMessage(); |
| 55 | 55 | }, $errors)); |
| 56 | 56 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | // Assert each interface field arg is implemented. |
| 317 | 317 | foreach ($interfaceField->getArguments() as $interfaceArgument) { |
| 318 | 318 | $argumentName = $interfaceArgument->getName(); |
| 319 | - $objectArgument = find($objectField->getArguments(), function (Argument $argument) use ($argumentName) { |
|
| 319 | + $objectArgument = find($objectField->getArguments(), function(Argument $argument) use ($argumentName) { |
|
| 320 | 320 | return $argument->getName() === $argumentName; |
| 321 | 321 | }); |
| 322 | 322 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $argumentName = $objectArgument->getName(); |
| 376 | 376 | $interfaceArgument = find( |
| 377 | 377 | $interfaceField->getArguments(), |
| 378 | - function (Argument $argument) use ($argumentName) { |
|
| 378 | + function(Argument $argument) use ($argumentName) { |
|
| 379 | 379 | return $argument->getName() === $argumentName; |
| 380 | 380 | } |
| 381 | 381 | ); |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | return null; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - return \array_filter($node->getTypes(), function (NamedTypeNode $type) use ($memberTypeName) { |
|
| 717 | + return \array_filter($node->getTypes(), function(NamedTypeNode $type) use ($memberTypeName) { |
|
| 718 | 718 | return $type->getNameValue() === $memberTypeName; |
| 719 | 719 | }); |
| 720 | 720 | } |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | return null; |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - return \array_filter($node->getValues(), function (NameAwareInterface $type) use ($valueName) { |
|
| 736 | + return \array_filter($node->getValues(), function(NameAwareInterface $type) use ($valueName) { |
|
| 737 | 737 | return $type->getNameValue() === $valueName; |
| 738 | 738 | }); |
| 739 | 739 | } |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | /** @var OperationTypeDefinitionNode $operationTypeNode */ |
| 90 | 90 | $operationTypeNode = find( |
| 91 | 91 | $node->getOperationTypes(), |
| 92 | - function (OperationTypeDefinitionNode $operationType) use ($operation) { |
|
| 92 | + function(OperationTypeDefinitionNode $operationType) use ($operation) { |
|
| 93 | 93 | return $operationType->getOperation() === $operation; |
| 94 | 94 | } |
| 95 | 95 | ); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | public function getExtendedTypes(): array |
| 169 | 169 | { |
| 170 | 170 | return \array_merge( |
| 171 | - \array_map(function ($type) { |
|
| 171 | + \array_map(function($type) { |
|
| 172 | 172 | return $this->getExtendedType($type); |
| 173 | 173 | }, \array_values($this->schema->getTypeMap())), |
| 174 | 174 | $this->definitionBuilder->buildTypes(\array_values($this->typeDefinitionMap)) |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | return \array_merge( |
| 189 | 189 | $existingDirectives, |
| 190 | - \array_map(function (DirectiveDefinitionNode $node) { |
|
| 190 | + \array_map(function(DirectiveDefinitionNode $node) { |
|
| 191 | 191 | return $this->definitionBuilder->buildDirective($node); |
| 192 | 192 | }, $this->directiveDefinitions) |
| 193 | 193 | ); |
@@ -403,10 +403,10 @@ discard block |
||
| 403 | 403 | return newGraphQLObjectType([ |
| 404 | 404 | 'name' => $typeName, |
| 405 | 405 | 'description' => $type->getDescription(), |
| 406 | - 'interfaces' => function () use ($type) { |
|
| 406 | + 'interfaces' => function() use ($type) { |
|
| 407 | 407 | return $this->extendImplementedInterfaces($type); |
| 408 | 408 | }, |
| 409 | - 'fields' => function () use ($type) { |
|
| 409 | + 'fields' => function() use ($type) { |
|
| 410 | 410 | return $this->extendFieldMap($type); |
| 411 | 411 | }, |
| 412 | 412 | 'astNode' => $type->getAstNode(), |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | return newGraphQLInterfaceType([ |
| 434 | 434 | 'name' => $typeName, |
| 435 | 435 | 'description' => $type->getDescription(), |
| 436 | - 'fields' => function () use ($type) { |
|
| 436 | + 'fields' => function() use ($type) { |
|
| 437 | 437 | return $this->extendFieldMap($type); |
| 438 | 438 | }, |
| 439 | 439 | 'astNode' => $type->getAstNode(), |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | return newGraphQLUnionType([ |
| 453 | 453 | 'name' => $type->getName(), |
| 454 | 454 | 'description' => $type->getDescription(), |
| 455 | - 'types' => \array_map(function ($unionType) { |
|
| 455 | + 'types' => \array_map(function($unionType) { |
|
| 456 | 456 | return $this->getExtendedType($unionType); |
| 457 | 457 | }, $type->getTypes()), |
| 458 | 458 | 'astNode' => $type->getAstNode(), |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | */ |
| 468 | 468 | protected function extendImplementedInterfaces(ObjectType $type): array |
| 469 | 469 | { |
| 470 | - $interfaces = \array_map(function (InterfaceType $interface) { |
|
| 470 | + $interfaces = \array_map(function(InterfaceType $interface) { |
|
| 471 | 471 | return $this->getExtendedType($interface); |
| 472 | 472 | }, $type->getInterfaces()); |
| 473 | 473 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | 'description' => $field->getDescription(), |
| 510 | 510 | 'deprecationReason' => $field->getDeprecationReason(), |
| 511 | 511 | 'type' => $this->extendFieldType($field->getType()), |
| 512 | - 'args' => keyMap($field->getArguments(), function (Argument $argument) { |
|
| 512 | + 'args' => keyMap($field->getArguments(), function(Argument $argument) { |
|
| 513 | 513 | return $argument->getName(); |
| 514 | 514 | }), |
| 515 | 515 | 'astNode' => $field->getAstNode(), |