@@ -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 [ |
@@ -53,7 +53,7 @@ |
||
53 | 53 | if ($code === 92) { |
54 | 54 | // \ |
55 | 55 | $value .= sliceString($body, $chunkStart, $pos - 1); |
56 | - $code = charCodeAt($body, $pos); |
|
56 | + $code = charCodeAt($body, $pos); |
|
57 | 57 | |
58 | 58 | switch ($code) { |
59 | 59 | case 34: |
@@ -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 |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | if ($isContainsPromise) { |
252 | 252 | $keys = array_keys($finalResults); |
253 | 253 | $promise = \React\Promise\all(array_values($finalResults)); |
254 | - $promise->then(function ($values) use ($keys, &$finalResults) { |
|
254 | + $promise->then(function($values) use ($keys, &$finalResults) { |
|
255 | 255 | foreach ($values as $i => $value) { |
256 | 256 | $finalResults[$keys[$i]] = $value; |
257 | 257 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | $promise = new \React\Promise\FulfilledPromise([]); |
287 | 287 | |
288 | - $resolve = function ($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) { |
|
288 | + $resolve = function($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) { |
|
289 | 289 | $fieldPath = $path; |
290 | 290 | $fieldPath[] = $fieldName; |
291 | 291 | try { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | if ($this->isPromise($result)) { |
298 | 298 | /** @var ExtendedPromiseInterface $result */ |
299 | - return $result->then(function ($resolvedResult) use ($fieldName, $results) { |
|
299 | + return $result->then(function($resolvedResult) use ($fieldName, $results) { |
|
300 | 300 | $results[$fieldName] = $resolvedResult; |
301 | 301 | return $results; |
302 | 302 | }); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | }; |
309 | 309 | |
310 | 310 | foreach ($fields as $fieldName => $fieldNodes) { |
311 | - $promise = $promise->then(function ($resolvedResults) use ( |
|
311 | + $promise = $promise->then(function($resolvedResults) use ( |
|
312 | 312 | $resolve, |
313 | 313 | $fieldName, |
314 | 314 | $path, |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | }); |
321 | 321 | } |
322 | 322 | |
323 | - $promise->then(function ($resolvedResults) use (&$finalResults) { |
|
323 | + $promise->then(function($resolvedResults) use (&$finalResults) { |
|
324 | 324 | $finalResults = $resolvedResults ?? []; |
325 | 325 | }); |
326 | 326 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | if ($this->isPromise($completed)) { |
505 | 505 | $context = $this->context; |
506 | 506 | /** @var ExtendedPromiseInterface $completed */ |
507 | - return $completed->then(null, function ($error) use ($context, $fieldNodes, $path) { |
|
507 | + return $completed->then(null, function($error) use ($context, $fieldNodes, $path) { |
|
508 | 508 | //@TODO Handle $error better |
509 | 509 | if ($error instanceof \Exception) { |
510 | 510 | $context->addError($this->buildLocatedError($error, $fieldNodes, $path)); |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | ) { |
580 | 580 | if ($this->isPromise($result)) { |
581 | 581 | /** @var ExtendedPromiseInterface $result */ |
582 | - return $result->then(function (&$value) use ($returnType, $fieldNodes, $info, $path) { |
|
582 | + return $result->then(function(&$value) use ($returnType, $fieldNodes, $info, $path) { |
|
583 | 583 | return $this->completeValue($returnType, $fieldNodes, $info, $path, $value); |
584 | 584 | }); |
585 | 585 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | if ($this->isPromise($runtimeType)) { |
669 | 669 | /** @var ExtendedPromiseInterface $runtimeType */ |
670 | - return $runtimeType->then(function ($resolvedRuntimeType) use ( |
|
670 | + return $runtimeType->then(function($resolvedRuntimeType) use ( |
|
671 | 671 | $returnType, |
672 | 672 | $fieldNodes, |
673 | 673 | $info, |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | if (!empty($promisedIsTypeOfResults)) { |
794 | 794 | return \React\Promise\all($promisedIsTypeOfResults) |
795 | - ->then(function ($isTypeOfResults) use ($possibleTypes) { |
|
795 | + ->then(function($isTypeOfResults) use ($possibleTypes) { |
|
796 | 796 | foreach ($isTypeOfResults as $index => $result) { |
797 | 797 | if ($result) { |
798 | 798 | return $possibleTypes[$index]; |