Passed
Pull Request — master (#351)
by Kirill
02:55
created
src/Validation/Rule/FragmentsOnCompositeTypesRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     protected function enterFragmentDefinition(FragmentDefinitionNode $node): VisitorResult
28 28
     {
29
-        $this->validateFragementNode($node, function (FragmentDefinitionNode $node) {
29
+        $this->validateFragementNode($node, function(FragmentDefinitionNode $node) {
30 30
             return fragmentOnNonCompositeMessage((string)$node, (string)$node->getTypeCondition());
31 31
         });
32 32
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function enterInlineFragment(InlineFragmentNode $node): VisitorResult
40 40
     {
41
-        $this->validateFragementNode($node, function (InlineFragmentNode $node) {
41
+        $this->validateFragementNode($node, function(InlineFragmentNode $node) {
42 42
             return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition());
43 43
         });
44 44
 
Please login to merge, or discard this patch.
src/Validation/Rule/LoneAnonymousOperationRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     protected function enterDocument(DocumentNode $node): VisitorResult
28 28
     {
29
-        $this->operationCount = \count(\array_filter($node->getDefinitions(), function ($definition) {
29
+        $this->operationCount = \count(\array_filter($node->getDefinitions(), function($definition) {
30 30
             return $definition instanceof OperationDefinitionNode;
31 31
         }));
32 32
 
Please login to merge, or discard this patch.
src/Validation/ValidationContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getFragment(string $name): ?FragmentDefinitionNode
169 169
     {
170 170
         if (empty($this->fragments)) {
171
-            $this->fragments = array_reduce($this->document->getDefinitions(), function ($fragments, $definition) {
171
+            $this->fragments = array_reduce($this->document->getDefinitions(), function($fragments, $definition) {
172 172
                 if ($definition instanceof FragmentDefinitionNode) {
173 173
                     $fragments[$definition->getNameValue()] = $definition;
174 174
                 }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $usages   = [];
245 245
             $typeInfo = new TypeInfo($this->schema);
246 246
 
247
-            $enterCallback = function (NodeInterface $node) use (&$usages, $typeInfo): VisitorResult {
247
+            $enterCallback = function(NodeInterface $node) use (&$usages, $typeInfo): VisitorResult {
248 248
                 if ($node instanceof VariableDefinitionNode) {
249 249
                     return new VisitorResult(null);
250 250
                 }
Please login to merge, or discard this patch.
src/Util/utils.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     return $count === 1
38 38
         ? $selected[0]
39
-        : \array_reduce($selected, function ($list, $item) use ($count, &$index) {
39
+        : \array_reduce($selected, function($list, $item) use ($count, &$index) {
40 40
             $list .= ($index > 0 && $index < ($count - 1) ? ', ' : '') . ($index === ($count - 1) ? ' or ' : '') .
41 41
                 $item;
42 42
             $index++;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     $result = \array_keys($optionsByDistance);
72 72
 
73
-    \usort($result, function ($a, $b) use ($optionsByDistance) {
73
+    \usort($result, function($a, $b) use ($optionsByDistance) {
74 74
         return $optionsByDistance[$a] - $optionsByDistance[$b];
75 75
     });
76 76
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function quotedOrList(array $items): string
87 87
 {
88
-    return orList(\array_map(function ($item) {
88
+    return orList(\array_map(function($item) {
89 89
         return '"' . $item . '"';
90 90
     }, $items));
91 91
 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  */
99 99
 function arrayEvery(array $array, callable $fn): bool
100 100
 {
101
-    return \array_reduce($array, function ($result, $value) use ($fn) {
101
+    return \array_reduce($array, function($result, $value) use ($fn) {
102 102
         return $result && $fn($value);
103 103
     }, true);
104 104
 }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
  */
111 111
 function arraySome(array $array, callable $fn)
112 112
 {
113
-    return \array_reduce($array, function ($result, $value) use ($fn) {
113
+    return \array_reduce($array, function($result, $value) use ($fn) {
114 114
         return $result || $fn($value);
115 115
     });
116 116
 }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
  */
139 139
 function keyMap(array $array, callable $keyFn): array
140 140
 {
141
-    return \array_reduce($array, function ($map, $item) use ($keyFn) {
141
+    return \array_reduce($array, function($map, $item) use ($keyFn) {
142 142
         $map[$keyFn($item)] = $item;
143 143
         return $map;
144 144
     }, []);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function keyValueMap(array $array, callable $keyFn, callable $valFn): array
154 154
 {
155
-    return \array_reduce($array, function ($map, $item) use ($keyFn, $valFn) {
155
+    return \array_reduce($array, function($map, $item) use ($keyFn, $valFn) {
156 156
         $map[$keyFn($item)] = $valFn($item);
157 157
         return $map;
158 158
     }, []);
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 function promiseForMap(array $map): PromiseInterface
166 166
 {
167 167
     $keys             = \array_keys($map);
168
-    $promisesOrValues = \array_map(function ($name) use ($map) {
168
+    $promisesOrValues = \array_map(function($name) use ($map) {
169 169
         return $map[$name];
170 170
     }, $keys);
171 171
 
172
-    return \React\Promise\all($promisesOrValues)->then(function ($values) use ($keys) {
172
+    return \React\Promise\all($promisesOrValues)->then(function($values) use ($keys) {
173 173
         $i = 0;
174
-        return \array_reduce($values, function ($resolvedObject, $value) use ($keys, &$i) {
174
+        return \array_reduce($values, function($resolvedObject, $value) use ($keys, &$i) {
175 175
             $resolvedObject[$keys[$i++]] = $value;
176 176
             return $resolvedObject;
177 177
         }, []);
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
  */
187 187
 function promiseReduce(array $values, callable $fn, $initial = null)
188 188
 {
189
-    return \array_reduce($values, function ($previous, $value) use ($fn) {
189
+    return \array_reduce($values, function($previous, $value) use ($fn) {
190 190
         return $previous instanceof PromiseInterface
191
-            ? $previous->then(function ($resolvedValue) use ($fn, $value) {
191
+            ? $previous->then(function($resolvedValue) use ($fn, $value) {
192 192
                 return $fn($resolvedValue, $value);
193 193
             })
194 194
             : $fn($previous, $value);
Please login to merge, or discard this patch.
src/Execution/Strategy/SerialExecutionStrategy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         return promiseReduce(
25 25
             \array_keys($fields),
26
-            function ($results, $fieldName) use ($parentType, $rootValue, $path, $fields) {
26
+            function($results, $fieldName) use ($parentType, $rootValue, $path, $fields) {
27 27
                 $fieldNodes  = $fields[$fieldName];
28 28
                 $fieldPath   = $path;
29 29
                 $fieldPath[] = $fieldName;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                 }
36 36
 
37 37
                 if ($result instanceof PromiseInterface) {
38
-                    return $result->then(function ($resolvedResult) use ($fieldName, $results) {
38
+                    return $result->then(function($resolvedResult) use ($fieldName, $results) {
39 39
                         $results[$fieldName] = $resolvedResult;
40 40
                         return $results;
41 41
                     });
Please login to merge, or discard this patch.
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.