@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getExtendedTypes(): array |
| 113 | 113 | { |
| 114 | - $extendedTypes = \array_map(function ($type) { |
|
| 114 | + $extendedTypes = \array_map(function($type) { |
|
| 115 | 115 | return $this->getExtendedType($type); |
| 116 | 116 | }, $this->info->getSchema()->getTypeMap()); |
| 117 | 117 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | return \array_merge( |
| 135 | 135 | $existingDirectives, |
| 136 | - \array_map(function (DirectiveDefinitionNode $node) { |
|
| 136 | + \array_map(function(DirectiveDefinitionNode $node) { |
|
| 137 | 137 | return $this->definitionBuilder->buildDirective($node); |
| 138 | 138 | }, $this->info->getDirectiveDefinitions()) |
| 139 | 139 | ); |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | return newObjectType([ |
| 239 | 239 | 'name' => $typeName, |
| 240 | 240 | 'description' => $type->getDescription(), |
| 241 | - 'interfaces' => function () use ($type) { |
|
| 241 | + 'interfaces' => function() use ($type) { |
|
| 242 | 242 | return $this->extendImplementedInterfaces($type); |
| 243 | 243 | }, |
| 244 | - 'fields' => function () use ($type) { |
|
| 244 | + 'fields' => function() use ($type) { |
|
| 245 | 245 | return $this->extendFieldMap($type); |
| 246 | 246 | }, |
| 247 | 247 | 'astNode' => $type->getAstNode(), |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | return newInterfaceType([ |
| 267 | 267 | 'name' => $typeName, |
| 268 | 268 | 'description' => $type->getDescription(), |
| 269 | - 'fields' => function () use ($type) { |
|
| 269 | + 'fields' => function() use ($type) { |
|
| 270 | 270 | return $this->extendFieldMap($type); |
| 271 | 271 | }, |
| 272 | 272 | 'astNode' => $type->getAstNode(), |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | return newUnionType([ |
| 297 | 297 | 'name' => $type->getName(), |
| 298 | 298 | 'description' => $type->getDescription(), |
| 299 | - 'types' => \array_map(function ($unionType) { |
|
| 299 | + 'types' => \array_map(function($unionType) { |
|
| 300 | 300 | return $this->getExtendedType($unionType); |
| 301 | 301 | }, $type->getTypes()), |
| 302 | 302 | 'astNode' => $type->getAstNode(), |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | { |
| 314 | 314 | $typeName = $type->getName(); |
| 315 | 315 | |
| 316 | - $interfaces = \array_map(function (InterfaceType $interface) { |
|
| 316 | + $interfaces = \array_map(function(InterfaceType $interface) { |
|
| 317 | 317 | return $this->getExtendedType($interface); |
| 318 | 318 | }, $type->getInterfaces()); |
| 319 | 319 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | 'description' => $field->getDescription(), |
| 356 | 356 | 'deprecationReason' => $field->getDeprecationReason(), |
| 357 | 357 | 'type' => $this->extendFieldType($field->getType()), |
| 358 | - 'args' => keyMap($field->getArguments(), function (Argument $argument) { |
|
| 358 | + 'args' => keyMap($field->getArguments(), function(Argument $argument) { |
|
| 359 | 359 | return $argument->getName(); |
| 360 | 360 | }), |
| 361 | 361 | 'astNode' => $field->getAstNode(), |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return $coercedValues; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $argumentNodeMap = keyMap($argumentNodes, function (ArgumentNode $value) { |
|
| 59 | + $argumentNodeMap = keyMap($argumentNodes, function(ArgumentNode $value) { |
|
| 60 | 60 | return $value->getNameValue(); |
| 61 | 61 | }); |
| 62 | 62 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | array $variableValues = [] |
| 132 | 132 | ): ?array { |
| 133 | 133 | $directiveNode = $node->hasDirectives() |
| 134 | - ? find($node->getDirectives(), function (NameAwareInterface $value) use ($directive) { |
|
| 134 | + ? find($node->getDirectives(), function(NameAwareInterface $value) use ($directive) { |
|
| 135 | 135 | return $value->getNameValue() === $directive->getName(); |
| 136 | 136 | }) : null; |
| 137 | 137 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | ]); |
| 330 | 330 | } |
| 331 | 331 | return new CoercedValue($parseResult, null); |
| 332 | - } catch (InvalidTypeException|CoercingException $ex) { |
|
| 332 | + } catch (InvalidTypeException | CoercingException $ex) { |
|
| 333 | 333 | return new CoercedValue(null, [ |
| 334 | 334 | $this->buildCoerceException( |
| 335 | 335 | sprintf('Expected type %s', (string)$type), |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - $suggestions = suggestionList((string)$value, array_map(function (EnumValue $enumValue) { |
|
| 366 | + $suggestions = suggestionList((string)$value, array_map(function(EnumValue $enumValue) { |
|
| 367 | 367 | return $enumValue->getName(); |
| 368 | 368 | }, $type->getValues())); |
| 369 | 369 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function getTypeResolver(): ?callable |
| 27 | 27 | { |
| 28 | - return function ($rootValue, $contextValues, ResolveInfo $info) { |
|
| 28 | + return function($rootValue, $contextValues, ResolveInfo $info) { |
|
| 29 | 29 | return $this->resolveType($rootValue, $contextValues, $info); |
| 30 | 30 | }; |
| 31 | 31 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $builtInTypes = keyMap( |
| 98 | 98 | \array_merge(specifiedScalarTypes(), introspectionTypes()), |
| 99 | - function (NamedTypeInterface $type) { |
|
| 99 | + function(NamedTypeInterface $type) { |
|
| 100 | 100 | return $type->getName(); |
| 101 | 101 | } |
| 102 | 102 | ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function buildTypes(array $nodes): array |
| 113 | 113 | { |
| 114 | - return \array_map(function (NodeInterface $node) { |
|
| 114 | + return \array_map(function(NodeInterface $node) { |
|
| 115 | 115 | return $this->buildType($node); |
| 116 | 116 | }, $nodes); |
| 117 | 117 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | return newDirective([ |
| 148 | 148 | 'name' => $node->getNameValue(), |
| 149 | 149 | 'description' => $node->getDescriptionValue(), |
| 150 | - 'locations' => \array_map(function (NameNode $node) { |
|
| 150 | + 'locations' => \array_map(function(NameNode $node) { |
|
| 151 | 151 | return $node->getValue(); |
| 152 | 152 | }, $node->getLocations()), |
| 153 | 153 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | return keyValueMap( |
| 193 | 193 | $nodes, |
| 194 | - function (InputValueDefinitionNode $value) { |
|
| 194 | + function(InputValueDefinitionNode $value) { |
|
| 195 | 195 | return $value->getNameValue(); |
| 196 | 196 | }, |
| 197 | - function (InputValueDefinitionNode $value): array { |
|
| 197 | + function(InputValueDefinitionNode $value): array { |
|
| 198 | 198 | $type = $this->buildWrappedType($value->getType()); |
| 199 | 199 | $defaultValue = $value->getDefaultValue(); |
| 200 | 200 | return [ |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | return newObjectType([ |
| 247 | 247 | 'name' => $node->getNameValue(), |
| 248 | 248 | 'description' => $node->getDescriptionValue(), |
| 249 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
| 249 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
| 250 | 250 | return $this->buildFields($node); |
| 251 | 251 | } : [], |
| 252 | 252 | // Note: While this could make early assertions to get the correctly |
| 253 | 253 | // typed values, that would throw immediately while type system |
| 254 | 254 | // validation with validateSchema() will produce more actionable results. |
| 255 | - 'interfaces' => function () use ($node) { |
|
| 256 | - return $node->hasInterfaces() ? \array_map(function (NodeInterface $interface) { |
|
| 255 | + 'interfaces' => function() use ($node) { |
|
| 256 | + return $node->hasInterfaces() ? \array_map(function(NodeInterface $interface) { |
|
| 257 | 257 | return $this->buildType($interface); |
| 258 | 258 | }, $node->getInterfaces()) : []; |
| 259 | 259 | }, |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | return keyValueMap( |
| 271 | 271 | $node->getFields(), |
| 272 | - function ($value) { |
|
| 272 | + function($value) { |
|
| 273 | 273 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
| 274 | 274 | return $value->getNameValue(); |
| 275 | 275 | }, |
| 276 | - function ($value) use ($node) { |
|
| 276 | + function($value) use ($node) { |
|
| 277 | 277 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
| 278 | 278 | return $this->buildField($value, $this->getFieldResolver($node->getNameValue(), $value->getNameValue())); |
| 279 | 279 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | return newInterfaceType([ |
| 302 | 302 | 'name' => $node->getNameValue(), |
| 303 | 303 | 'description' => $node->getDescriptionValue(), |
| 304 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
| 304 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
| 305 | 305 | return $this->buildFields($node); |
| 306 | 306 | } : [], |
| 307 | 307 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | 'description' => $node->getDescriptionValue(), |
| 321 | 321 | 'values' => $node->hasValues() ? keyValueMap( |
| 322 | 322 | $node->getValues(), |
| 323 | - function (EnumValueDefinitionNode $value): string { |
|
| 323 | + function(EnumValueDefinitionNode $value): string { |
|
| 324 | 324 | return $value->getNameValue(); |
| 325 | 325 | }, |
| 326 | - function (EnumValueDefinitionNode $value): array { |
|
| 326 | + function(EnumValueDefinitionNode $value): array { |
|
| 327 | 327 | return [ |
| 328 | 328 | 'description' => $value->getDescriptionValue(), |
| 329 | 329 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | return newUnionType([ |
| 345 | 345 | 'name' => $node->getNameValue(), |
| 346 | 346 | 'description' => $node->getDescriptionValue(), |
| 347 | - 'types' => $node->hasTypes() ? \array_map(function (TypeNodeInterface $type) { |
|
| 347 | + 'types' => $node->hasTypes() ? \array_map(function(TypeNodeInterface $type) { |
|
| 348 | 348 | return $this->buildType($type); |
| 349 | 349 | }, $node->getTypes()) : [], |
| 350 | 350 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | return newScalarType([ |
| 373 | 373 | 'name' => $node->getNameValue(), |
| 374 | 374 | 'description' => $node->getDescriptionValue(), |
| 375 | - 'serialize' => function ($value) { |
|
| 375 | + 'serialize' => function($value) { |
|
| 376 | 376 | return $value; |
| 377 | 377 | }, |
| 378 | 378 | 'astNode' => $node, |
@@ -388,13 +388,13 @@ discard block |
||
| 388 | 388 | return newInputObjectType([ |
| 389 | 389 | 'name' => $node->getNameValue(), |
| 390 | 390 | 'description' => $node->getDescriptionValue(), |
| 391 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
| 391 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
| 392 | 392 | return keyValueMap( |
| 393 | 393 | $node->getFields(), |
| 394 | - function (InputValueDefinitionNode $value): string { |
|
| 394 | + function(InputValueDefinitionNode $value): string { |
|
| 395 | 395 | return $value->getNameValue(); |
| 396 | 396 | }, |
| 397 | - function (InputValueDefinitionNode $value): array { |
|
| 397 | + function(InputValueDefinitionNode $value): array { |
|
| 398 | 398 | $type = $this->buildWrappedType($value->getType()); |
| 399 | 399 | $defaultValue = $value->getDefaultValue(); |
| 400 | 400 | return [ |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function getLocationsAsArray(): ?array |
| 154 | 154 | { |
| 155 | - return !empty($this->locations) ? \array_map(function (SourceLocation $location) { |
|
| 155 | + return !empty($this->locations) ? \array_map(function(SourceLocation $location) { |
|
| 156 | 156 | return $location->toArray(); |
| 157 | 157 | }, $this->locations) : null; |
| 158 | 158 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | ? (!empty($nodes) ? $nodes : []) |
| 192 | 192 | : (null !== $nodes ? [$nodes] : []); |
| 193 | 193 | |
| 194 | - $this->nodes = \array_filter($nodes, function ($node) { |
|
| 194 | + $this->nodes = \array_filter($nodes, function($node) { |
|
| 195 | 195 | return null !== $node; |
| 196 | 196 | }); |
| 197 | 197 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | protected function resolvePositions(?array $positions) |
| 223 | 223 | { |
| 224 | 224 | if (null === $positions && !empty($this->nodes)) { |
| 225 | - $positions = \array_reduce($this->nodes, function (array $list, ?NodeInterface $node) { |
|
| 225 | + $positions = \array_reduce($this->nodes, function(array $list, ?NodeInterface $node) { |
|
| 226 | 226 | if (null !== $node) { |
| 227 | 227 | $location = $node->getLocation(); |
| 228 | 228 | if (null !== $location) { |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | protected function resolveLocations(?array $positions, ?Source $source) |
| 251 | 251 | { |
| 252 | 252 | if (null !== $positions && null !== $source) { |
| 253 | - $locations = \array_map(function ($position) use ($source) { |
|
| 253 | + $locations = \array_map(function($position) use ($source) { |
|
| 254 | 254 | return SourceLocation::fromSource($source, $position); |
| 255 | 255 | }, $positions); |
| 256 | 256 | } elseif (!empty($this->nodes)) { |
| 257 | - $locations = \array_reduce($this->nodes, function (array $list, NodeInterface $node) { |
|
| 257 | + $locations = \array_reduce($this->nodes, function(array $list, NodeInterface $node) { |
|
| 258 | 258 | $location = $node->getLocation(); |
| 259 | 259 | if (null !== $location) { |
| 260 | 260 | $list[] = SourceLocation::fromSource($location->getSource(), $location->getStart()); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | \preg_match_all("/\r\n|[\n\r]/", \substr($source->getBody(), 0, $position), $matches, PREG_OFFSET_CAPTURE); |
| 62 | 62 | |
| 63 | 63 | foreach ($matches[0] as $index => $match) { |
| 64 | - $line += 1; |
|
| 64 | + $line += 1; |
|
| 65 | 65 | $column = $position + 1 - ($match[1] + \strlen($match[0])); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getValuesAsArray(): array |
| 40 | 40 | { |
| 41 | - return \array_map(function (SerializationInterface $node) { |
|
| 41 | + return \array_map(function(SerializationInterface $node) { |
|
| 42 | 42 | return $node->toArray(); |
| 43 | 43 | }, $this->values); |
| 44 | 44 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function __toString(): string |
| 72 | 72 | { |
| 73 | - return \json_encode(\array_map(function (ValueNodeInterface $node) { |
|
| 73 | + return \json_encode(\array_map(function(ValueNodeInterface $node) { |
|
| 74 | 74 | return $node->getValue(); |
| 75 | 75 | }, $this->getValues())); |
| 76 | 76 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function getArgumentsAsArray(): array |
| 34 | 34 | { |
| 35 | - return \array_map(function (SerializationInterface $node) { |
|
| 35 | + return \array_map(function(SerializationInterface $node) { |
|
| 36 | 36 | return $node->toArray(); |
| 37 | 37 | }, $this->getArguments()); |
| 38 | 38 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function getDefinitionsAsArray(): array |
| 40 | 40 | { |
| 41 | - return \array_map(function (SerializationInterface $node) { |
|
| 41 | + return \array_map(function(SerializationInterface $node) { |
|
| 42 | 42 | return $node->toArray(); |
| 43 | 43 | }, $this->definitions); |
| 44 | 44 | } |