Passed
Pull Request — master (#347)
by Christoffer
06:07
created
src/Execution/Strategy/AbstractExecutionStrategy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             );
253 253
 
254 254
             if ($result instanceof PromiseInterface) {
255
-                return $result->then(null, function ($exception) use ($fieldNode, $info) {
255
+                return $result->then(null, function($exception) use ($fieldNode, $info) {
256 256
                     return !$exception instanceof ExecutionException
257 257
                         ? $this->normalizeException($exception, [$fieldNode], $info->getPath())
258 258
                         : $exception;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     ) {
329 329
         try {
330 330
             $completed = $result instanceof PromiseInterface
331
-                ? $result->then(function ($resolvedResult) use ($returnType, $fieldNodes, $info, $path) {
331
+                ? $result->then(function($resolvedResult) use ($returnType, $fieldNodes, $info, $path) {
332 332
                     return $this->completeValue($returnType, $fieldNodes, $info, $path, $resolvedResult);
333 333
                 })
334 334
                 : $this->completeValue($returnType, $fieldNodes, $info, $path, $result);
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             if ($completed instanceof PromiseInterface) {
337 337
                 // Note: we don't rely on a `catch` method, but we do expect "thenable"
338 338
                 // to take a second callback for the error case.
339
-                return $completed->then(null, function ($exception) use ($fieldNodes, $path, $returnType) {
339
+                return $completed->then(null, function($exception) use ($fieldNodes, $path, $returnType) {
340 340
                     $this->handleFieldError($exception, $fieldNodes, $path, $returnType);
341 341
                 });
342 342
             }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
             );
535 535
 
536 536
         if ($runtimeType instanceof PromiseInterface) {
537
-            return $runtimeType->then(function ($resolvedRuntimeType) use (
537
+            return $runtimeType->then(function($resolvedRuntimeType) use (
538 538
                 $returnType,
539 539
                 $fieldNodes,
540 540
                 $info,
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
             $isTypeOf = $returnType->isTypeOf($result, $this->context->getContextValue(), $info);
589 589
 
590 590
             if ($isTypeOf instanceof PromiseInterface) {
591
-                return $isTypeOf->then(function ($resolvedIsTypeOf) use ($returnType, $result, $fieldNodes, $path) {
591
+                return $isTypeOf->then(function($resolvedIsTypeOf) use ($returnType, $result, $fieldNodes, $path) {
592 592
                     if (true === $resolvedIsTypeOf) {
593 593
                         return $this->executeSubFields($returnType, $fieldNodes, $path, $result);
594 594
                     }
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
         }
878 878
 
879 879
         if (!empty($promises)) {
880
-            return \React\Promise\all($promises)->then(function ($resolvedPromises) use ($possibleTypes) {
880
+            return \React\Promise\all($promises)->then(function($resolvedPromises) use ($possibleTypes) {
881 881
                 foreach ($resolvedPromises as $index => $result) {
882 882
                     if (true === $result) {
883 883
                         return $possibleTypes[$index];
Please login to merge, or discard this patch.
src/Execution/Strategy/ParallelExecutionStrategy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function executeFields(ObjectType $parentType, $rootValue, array $path, array $fields)
23 23
     {
24
-        $results            = [];
24
+        $results = [];
25 25
         $containsPromise = false;
26 26
 
27 27
         foreach ($fields as $fieldName => $fieldNodes) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                 continue;
35 35
             }
36 36
 
37
-            $containsPromise  = $containsPromise || $result instanceof PromiseInterface;
37
+            $containsPromise = $containsPromise || $result instanceof PromiseInterface;
38 38
             $results[$fieldName] = $result;
39 39
         }
40 40
 
Please login to merge, or discard this patch.
src/Error/Handler/ErrorHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function handleError(\Throwable $exception): void
30 30
     {
31
-        $next = function () {
31
+        $next = function() {
32 32
             // NO-OP
33 33
         };
34 34
 
35 35
         foreach ($this->middleware as $middleware) {
36
-            $next = function (\Throwable $exception) use ($middleware, $next) {
36
+            $next = function(\Throwable $exception) use ($middleware, $next) {
37 37
                 return $middleware->handleError($exception, $next);
38 38
             };
39 39
         }
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function handleExecutionError(ExecutionException $exception, ExecutionContext $context): void
48 48
     {
49
-        $next = function () {
49
+        $next = function() {
50 50
             // NO-OP
51 51
         };
52 52
 
53 53
         foreach ($this->middleware as $middleware) {
54
-            $next = function (ExecutionException $exception, ExecutionContext $context) use ($middleware, $next) {
54
+            $next = function(ExecutionException $exception, ExecutionContext $context) use ($middleware, $next) {
55 55
                 return $middleware->handleExecutionError($exception, $context, $next);
56 56
             };
57 57
         }
Please login to merge, or discard this patch.
src/Error/GraphQLException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getLocationsAsArray(): ?array
162 162
     {
163
-        return !empty($this->locations) ? \array_map(function (SourceLocation $location) {
163
+        return !empty($this->locations) ? \array_map(function(SourceLocation $location) {
164 164
             return $location->toArray();
165 165
         }, $this->locations) : null;
166 166
     }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
             $nodes = [$nodes];
246 246
         }
247 247
 
248
-        $this->nodes = \array_filter($nodes, function ($node) {
248
+        $this->nodes = \array_filter($nodes, function($node) {
249 249
             return null !== $node;
250 250
         });
251 251
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     protected function resolvePositions(?array $positions): self
277 277
     {
278 278
         if (null === $positions && !empty($this->nodes)) {
279
-            $positions = \array_reduce($this->nodes, function (array $list, ?NodeInterface $node) {
279
+            $positions = \array_reduce($this->nodes, function(array $list, ?NodeInterface $node) {
280 280
                 if (null !== $node) {
281 281
                     $location = $node->getLocation();
282 282
                     if (null !== $location) {
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
         $locations = null;
307 307
 
308 308
         if (null !== $positions && null !== $source) {
309
-            $locations = \array_map(function ($position) use ($source) {
309
+            $locations = \array_map(function($position) use ($source) {
310 310
                 return SourceLocation::fromSource($source, $position);
311 311
             }, $positions);
312 312
         } elseif (!empty($this->nodes)) {
313
-            $locations = \array_reduce($this->nodes, function (array $list, NodeInterface $node) {
313
+            $locations = \array_reduce($this->nodes, function(array $list, NodeInterface $node) {
314 314
                 $location = $node->getLocation();
315 315
                 if (null !== $location) {
316 316
                     $list[] = SourceLocation::fromSource($location->getSource(), $location->getStart());
Please login to merge, or discard this patch.
src/Schema/DefinitionPrinter.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 
47 47
         return $this->printFilteredSchema(
48 48
             $schema,
49
-            function (Directive $directive): bool {
49
+            function(Directive $directive): bool {
50 50
                 return !isSpecifiedDirective($directive);
51 51
             },
52
-            function (NamedTypeInterface $type): bool {
52
+            function(NamedTypeInterface $type): bool {
53 53
                 return !isSpecifiedScalarType($type) && !isIntrospectionType($type);
54 54
             }
55 55
         );
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 
67 67
         return $this->printFilteredSchema(
68 68
             $schema,
69
-            function (Directive $directive): bool {
69
+            function(Directive $directive): bool {
70 70
                 return isSpecifiedDirective($directive);
71 71
             },
72
-            function (NamedTypeInterface $type): bool {
72
+            function(NamedTypeInterface $type): bool {
73 73
                 return isIntrospectionType($type);
74 74
             }
75 75
         );
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $types = \array_filter(\array_values($schema->getTypeMap()), $filter);
142 142
 
143
-        \usort($types, function (NamedTypeInterface $typeA, NamedTypeInterface $typeB) {
143
+        \usort($types, function(NamedTypeInterface $typeA, NamedTypeInterface $typeB) {
144 144
             return \strcasecmp($typeA->getName(), $typeB->getName());
145 145
         });
146 146
 
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
         $description = $this->printDescription($type);
284 284
         $name        = $type->getName();
285 285
         $implements  = $type->hasInterfaces()
286
-            ? ' implements ' . printArray(' & ', \array_map(function (InterfaceType $interface) {
286
+            ? ' implements ' . printArray(' & ', \array_map(function(InterfaceType $interface) {
287 287
                 return $interface->getName();
288 288
             }, $type->getInterfaces()))
289 289
             : '';
290
-        $fields      = $this->printFields($type->getFields());
290
+        $fields = $this->printFields($type->getFields());
291 291
 
292 292
         return printLines([
293 293
             $description,
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
     protected function printEnumValues(array $values): string
353 353
     {
354
-        return printLines(\array_map(function (EnumValue $value): string {
354
+        return printLines(\array_map(function(EnumValue $value): string {
355 355
             $description = $this->printDescription($value, '  ');
356 356
             $name        = $value->getName();
357 357
             $deprecated  = $this->printDeprecated($value);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     protected function printInputObjectType(InputObjectType $type): string
373 373
     {
374 374
         $description = $this->printDescription($type);
375
-        $fields      = \array_map(function (InputField $field): string {
375
+        $fields      = \array_map(function(InputField $field): string {
376 376
             $description = $this->printDescription($field, '  ');
377 377
             $inputValue  = $this->printInputValue($field);
378 378
             return printLines([
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      */
417 417
     protected function printFields(array $fields): string
418 418
     {
419
-        return printLines(\array_map(function (Field $field): string {
419
+        return printLines(\array_map(function(Field $field): string {
420 420
             $description = $this->printDescription($field, '  ');
421 421
             $name        = $field->getName();
422 422
             $arguments   = $this->printArguments($field->getArguments());
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
         }
442 442
 
443 443
         // If every arg does not have a description, print them on one line.
444
-        if (arrayEvery($arguments, function (Argument $argument): bool {
444
+        if (arrayEvery($arguments, function(Argument $argument): bool {
445 445
             return !$argument->hasDescription();
446 446
         })) {
447
-            return printInputFields(\array_map(function (Argument $argument) {
447
+            return printInputFields(\array_map(function(Argument $argument) {
448 448
                 return $this->printInputValue($argument);
449 449
             }, $arguments));
450 450
         }
451 451
 
452
-        $args = \array_map(function (Argument $argument) use ($indentation) {
452
+        $args = \array_map(function(Argument $argument) use ($indentation) {
453 453
             $description = $this->printDescription($argument, '  ');
454 454
             $inputValue  = $this->printInputValue($argument);
455 455
             return printLines([
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      */
590 590
     protected function printMany(array $definitions): array
591 591
     {
592
-        return \array_map(function ($definition) {
592
+        return \array_map(function($definition) {
593 593
             return $this->print($definition);
594 594
         }, $definitions);
595 595
     }
Please login to merge, or discard this patch.
src/Schema/utils.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 {
12 12
     $rawLines = \explode("\n", $description);
13 13
 
14
-    return \array_merge(...\array_map(function (string $line) use ($maxLength) {
14
+    return \array_merge(...\array_map(function(string $line) use ($maxLength) {
15 15
         if (\strlen($line) < ($maxLength + 5)) {
16 16
             return [$line];
17 17
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         return [$line];
35 35
     }
36 36
 
37
-    $endPos     = $maxLength - 40;
37
+    $endPos = $maxLength - 40;
38 38
     return \array_map('trim', \preg_split(
39 39
         "/((?: |^).{15,{$endPos}}(?= |$))/",
40 40
         $line,
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 function printLines(array $lines): string
74 74
 {
75 75
     // Don't print empty lines
76
-    $lines = \array_filter($lines, function (string $line) {
76
+    $lines = \array_filter($lines, function(string $line) {
77 77
         return $line !== '';
78 78
     });
79 79
 
Please login to merge, or discard this patch.