@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function buildTypes(array $nodes): array |
| 110 | 110 | { |
| 111 | - return \array_map(function (NodeInterface $node) { |
|
| 111 | + return \array_map(function(NodeInterface $node) { |
|
| 112 | 112 | return $this->buildType($node); |
| 113 | 113 | }, $nodes); |
| 114 | 114 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $directive = newDirective([ |
| 153 | 153 | 'name' => $node->getNameValue(), |
| 154 | 154 | 'description' => $node->getDescriptionValue(), |
| 155 | - 'locations' => \array_map(function (NameNode $node) { |
|
| 155 | + 'locations' => \array_map(function(NameNode $node) { |
|
| 156 | 156 | return $node->getValue(); |
| 157 | 157 | }, $node->getLocations()), |
| 158 | 158 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | $typesMap = keyMap( |
| 220 | 220 | \array_merge($customTypes, specifiedScalarTypes(), introspectionTypes()), |
| 221 | - function (NamedTypeInterface $type) { |
|
| 221 | + function(NamedTypeInterface $type) { |
|
| 222 | 222 | return $type->getName(); |
| 223 | 223 | } |
| 224 | 224 | ); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | $directivesMap = keyMap( |
| 237 | 237 | \array_merge($customDirectives, specifiedDirectives()), |
| 238 | - function (Directive $directive) { |
|
| 238 | + function(Directive $directive) { |
|
| 239 | 239 | return $directive->getName(); |
| 240 | 240 | } |
| 241 | 241 | ); |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | { |
| 255 | 255 | return keyValueMap( |
| 256 | 256 | $nodes, |
| 257 | - function (InputValueDefinitionNode $value) { |
|
| 257 | + function(InputValueDefinitionNode $value) { |
|
| 258 | 258 | return $value->getNameValue(); |
| 259 | 259 | }, |
| 260 | - function (InputValueDefinitionNode $value): array { |
|
| 260 | + function(InputValueDefinitionNode $value): array { |
|
| 261 | 261 | $type = $this->buildWrappedType($value->getType()); |
| 262 | 262 | $defaultValue = $value->getDefaultValue(); |
| 263 | 263 | return [ |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | return newObjectType([ |
| 310 | 310 | 'name' => $node->getNameValue(), |
| 311 | 311 | 'description' => $node->getDescriptionValue(), |
| 312 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
| 312 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
| 313 | 313 | return $this->buildFields($node); |
| 314 | 314 | } : [], |
| 315 | 315 | // Note: While this could make early assertions to get the correctly |
| 316 | 316 | // typed values, that would throw immediately while type system |
| 317 | 317 | // validation with validateSchema() will produce more actionable results. |
| 318 | - 'interfaces' => function () use ($node) { |
|
| 319 | - return $node->hasInterfaces() ? \array_map(function (NodeInterface $interface) { |
|
| 318 | + 'interfaces' => function() use ($node) { |
|
| 319 | + return $node->hasInterfaces() ? \array_map(function(NodeInterface $interface) { |
|
| 320 | 320 | return $this->buildType($interface); |
| 321 | 321 | }, $node->getInterfaces()) : []; |
| 322 | 322 | }, |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | return keyValueMap( |
| 334 | 334 | $node->getFields(), |
| 335 | - function ($value) { |
|
| 335 | + function($value) { |
|
| 336 | 336 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
| 337 | 337 | return $value->getNameValue(); |
| 338 | 338 | }, |
| 339 | - function ($value) use ($node) { |
|
| 339 | + function($value) use ($node) { |
|
| 340 | 340 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
| 341 | 341 | return $this->buildField($value, |
| 342 | 342 | $this->getFieldResolver($node->getNameValue(), $value->getNameValue())); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | return newInterfaceType([ |
| 366 | 366 | 'name' => $node->getNameValue(), |
| 367 | 367 | 'description' => $node->getDescriptionValue(), |
| 368 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
| 368 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
| 369 | 369 | return $this->buildFields($node); |
| 370 | 370 | } : [], |
| 371 | 371 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | 'description' => $node->getDescriptionValue(), |
| 385 | 385 | 'values' => $node->hasValues() ? keyValueMap( |
| 386 | 386 | $node->getValues(), |
| 387 | - function (EnumValueDefinitionNode $value): ?string { |
|
| 387 | + function(EnumValueDefinitionNode $value): ?string { |
|
| 388 | 388 | return $value->getNameValue(); |
| 389 | 389 | }, |
| 390 | - function (EnumValueDefinitionNode $value): array { |
|
| 390 | + function(EnumValueDefinitionNode $value): array { |
|
| 391 | 391 | return [ |
| 392 | 392 | 'description' => $value->getDescriptionValue(), |
| 393 | 393 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | return newUnionType([ |
| 409 | 409 | 'name' => $node->getNameValue(), |
| 410 | 410 | 'description' => $node->getDescriptionValue(), |
| 411 | - 'types' => $node->hasTypes() ? \array_map(function (TypeNodeInterface $type) { |
|
| 411 | + 'types' => $node->hasTypes() ? \array_map(function(TypeNodeInterface $type) { |
|
| 412 | 412 | return $this->buildType($type); |
| 413 | 413 | }, $node->getTypes()) : [], |
| 414 | 414 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | return newScalarType([ |
| 437 | 437 | 'name' => $node->getNameValue(), |
| 438 | 438 | 'description' => $node->getDescriptionValue(), |
| 439 | - 'serialize' => function ($value) { |
|
| 439 | + 'serialize' => function($value) { |
|
| 440 | 440 | return $value; |
| 441 | 441 | }, |
| 442 | 442 | 'astNode' => $node, |
@@ -453,13 +453,13 @@ discard block |
||
| 453 | 453 | return newInputObjectType([ |
| 454 | 454 | 'name' => $node->getNameValue(), |
| 455 | 455 | 'description' => $node->getDescriptionValue(), |
| 456 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
| 456 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
| 457 | 457 | return keyValueMap( |
| 458 | 458 | $node->getFields(), |
| 459 | - function (InputValueDefinitionNode $value): ?string { |
|
| 459 | + function(InputValueDefinitionNode $value): ?string { |
|
| 460 | 460 | return $value->getNameValue(); |
| 461 | 461 | }, |
| 462 | - function (InputValueDefinitionNode $value): array { |
|
| 462 | + function(InputValueDefinitionNode $value): array { |
|
| 463 | 463 | $type = $this->buildWrappedType($value->getType()); |
| 464 | 464 | $defaultValue = $value->getDefaultValue(); |
| 465 | 465 | 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 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $nodes = [$nodes]; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $this->nodes = \array_filter($nodes, function ($node) { |
|
| 196 | + $this->nodes = \array_filter($nodes, function($node) { |
|
| 197 | 197 | return null !== $node; |
| 198 | 198 | }); |
| 199 | 199 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | protected function resolvePositions(?array $positions) |
| 225 | 225 | { |
| 226 | 226 | if (null === $positions && !empty($this->nodes)) { |
| 227 | - $positions = \array_reduce($this->nodes, function (array $list, ?NodeInterface $node) { |
|
| 227 | + $positions = \array_reduce($this->nodes, function(array $list, ?NodeInterface $node) { |
|
| 228 | 228 | if (null !== $node) { |
| 229 | 229 | $location = $node->getLocation(); |
| 230 | 230 | if (null !== $location) { |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | protected function resolveLocations(?array $positions, ?Source $source) |
| 253 | 253 | { |
| 254 | 254 | if (null !== $positions && null !== $source) { |
| 255 | - $locations = \array_map(function ($position) use ($source) { |
|
| 255 | + $locations = \array_map(function($position) use ($source) { |
|
| 256 | 256 | return SourceLocation::fromSource($source, $position); |
| 257 | 257 | }, $positions); |
| 258 | 258 | } elseif (!empty($this->nodes)) { |
| 259 | - $locations = \array_reduce($this->nodes, function (array $list, NodeInterface $node) { |
|
| 259 | + $locations = \array_reduce($this->nodes, function(array $list, NodeInterface $node) { |
|
| 260 | 260 | $location = $node->getLocation(); |
| 261 | 261 | if (null !== $location) { |
| 262 | 262 | $list[] = SourceLocation::fromSource($location->getSource(), $location->getStart()); |