Passed
Pull Request — master (#169)
by Quang
02:16
created
src/Util/ValueHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
168 168
         $resolvedValues = [];
169 169
 
170 170
         /** @var ObjectFieldNode[] $fieldNodes */
171
-        $fieldNodes = keyMap($node->getFields(), function (ObjectFieldNode $value) {
171
+        $fieldNodes = keyMap($node->getFields(), function(ObjectFieldNode $value) {
172 172
             return $value->getNameValue();
173 173
         });
174 174
 
Please login to merge, or discard this patch.
src/Util/utils.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     return $count === 1
34 34
         ? $selected[0]
35
-        : \array_reduce($selected, function ($list, $item) use ($count, &$index) {
35
+        : \array_reduce($selected, function($list, $item) use ($count, &$index) {
36 36
             $list .= ($index > 0 && $index < ($count - 1) ? ', ' : '') . ($index === ($count - 1) ? ' or ' : '') .
37 37
                 $item;
38 38
             $index++;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     $result = \array_keys($optionsByDistance);
68 68
 
69
-    \usort($result, function ($a, $b) use ($optionsByDistance) {
69
+    \usort($result, function($a, $b) use ($optionsByDistance) {
70 70
         return $optionsByDistance[$a] - $optionsByDistance[$b];
71 71
     });
72 72
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function quotedOrList(array $items): string
83 83
 {
84
-    return orList(array_map(function ($item) {
84
+    return orList(array_map(function($item) {
85 85
         return '"' . $item . '"';
86 86
     }, $items));
87 87
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
  */
96 96
 function arrayEvery(array $array, callable $fn): bool
97 97
 {
98
-    return array_reduce($array, function ($result, $value) use ($fn) {
98
+    return array_reduce($array, function($result, $value) use ($fn) {
99 99
         return $result && $fn($value);
100 100
     }, true);
101 101
 }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function arraySome(array $array, callable $fn)
109 109
 {
110
-    return array_reduce($array, function ($result, $value) use ($fn) {
110
+    return array_reduce($array, function($result, $value) use ($fn) {
111 111
         return $result || $fn($value);
112 112
     });
113 113
 }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function keyMap(array $array, callable $keyFn): array
137 137
 {
138
-    return array_reduce($array, function ($map, $item) use ($keyFn) {
138
+    return array_reduce($array, function($map, $item) use ($keyFn) {
139 139
         $map[$keyFn($item)] = $item;
140 140
         return $map;
141 141
     }, []);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function keyValueMap(array $array, callable $keyFn, callable $valFn): array
151 151
 {
152
-    return array_reduce($array, function ($map, $item) use ($keyFn, $valFn) {
152
+    return array_reduce($array, function($map, $item) use ($keyFn, $valFn) {
153 153
         $map[$keyFn($item)] = $valFn($item);
154 154
         return $map;
155 155
     }, []);
Please login to merge, or discard this patch.
src/Util/TypeHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
                 // If both types are abstract, then determine if there is any intersection
93 93
                 // between possible concrete types of each.
94 94
                 return arraySome($schema->getPossibleTypes($typeA),
95
-                    function (TypeInterface $type) use ($schema, $typeB) {
95
+                    function(TypeInterface $type) use ($schema, $typeB) {
96 96
                         return $schema->isPossibleType($typeB, $type);
97 97
                     });
98 98
             }
Please login to merge, or discard this patch.
src/Schema/Building/BuilderContext.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function buildTypes(): array
121 121
     {
122
-        return \array_map(function (TypeDefinitionNodeInterface $definition) {
122
+        return \array_map(function(TypeDefinitionNodeInterface $definition) {
123 123
             return $this->definitionBuilder->buildType($definition);
124 124
         }, \array_values($this->typeDefinitionMap));
125 125
     }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function buildDirectives(): array
131 131
     {
132
-        $directives = \array_map(function (DirectiveDefinitionNode $definition) {
132
+        $directives = \array_map(function(DirectiveDefinitionNode $definition) {
133 133
             return $this->definitionBuilder->buildDirective($definition);
134 134
         }, $this->directiveDefinitions);
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         ];
141 141
 
142 142
         foreach ($specifiedDirectivesMap as $name => $directive) {
143
-            if (!arraySome($directives, function (Directive $directive) use ($name) {
143
+            if (!arraySome($directives, function(Directive $directive) use ($name) {
144 144
                 return $directive->getName() === $name;
145 145
             })) {
146 146
                 $directives[] = $directive;
Please login to merge, or discard this patch.
src/Schema/Schema.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function getDirective(string $name): ?Directive
128 128
     {
129
-        return find($this->directives, function (Directive $directive) use ($name) {
129
+        return find($this->directives, function(Directive $directive) use ($name) {
130 130
             return $directive->getName() === $name;
131 131
         });
132 132
     }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             );
180 180
 
181 181
             $this->possibleTypesMap[$abstractTypeName] = \array_reduce($possibleTypes,
182
-                function (array $map, TypeInterface $type) {
182
+                function(array $map, TypeInterface $type) {
183 183
                     /** @var NameAwareInterface $type */
184 184
                     $map[$type->getName()] = true;
185 185
                     return $map;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         if ($type instanceof ObjectType || $type instanceof InterfaceType) {
385 385
             foreach ($type->getFields() as $field) {
386 386
                 if ($field->hasArguments()) {
387
-                    $fieldArgTypes = \array_map(function (Argument $argument) {
387
+                    $fieldArgTypes = \array_map(function(Argument $argument) {
388 388
                         return $argument->getType();
389 389
                     }, $field->getArguments());
390 390
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
             return $map;
419 419
         }
420 420
 
421
-        return \array_reduce($directive->getArguments(), function ($map, Argument $argument) {
421
+        return \array_reduce($directive->getArguments(), function($map, Argument $argument) {
422 422
             return $this->typeMapReducer($map, $argument->getType());
423 423
         }, $map);
424 424
     }
Please login to merge, or discard this patch.
src/Schema/Validation/SchemaValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         $errors = $this->validate($schema);
51 51
 
52 52
         if (!empty($errors)) {
53
-            $message = \implode("\n", \array_map(function (SchemaValidationException $error) {
53
+            $message = \implode("\n", \array_map(function(SchemaValidationException $error) {
54 54
                 return $error->getMessage();
55 55
             }, $errors));
56 56
 
Please login to merge, or discard this patch.
src/Schema/Validation/Rule/TypesRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             // Assert each interface field arg is implemented.
317 317
             foreach ($interfaceField->getArguments() as $interfaceArgument) {
318 318
                 $argumentName   = $interfaceArgument->getName();
319
-                $objectArgument = find($objectField->getArguments(), function (Argument $argument) use ($argumentName) {
319
+                $objectArgument = find($objectField->getArguments(), function(Argument $argument) use ($argumentName) {
320 320
                     return $argument->getName() === $argumentName;
321 321
                 });
322 322
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                     $argumentName      = $objectArgument->getName();
376 376
                     $interfaceArgument = find(
377 377
                         $interfaceField->getArguments(),
378
-                        function (Argument $argument) use ($argumentName) {
378
+                        function(Argument $argument) use ($argumentName) {
379 379
                             return $argument->getName() === $argumentName;
380 380
                         }
381 381
                     );
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
             return null;
715 715
         }
716 716
 
717
-        return \array_filter($node->getTypes(), function (NamedTypeNode $type) use ($memberTypeName) {
717
+        return \array_filter($node->getTypes(), function(NamedTypeNode $type) use ($memberTypeName) {
718 718
             return $type->getNameValue() === $memberTypeName;
719 719
         });
720 720
     }
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
             return null;
734 734
         }
735 735
 
736
-        return \array_filter($node->getValues(), function (NameAwareInterface $type) use ($valueName) {
736
+        return \array_filter($node->getValues(), function(NameAwareInterface $type) use ($valueName) {
737 737
             return $type->getNameValue() === $valueName;
738 738
         });
739 739
     }
Please login to merge, or discard this patch.
src/Schema/Validation/Rule/RootTypesRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
         /** @var OperationTypeDefinitionNode $operationTypeNode */
90 90
         $operationTypeNode = find(
91 91
             $node->getOperationTypes(),
92
-            function (OperationTypeDefinitionNode $operationType) use ($operation) {
92
+            function(OperationTypeDefinitionNode $operationType) use ($operation) {
93 93
                 return $operationType->getOperation() === $operation;
94 94
             }
95 95
         );
Please login to merge, or discard this patch.
src/Schema/Extension/ExtensionContext.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getExtendedTypes(): array
169 169
     {
170 170
         return \array_merge(
171
-            \array_map(function ($type) {
171
+            \array_map(function($type) {
172 172
                 return $this->getExtendedType($type);
173 173
             }, \array_values($this->schema->getTypeMap())),
174 174
             $this->definitionBuilder->buildTypes(\array_values($this->typeDefinitionMap))
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         return \array_merge(
189 189
             $existingDirectives,
190
-            \array_map(function (DirectiveDefinitionNode $node) {
190
+            \array_map(function(DirectiveDefinitionNode $node) {
191 191
                 return $this->definitionBuilder->buildDirective($node);
192 192
             }, $this->directiveDefinitions)
193 193
         );
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
         return newGraphQLObjectType([
404 404
             'name'              => $typeName,
405 405
             'description'       => $type->getDescription(),
406
-            'interfaces'        => function () use ($type) {
406
+            'interfaces'        => function() use ($type) {
407 407
                 return $this->extendImplementedInterfaces($type);
408 408
             },
409
-            'fields'            => function () use ($type) {
409
+            'fields'            => function() use ($type) {
410 410
                 return $this->extendFieldMap($type);
411 411
             },
412 412
             'astNode'           => $type->getAstNode(),
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         return newGraphQLInterfaceType([
434 434
             'name'              => $typeName,
435 435
             'description'       => $type->getDescription(),
436
-            'fields'            => function () use ($type) {
436
+            'fields'            => function() use ($type) {
437 437
                 return $this->extendFieldMap($type);
438 438
             },
439 439
             'astNode'           => $type->getAstNode(),
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
         return newGraphQLUnionType([
453 453
             'name'        => $type->getName(),
454 454
             'description' => $type->getDescription(),
455
-            'types'       => \array_map(function ($unionType) {
455
+            'types'       => \array_map(function($unionType) {
456 456
                 return $this->getExtendedType($unionType);
457 457
             }, $type->getTypes()),
458 458
             'astNode'     => $type->getAstNode(),
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
      */
468 468
     protected function extendImplementedInterfaces(ObjectType $type): array
469 469
     {
470
-        $interfaces = \array_map(function (InterfaceType $interface) {
470
+        $interfaces = \array_map(function(InterfaceType $interface) {
471 471
             return $this->getExtendedType($interface);
472 472
         }, $type->getInterfaces());
473 473
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                 'description'       => $field->getDescription(),
510 510
                 'deprecationReason' => $field->getDeprecationReason(),
511 511
                 'type'              => $this->extendFieldType($field->getType()),
512
-                'args'              => keyMap($field->getArguments(), function (Argument $argument) {
512
+                'args'              => keyMap($field->getArguments(), function(Argument $argument) {
513 513
                     return $argument->getName();
514 514
                 }),
515 515
                 'astNode'           => $field->getAstNode(),
Please login to merge, or discard this patch.