@@ -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 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function getOperationTypesAsArray(): array |
| 44 | 44 | { |
| 45 | - return \array_map(function (SerializationInterface $node) { |
|
| 45 | + return \array_map(function(SerializationInterface $node) { |
|
| 46 | 46 | return $node->toArray(); |
| 47 | 47 | }, $this->operationTypes); |
| 48 | 48 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function getLocationsAsArray(): array |
| 55 | 55 | { |
| 56 | - return \array_map(function (SerializationInterface $node) { |
|
| 56 | + return \array_map(function(SerializationInterface $node) { |
|
| 57 | 57 | return $node->toArray(); |
| 58 | 58 | }, $this->locations); |
| 59 | 59 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function getVariableDefinitionsAsArray(): array |
| 26 | 26 | { |
| 27 | - return \array_map(function (SerializationInterface $node) { |
|
| 27 | + return \array_map(function(SerializationInterface $node) { |
|
| 28 | 28 | return $node->toArray(); |
| 29 | 29 | }, $this->variableDefinitions); |
| 30 | 30 | } |