Passed
Pull Request — master (#190)
by Sebastian
02:38
created
src/Validation/Rule/KnownArgumentNamesRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $parentType = $this->context->getParentType();
55 55
 
56 56
         if (null !== $fieldDefinition && null !== $parentType) {
57
-            $options = array_map(function (Argument $argument) {
57
+            $options = array_map(function(Argument $argument) {
58 58
                 return $argument->getName();
59 59
             }, $fieldDefinition->getArguments());
60 60
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $directive = $this->context->getDirective();
84 84
 
85 85
         if (null !== $directive) {
86
-            $options = array_map(function (Argument $argument) {
86
+            $options = array_map(function(Argument $argument) {
87 87
                 return $argument->getName();
88 88
             }, $directive->getArguments());
89 89
 
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
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             ? (!empty($nodes) ? $nodes : [])
114 114
             : (null !== $nodes ? [$nodes] : []);
115 115
 
116
-        $this->nodes = \array_filter($nodes, function ($node) {
116
+        $this->nodes = \array_filter($nodes, function($node) {
117 117
             return null !== $node;
118 118
         });
119 119
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         if (null === $positions && !empty($this->nodes)) {
149 149
             $positions = array_reduce($this->nodes,
150
-                function (array $list, ?NodeInterface $node) {
150
+                function(array $list, ?NodeInterface $node) {
151 151
                     if (null !== $node) {
152 152
                         $location = $node->getLocation();
153 153
                         if (null !== $location) {
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
     protected function resolveLocations(?array $positions, ?Source $source)
178 178
     {
179 179
         if (null !== $positions && null !== $source) {
180
-            $locations = array_map(function ($position) use ($source) {
180
+            $locations = array_map(function($position) use ($source) {
181 181
                 return SourceLocation::fromSource($source, $position);
182 182
             }, $positions);
183 183
         } elseif (!empty($this->nodes)) {
184 184
             $locations = array_reduce($this->nodes,
185
-                function (array $list, NodeInterface $node) {
185
+                function(array $list, NodeInterface $node) {
186 186
                     $location = $node->getLocation();
187 187
                     if (null !== $location) {
188 188
                         $list[] = SourceLocation::fromSource($location->getSource(),
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     public function getLocationsAsArray(): ?array
291 291
     {
292
-        return !empty($this->locations) ? array_map(function (
292
+        return !empty($this->locations) ? array_map(function(
293 293
             SourceLocation $location
294 294
         ) {
295 295
             return $location->toArray();
Please login to merge, or discard this patch.
src/Error/helpers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     return empty($printedLocations)
59 59
         ? $error->getMessage()
60 60
         : \implode("\n\n",
61
-            \array_merge([$error->getMessage()], $printedLocations))."\n";
61
+            \array_merge([$error->getMessage()], $printedLocations)) . "\n";
62 62
 }
63 63
 
64 64
 /**
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
     $nextLineNum = (string)($contextLine + 1);
83 83
     $padLen = \mb_strlen($nextLineNum);
84 84
     $lines = \preg_split("/\r\n|[\n\r]/", $source->getBody());
85
-    $lines[0] = whitespace($locationOffset->getColumn() - 1).$lines[0];
85
+    $lines[0] = whitespace($locationOffset->getColumn() - 1) . $lines[0];
86 86
     $outputLines = [
87 87
         \sprintf('%s (%s:%s)', $source->getName(), $contextLine,
88 88
             $contextColumn),
89 89
         $line >= 2 ? leftPad($padLen,
90
-                $prevLineNum).': '.$lines[$line - 2] : null,
91
-        leftPad($padLen, $lineNum).': '.$lines[$line - 1],
92
-        whitespace(2 + $padLen + $contextColumn - 1).'^',
90
+                $prevLineNum) . ': ' . $lines[$line - 2] : null,
91
+        leftPad($padLen, $lineNum) . ': ' . $lines[$line - 1],
92
+        whitespace(2 + $padLen + $contextColumn - 1) . '^',
93 93
         $line < \count($lines) ? leftPad($padLen,
94
-                $nextLineNum).': '.$lines[$line] : null,
94
+                $nextLineNum) . ': ' . $lines[$line] : null,
95 95
     ];
96 96
 
97
-    return \implode("\n", \array_filter($outputLines, function ($line) {
97
+    return \implode("\n", \array_filter($outputLines, function($line) {
98 98
         return null !== $line;
99 99
     }));
100 100
 }
@@ -129,5 +129,5 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function leftPad(int $length, string $str): string
131 131
 {
132
-    return whitespace($length - \mb_strlen($str)).$str;
132
+    return whitespace($length - \mb_strlen($str)) . $str;
133 133
 }
Please login to merge, or discard this patch.
src/Schema/Building/BuildingContext.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function buildTypes(): array
83 83
     {
84
-        return \array_map(function (TypeDefinitionNodeInterface $definition) {
84
+        return \array_map(function(TypeDefinitionNodeInterface $definition) {
85 85
             return $this->definitionBuilder->buildType($definition);
86 86
         }, \array_values($this->info->getTypeDefinitionMap()));
87 87
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function buildDirectives(): array
93 93
     {
94
-        $directives = \array_map(function (DirectiveDefinitionNode $definition
94
+        $directives = \array_map(function(DirectiveDefinitionNode $definition
95 95
         ) {
96 96
             return $this->definitionBuilder->buildDirective($definition);
97 97
         }, $this->info->getDirectiveDefinitions());
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
         foreach ($specifiedDirectivesMap as $name => $directive) {
106 106
             if (!arraySome($directives,
107
-                function (Directive $directive) use ($name) {
107
+                function(Directive $directive) use ($name) {
108 108
                     return $directive->getName() === $name;
109 109
                 })) {
110 110
                 $directives[] = $directive;
Please login to merge, or discard this patch.
src/Schema/DefinitionBuilder.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $builtInTypes = keyMap(
104 104
             \array_merge(specifiedScalarTypes(), introspectionTypes()),
105
-            function (NamedTypeInterface $type) {
105
+            function(NamedTypeInterface $type) {
106 106
                 return $type->getName();
107 107
             }
108 108
         );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function buildTypes(array $nodes): array
119 119
     {
120
-        return \array_map(function (NodeInterface $node) {
120
+        return \array_map(function(NodeInterface $node) {
121 121
             return $this->buildType($node);
122 122
         }, $nodes);
123 123
     }
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
         return newObjectType([
199 199
             'name' => $node->getNameValue(),
200 200
             'description' => $node->getDescriptionValue(),
201
-            'fields' => $node->hasFields() ? function () use ($node) {
201
+            'fields' => $node->hasFields() ? function() use ($node) {
202 202
                 return $this->buildFields($node);
203 203
             } : [],
204 204
             // Note: While this could make early assertions to get the correctly
205 205
             // typed values, that would throw immediately while type system
206 206
             // validation with validateSchema() will produce more actionable results.
207
-            'interfaces' => function () use ($node) {
208
-                return $node->hasInterfaces() ? \array_map(function (
207
+            'interfaces' => function() use ($node) {
208
+                return $node->hasInterfaces() ? \array_map(function(
209 209
                     NodeInterface $interface
210 210
                 ) {
211 211
                     return $this->buildType($interface);
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
     {
225 225
         return keyValueMap(
226 226
             $node->getFields(),
227
-            function ($value) {
227
+            function($value) {
228 228
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
229 229
                 return $value->getNameValue();
230 230
             },
231
-            function ($value) use ($node) {
231
+            function($value) use ($node) {
232 232
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
233 233
                 return $this->buildField($value,
234 234
                     $this->getFieldResolver($node->getNameValue(),
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
     {
293 293
         return keyValueMap(
294 294
             $nodes,
295
-            function (InputValueDefinitionNode $value) {
295
+            function(InputValueDefinitionNode $value) {
296 296
                 return $value->getNameValue();
297 297
             },
298
-            function (InputValueDefinitionNode $value): array {
298
+            function(InputValueDefinitionNode $value): array {
299 299
                 $type = $this->buildWrappedType($value->getType());
300 300
                 $defaultValue = $value->getDefaultValue();
301 301
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         return newInterfaceType([
352 352
             'name' => $node->getNameValue(),
353 353
             'description' => $node->getDescriptionValue(),
354
-            'fields' => $node->hasFields() ? function () use ($node): array {
354
+            'fields' => $node->hasFields() ? function() use ($node) : array {
355 355
                 return $this->buildFields($node);
356 356
             } : [],
357 357
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
             'description' => $node->getDescriptionValue(),
384 384
             'values' => $node->hasValues() ? keyValueMap(
385 385
                 $node->getValues(),
386
-                function (EnumValueDefinitionNode $value): string {
386
+                function(EnumValueDefinitionNode $value): string {
387 387
                     return $value->getNameValue();
388 388
                 },
389
-                function (EnumValueDefinitionNode $value): array {
389
+                function(EnumValueDefinitionNode $value): array {
390 390
                     return [
391 391
                         'description' => $value->getDescriptionValue(),
392 392
                         'deprecationReason' => $this->getDeprecationReason($value),
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
         return newUnionType([
409 409
             'name' => $node->getNameValue(),
410 410
             'description' => $node->getDescriptionValue(),
411
-            'types' => $node->hasTypes() ? \array_map(function (
411
+            'types' => $node->hasTypes() ? \array_map(function(
412 412
                 TypeNodeInterface $type
413 413
             ) {
414 414
                 return $this->buildType($type);
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         return newScalarType([
429 429
             'name' => $node->getNameValue(),
430 430
             'description' => $node->getDescriptionValue(),
431
-            'serialize' => function ($value) {
431
+            'serialize' => function($value) {
432 432
                 return $value;
433 433
             },
434 434
             'astNode' => $node,
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
         return newInputObjectType([
446 446
             'name' => $node->getNameValue(),
447 447
             'description' => $node->getDescriptionValue(),
448
-            'fields' => $node->hasFields() ? function () use ($node) {
448
+            'fields' => $node->hasFields() ? function() use ($node) {
449 449
                 return keyValueMap(
450 450
                     $node->getFields(),
451
-                    function (InputValueDefinitionNode $value): string {
451
+                    function(InputValueDefinitionNode $value): string {
452 452
                         return $value->getNameValue();
453 453
                     },
454
-                    function (InputValueDefinitionNode $value): array {
454
+                    function(InputValueDefinitionNode $value): array {
455 455
                         $type = $this->buildWrappedType($value->getType());
456 456
                         $defaultValue = $value->getDefaultValue();
457 457
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         return newDirective([
487 487
             'name' => $node->getNameValue(),
488 488
             'description' => $node->getDescriptionValue(),
489
-            'locations' => \array_map(function (NameNode $node) {
489
+            'locations' => \array_map(function(NameNode $node) {
490 490
                 return $node->getValue();
491 491
             }, $node->getLocations()),
492 492
             'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [],
Please login to merge, or discard this patch.
src/Schema/Resolver/AbstractResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function getResolveMethod(string $fieldName): ?callable
14 14
     {
15
-        $resolveMethod = 'resolve'.\ucfirst($fieldName);
15
+        $resolveMethod = 'resolve' . \ucfirst($fieldName);
16 16
 
17 17
         if (\method_exists($this, $resolveMethod)) {
18 18
             return [$this, $resolveMethod];
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function getTypeResolver(): ?callable
28 28
     {
29
-        return function ($rootValue, $contextValues, ResolveInfo $info) {
29
+        return function($rootValue, $contextValues, ResolveInfo $info) {
30 30
             return $this->resolveType($rootValue, $contextValues, $info);
31 31
         };
32 32
     }
Please login to merge, or discard this patch.
src/Schema/Validation/Rule/TypesRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             foreach ($interfaceField->getArguments() as $interfaceArgument) {
471 471
                 $argumentName = $interfaceArgument->getName();
472 472
                 $objectArgument = find($objectField->getArguments(),
473
-                    function (Argument $argument) use ($argumentName) {
473
+                    function(Argument $argument) use ($argumentName) {
474 474
                         return $argument->getName() === $argumentName;
475 475
                     });
476 476
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                     $argumentName = $objectArgument->getName();
534 534
                     $interfaceArgument = find(
535 535
                         $interfaceField->getArguments(),
536
-                        function (Argument $argument) use ($argumentName) {
536
+                        function(Argument $argument) use ($argumentName) {
537 537
                             return $argument->getName() === $argumentName;
538 538
                         }
539 539
                     );
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                         $this->context->reportError(
543 543
                             new SchemaValidationException(
544 544
                                 \sprintf(
545
-                                    'Object field argument %s.%s(%s:) is of required type %s '.
545
+                                    'Object field argument %s.%s(%s:) is of required type %s ' .
546 546
                                     'but is not also provided by the Interface field %s.%s.',
547 547
                                     $objectType->getName(),
548 548
                                     $fieldName,
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
         }
682 682
 
683 683
         return \array_filter($node->getTypes(),
684
-            function (NamedTypeNode $type) use ($memberTypeName) {
684
+            function(NamedTypeNode $type) use ($memberTypeName) {
685 685
                 return $type->getNameValue() === $memberTypeName;
686 686
             });
687 687
     }
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
         }
761 761
 
762 762
         return \array_filter($node->getValues(),
763
-            function (NameAwareInterface $type) use ($valueName) {
763
+            function(NameAwareInterface $type) use ($valueName) {
764 764
                 return $type->getNameValue() === $valueName;
765 765
             });
766 766
     }
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
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
         /** @var OperationTypeDefinitionNode $operationTypeNode */
99 99
         $operationTypeNode = find(
100 100
             $node->getOperationTypes(),
101
-            function (OperationTypeDefinitionNode $operationType) use (
101
+            function(OperationTypeDefinitionNode $operationType) use (
102 102
                 $operation
103 103
             ) {
104 104
                 return $operationType->getOperation() === $operation;
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
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
         if (!empty($errors)) {
23 23
             $message = \implode("\n",
24
-                \array_map(function (SchemaValidationException $error) {
24
+                \array_map(function(SchemaValidationException $error) {
25 25
                     return $error->getMessage();
26 26
                 }, $errors));
27 27
 
Please login to merge, or discard this patch.