Passed
Pull Request — master (#262)
by Chris
02:31
created
src/Util/ValueASTConverter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
         $values = [];
180 180
 
181 181
         /** @var ObjectFieldNode[] $fieldNodes */
182
-        $fieldNodes = keyMap($node->getFields(), function (ObjectFieldNode $value) {
182
+        $fieldNodes = keyMap($node->getFields(), function(ObjectFieldNode $value) {
183 183
             return $value->getNameValue();
184 184
         });
185 185
 
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 (TypeInterface $type): bool {
52
+            function(TypeInterface $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 (TypeInterface $type): bool {
72
+            function(TypeInterface $type): bool {
73 73
                 return isIntrospectionType($type);
74 74
             }
75 75
         );
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $types = \array_filter(\array_values($schema->getTypeMap()), $filter);
137 137
 
138
-        \usort($types, function (NamedTypeInterface $typeA, NamedTypeInterface $typeB) {
138
+        \usort($types, function(NamedTypeInterface $typeA, NamedTypeInterface $typeB) {
139 139
             return \strcasecmp($typeA->getName(), $typeB->getName());
140 140
         });
141 141
 
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
         $description = $this->printDescription($type);
262 262
         $name        = $type->getName();
263 263
         $implements  = $type->hasInterfaces()
264
-            ? ' implements ' . printArray(' & ', \array_map(function (InterfaceType $interface) {
264
+            ? ' implements ' . printArray(' & ', \array_map(function(InterfaceType $interface) {
265 265
                 return $interface->getName();
266 266
             }, $type->getInterfaces()))
267 267
             : '';
268
-        $fields      = $this->printFields($type->getFields());
268
+        $fields = $this->printFields($type->getFields());
269 269
 
270 270
         return printLines([
271 271
             $description,
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
     protected function printEnumValues(array $values): string
331 331
     {
332
-        return printLines(\array_map(function (EnumValue $value, int $i): string {
332
+        return printLines(\array_map(function(EnumValue $value, int $i): string {
333 333
             $description = $this->printDescription($value, '  ', 0 === $i);
334 334
             $name        = $value->getName();
335 335
             $deprecated  = $this->printDeprecated($value);
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     protected function printInputObjectType(InputObjectType $type): string
349 349
     {
350 350
         $description = $this->printDescription($type);
351
-        $fields      = \array_map(function (InputField $field, int $i): string {
351
+        $fields      = \array_map(function(InputField $field, int $i): string {
352 352
             $description = $this->printDescription($field, '  ', 0 === $i);
353 353
             $inputValue  = $this->printInputValue($field);
354 354
             return printLines([
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
      */
387 387
     protected function printFields(array $fields): string
388 388
     {
389
-        return printLines(\array_map(function (Field $field): string {
389
+        return printLines(\array_map(function(Field $field): string {
390 390
             $description = $this->printDescription($field);
391 391
             $name        = $field->getName();
392 392
             $arguments   = $this->printArguments($field->getArguments());
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
         }
407 407
 
408 408
         // If every arg does not have a description, print them on one line.
409
-        if (arrayEvery($arguments, function (Argument $argument): bool {
409
+        if (arrayEvery($arguments, function(Argument $argument): bool {
410 410
             return !$argument->hasDescription();
411 411
         })) {
412
-            return printInputFields(\array_map(function (Argument $argument) {
412
+            return printInputFields(\array_map(function(Argument $argument) {
413 413
                 return $this->printInputValue($argument);
414 414
             }, $arguments));
415 415
         }
416 416
 
417
-        $args = \array_map(function (Argument $argument) use ($indentation) {
417
+        $args = \array_map(function(Argument $argument) use ($indentation) {
418 418
             $description = $this->printDescription($argument);
419 419
             $inputValue  = $this->printInputValue($argument);
420 420
             return printLines([
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
      */
535 535
     protected function printMany(array $definitions): array
536 536
     {
537
-        return \array_map(function ($definition) {
537
+        return \array_map(function($definition) {
538 538
             return $this->print($definition);
539 539
         }, $definitions);
540 540
     }
Please login to merge, or discard this patch.
src/Schema/DefinitionBuilder.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function buildTypes(array $nodes): array
111 111
     {
112
-        return \array_map(function (NodeInterface $node) {
112
+        return \array_map(function(NodeInterface $node) {
113 113
             return $this->buildType($node);
114 114
         }, $nodes);
115 115
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $directive = newDirective([
154 154
             'name'        => $node->getNameValue(),
155 155
             'description' => $node->getDescriptionValue(),
156
-            'locations'   => \array_map(function (NameNode $node) {
156
+            'locations'   => \array_map(function(NameNode $node) {
157 157
                 return $node->getValue();
158 158
             }, $node->getLocations()),
159 159
             'args'        => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [],
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $typesMap = keyMap(
223 223
             \array_merge($customTypes, specifiedScalarTypes(), introspectionTypes()),
224
-            function (NamedTypeInterface $type) {
224
+            function(NamedTypeInterface $type) {
225 225
                 return $type->getName();
226 226
             }
227 227
         );
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     {
240 240
         $directivesMap = keyMap(
241 241
             \array_merge($customDirectives, specifiedDirectives()),
242
-            function (Directive $directive) {
242
+            function(Directive $directive) {
243 243
                 return $directive->getName();
244 244
             }
245 245
         );
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
     {
259 259
         return keyValueMap(
260 260
             $nodes,
261
-            function (InputValueDefinitionNode $value) {
261
+            function(InputValueDefinitionNode $value) {
262 262
                 return $value->getNameValue();
263 263
             },
264
-            function (InputValueDefinitionNode $value): array {
264
+            function(InputValueDefinitionNode $value): array {
265 265
                 $type         = $this->buildWrappedType($value->getType());
266 266
                 $defaultValue = $value->getDefaultValue();
267 267
                 return [
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
         return newObjectType([
314 314
             'name'        => $node->getNameValue(),
315 315
             'description' => $node->getDescriptionValue(),
316
-            'fields'      => $node->hasFields() ? function () use ($node) {
316
+            'fields'      => $node->hasFields() ? function() use ($node) {
317 317
                 return $this->buildFields($node);
318 318
             } : [],
319 319
             // Note: While this could make early assertions to get the correctly
320 320
             // typed values, that would throw immediately while type system
321 321
             // validation with validateSchema() will produce more actionable results.
322
-            'interfaces'  => function () use ($node) {
323
-                return $node->hasInterfaces() ? \array_map(function (NodeInterface $interface) {
322
+            'interfaces'  => function() use ($node) {
323
+                return $node->hasInterfaces() ? \array_map(function(NodeInterface $interface) {
324 324
                     return $this->buildType($interface);
325 325
                 }, $node->getInterfaces()) : [];
326 326
             },
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
     {
337 337
         return keyValueMap(
338 338
             $node->getFields(),
339
-            function ($value) {
339
+            function($value) {
340 340
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
341 341
                 return $value->getNameValue();
342 342
             },
343
-            function ($value) use ($node) {
343
+            function($value) use ($node) {
344 344
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
345 345
                 return $this->buildField($value,
346 346
                     $this->getFieldResolver($node->getNameValue(), $value->getNameValue()));
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         return newInterfaceType([
370 370
             'name'        => $node->getNameValue(),
371 371
             'description' => $node->getDescriptionValue(),
372
-            'fields'      => $node->hasFields() ? function () use ($node): array {
372
+            'fields'      => $node->hasFields() ? function() use ($node) : array {
373 373
                 return $this->buildFields($node);
374 374
             } : [],
375 375
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
             'description' => $node->getDescriptionValue(),
389 389
             'values'      => $node->hasValues() ? keyValueMap(
390 390
                 $node->getValues(),
391
-                function (EnumValueDefinitionNode $value): string {
391
+                function(EnumValueDefinitionNode $value): string {
392 392
                     return $value->getNameValue();
393 393
                 },
394
-                function (EnumValueDefinitionNode $value): array {
394
+                function(EnumValueDefinitionNode $value): array {
395 395
                     return [
396 396
                         'description'       => $value->getDescriptionValue(),
397 397
                         'deprecationReason' => $this->getDeprecationReason($value),
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         return newUnionType([
413 413
             'name'        => $node->getNameValue(),
414 414
             'description' => $node->getDescriptionValue(),
415
-            'types'       => $node->hasTypes() ? \array_map(function (TypeNodeInterface $type) {
415
+            'types'       => $node->hasTypes() ? \array_map(function(TypeNodeInterface $type) {
416 416
                 return $this->buildType($type);
417 417
             }, $node->getTypes()) : [],
418 418
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         return newScalarType([
441 441
             'name'        => $node->getNameValue(),
442 442
             'description' => $node->getDescriptionValue(),
443
-            'serialize'   => function ($value) {
443
+            'serialize'   => function($value) {
444 444
                 return $value;
445 445
             },
446 446
             'astNode'     => $node,
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
         return newInputObjectType([
457 457
             'name'        => $node->getNameValue(),
458 458
             'description' => $node->getDescriptionValue(),
459
-            'fields'      => $node->hasFields() ? function () use ($node) {
459
+            'fields'      => $node->hasFields() ? function() use ($node) {
460 460
                 return keyValueMap(
461 461
                     $node->getFields(),
462
-                    function (InputValueDefinitionNode $value): string {
462
+                    function(InputValueDefinitionNode $value): string {
463 463
                         return $value->getNameValue();
464 464
                     },
465
-                    function (InputValueDefinitionNode $value): array {
465
+                    function(InputValueDefinitionNode $value): array {
466 466
                         $type         = $this->buildWrappedType($value->getType());
467 467
                         $defaultValue = $value->getDefaultValue();
468 468
                         return [
Please login to merge, or discard this patch.
src/Execution/Executor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         $promise = new FulfilledPromise([]);
172 172
 
173
-        $resolve = function ($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) {
173
+        $resolve = function($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) {
174 174
             $fieldPath   = $path;
175 175
             $fieldPath[] = $fieldName;
176 176
             try {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
             if ($this->isPromise($result)) {
183 183
                 /** @var ExtendedPromiseInterface $result */
184
-                return $result->then(function ($resolvedResult) use ($fieldName, $results) {
184
+                return $result->then(function($resolvedResult) use ($fieldName, $results) {
185 185
                     $results[$fieldName] = $resolvedResult;
186 186
                     return $results;
187 187
                 });
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         };
194 194
 
195 195
         foreach ($fields as $fieldName => $fieldNodes) {
196
-            $promise = $promise->then(function ($resolvedResults) use (
196
+            $promise = $promise->then(function($resolvedResults) use (
197 197
                 $resolve,
198 198
                 $fieldName,
199 199
                 $path,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             });
206 206
         }
207 207
 
208
-        $promise->then(function ($resolvedResults) use (&$finalResults) {
208
+        $promise->then(function($resolvedResults) use (&$finalResults) {
209 209
             $finalResults = $resolvedResults ?? [];
210 210
         });
211 211
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             if ($this->isPromise($completed)) {
283 283
                 $context = $this->context;
284 284
                 /** @var ExtendedPromiseInterface $completed */
285
-                return $completed->then(null, function ($error) use ($context, $fieldNodes, $path) {
285
+                return $completed->then(null, function($error) use ($context, $fieldNodes, $path) {
286 286
                     //@TODO Handle $error better
287 287
                     if ($error instanceof \Exception) {
288 288
                         $context->addError($this->buildLocatedError($error, $fieldNodes, $path));
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         if ($doesContainPromise) {
376 376
             $keys    = \array_keys($finalResults);
377 377
             $promise = promiseAll(\array_values($finalResults));
378
-            $promise->then(function ($values) use ($keys, &$finalResults) {
378
+            $promise->then(function($values) use ($keys, &$finalResults) {
379 379
                 /** @noinspection ForeachSourceInspection */
380 380
                 foreach ($values as $i => $value) {
381 381
                     $finalResults[$keys[$i]] = $value;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     ) {
474 474
         if ($this->isPromise($result)) {
475 475
             /** @var ExtendedPromiseInterface $result */
476
-            return $result->then(function (&$value) use ($returnType, $fieldNodes, $info, $path) {
476
+            return $result->then(function(&$value) use ($returnType, $fieldNodes, $info, $path) {
477 477
                 return $this->completeValue($returnType, $fieldNodes, $info, $path, $value);
478 478
             });
479 479
         }
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 
562 562
         if ($this->isPromise($runtimeType)) {
563 563
             /** @var ExtendedPromiseInterface $runtimeType */
564
-            return $runtimeType->then(function ($resolvedRuntimeType) use (
564
+            return $runtimeType->then(function($resolvedRuntimeType) use (
565 565
                 $returnType,
566 566
                 $fieldNodes,
567 567
                 $info,
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 
691 691
         if (!empty($promisedIsTypeOfResults)) {
692 692
             return promiseAll($promisedIsTypeOfResults)
693
-                ->then(function ($isTypeOfResults) use ($possibleTypes) {
693
+                ->then(function($isTypeOfResults) use ($possibleTypes) {
694 694
                     /** @noinspection ForeachSourceInspection */
695 695
                     foreach ($isTypeOfResults as $index => $result) {
696 696
                         if ($result) {
Please login to merge, or discard this patch.
src/Validation/Conflict/ConflictFinder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -691,13 +691,13 @@
 block discarded – undo
691 691
 
692 692
         return new Conflict(
693 693
             $responseName,
694
-            array_map(function (Conflict $conflict) {
694
+            array_map(function(Conflict $conflict) {
695 695
                 return [$conflict->getResponseName(), $conflict->getReason()];
696 696
             }, $conflicts),
697
-            array_reduce($conflicts, function ($allFields, Conflict $conflict) {
697
+            array_reduce($conflicts, function($allFields, Conflict $conflict) {
698 698
                 return array_merge($allFields, $conflict->getFieldsA());
699 699
             }, [$nodeA]),
700
-            array_reduce($conflicts, function ($allFields, Conflict $conflict) {
700
+            array_reduce($conflicts, function($allFields, Conflict $conflict) {
701 701
                 return array_merge($allFields, $conflict->getFieldsB());
702 702
             }, [$nodeB])
703 703
         );
Please login to merge, or discard this patch.
src/Type/introspection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
 {
125 125
     return arraySome(
126 126
         introspectionTypes(),
127
-        function (NamedTypeInterface $introspectionType) use ($type) {
127
+        function(NamedTypeInterface $introspectionType) use ($type) {
128 128
             /** @noinspection PhpUndefinedMethodInspection */
129 129
             return $type->getName() === $introspectionType->getName();
130 130
         }
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
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function getDirective(string $name): ?Directive
159 159
     {
160
-        return find($this->directives, function (Directive $directive) use ($name) {
160
+        return find($this->directives, function(Directive $directive) use ($name) {
161 161
             return $directive->getName() === $name;
162 162
         });
163 163
     }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
             $this->possibleTypesMap[$abstractTypeName] = \array_reduce(
214 214
                 $possibleTypes,
215
-                function (array $map, NamedTypeInterface $type) {
215
+                function(array $map, NamedTypeInterface $type) {
216 216
                     $map[$type->getName()] = true;
217 217
                     return $map;
218 218
                 },
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
             if ($type instanceof ObjectType || $type instanceof InterfaceType) {
351 351
                 foreach ($type->getFields() as $field) {
352 352
                     if ($field->hasArguments()) {
353
-                        $fieldArgTypes = \array_map(function (Argument $argument) {
353
+                        $fieldArgTypes = \array_map(function(Argument $argument) {
354 354
                             return $argument->getType();
355 355
                         }, $field->getArguments());
356 356
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             return $map;
385 385
         }
386 386
 
387
-        return \array_reduce($directive->getArguments(), function ($map, Argument $argument) {
387
+        return \array_reduce($directive->getArguments(), function($map, Argument $argument) {
388 388
             return $this->typeMapReducer($map, $argument->getType());
389 389
         }, $map);
390 390
     }
Please login to merge, or discard this patch.
src/Language/Node/VariableDefinitionsTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      */
23 23
     public function getVariableDefinitionsAST(): array
24 24
     {
25
-        return \array_map(function (VariableDefinitionNode $node) {
25
+        return \array_map(function(VariableDefinitionNode $node) {
26 26
             return $node->toAST();
27 27
         }, $this->variableDefinitions);
28 28
     }
Please login to merge, or discard this patch.
src/Language/Node/DocumentNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     public function getDefinitionsAST(): array
39 39
     {
40
-        return \array_map(function (NodeInterface $node) {
40
+        return \array_map(function(NodeInterface $node) {
41 41
             return $node->toAST();
42 42
         }, $this->definitions);
43 43
     }
Please login to merge, or discard this patch.