Completed
Pull Request — master (#273)
by Christoffer
03:10
created
src/Schema/DefinitionBuilder.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function buildTypes(array $nodes): array
109 109
     {
110
-        return \array_map(function (NamedTypeNodeInterface $node) {
110
+        return \array_map(function(NamedTypeNodeInterface $node) {
111 111
             return $this->buildType($node);
112 112
         }, $nodes);
113 113
     }
@@ -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
         );
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     {
239 239
         $directivesMap = keyMap(
240 240
             \array_merge($customDirectives, specifiedDirectives()),
241
-            function (Directive $directive) {
241
+            function(Directive $directive) {
242 242
                 return $directive->getName();
243 243
             }
244 244
         );
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
     {
258 258
         return keyValueMap(
259 259
             $nodes,
260
-            function (InputValueDefinitionNode $value) {
260
+            function(InputValueDefinitionNode $value) {
261 261
                 return $value->getNameValue();
262 262
             },
263
-            function (InputValueDefinitionNode $value): array {
263
+            function(InputValueDefinitionNode $value): array {
264 264
                 $type         = $this->buildWrappedType($value->getType());
265 265
                 $defaultValue = $value->getDefaultValue();
266 266
                 return [
@@ -314,14 +314,14 @@  discard block
 block discarded – undo
314 314
         return newObjectType([
315 315
             'name'        => $node->getNameValue(),
316 316
             'description' => $node->getDescriptionValue(),
317
-            'fields'      => $node->hasFields() ? function () use ($node) {
317
+            'fields'      => $node->hasFields() ? function() use ($node) {
318 318
                 return $this->buildFields($node);
319 319
             } : [],
320 320
             // Note: While this could make early assertions to get the correctly
321 321
             // typed values, that would throw immediately while type system
322 322
             // validation with validateSchema() will produce more actionable results.
323
-            'interfaces'  => function () use ($node) {
324
-                return $node->hasInterfaces() ? \array_map(function (NamedTypeNodeInterface $interface) {
323
+            'interfaces'  => function() use ($node) {
324
+                return $node->hasInterfaces() ? \array_map(function(NamedTypeNodeInterface $interface) {
325 325
                     return $this->buildType($interface);
326 326
                 }, $node->getInterfaces()) : [];
327 327
             },
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
     {
338 338
         return keyValueMap(
339 339
             $node->getFields(),
340
-            function ($value) {
340
+            function($value) {
341 341
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
342 342
                 return $value->getNameValue();
343 343
             },
344
-            function ($value) use ($node) {
344
+            function($value) use ($node) {
345 345
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
346 346
                 return $this->buildField($value,
347 347
                     $this->getFieldResolver($node->getNameValue(), $value->getNameValue()));
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         return newInterfaceType([
372 372
             'name'        => $node->getNameValue(),
373 373
             'description' => $node->getDescriptionValue(),
374
-            'fields'      => $node->hasFields() ? function () use ($node): array {
374
+            'fields'      => $node->hasFields() ? function() use ($node) : array {
375 375
                 return $this->buildFields($node);
376 376
             } : [],
377 377
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
             'description' => $node->getDescriptionValue(),
392 392
             'values'      => $node->hasValues() ? keyValueMap(
393 393
                 $node->getValues(),
394
-                function (EnumValueDefinitionNode $value): ?string {
394
+                function(EnumValueDefinitionNode $value): ?string {
395 395
                     return $value->getNameValue();
396 396
                 },
397
-                function (EnumValueDefinitionNode $value): array {
397
+                function(EnumValueDefinitionNode $value): array {
398 398
                     return [
399 399
                         'description'       => $value->getDescriptionValue(),
400 400
                         'deprecationReason' => $this->getDeprecationReason($value),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         return newUnionType([
417 417
             'name'        => $node->getNameValue(),
418 418
             'description' => $node->getDescriptionValue(),
419
-            'types'       => $node->hasTypes() ? \array_map(function (NamedTypeNodeInterface $type) {
419
+            'types'       => $node->hasTypes() ? \array_map(function(NamedTypeNodeInterface $type) {
420 420
                 return $this->buildType($type);
421 421
             }, $node->getTypes()) : [],
422 422
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         return newScalarType([
446 446
             'name'        => $node->getNameValue(),
447 447
             'description' => $node->getDescriptionValue(),
448
-            'serialize'   => function ($value) {
448
+            'serialize'   => function($value) {
449 449
                 return $value;
450 450
             },
451 451
             'astNode'     => $node,
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
         return newInputObjectType([
463 463
             'name'        => $node->getNameValue(),
464 464
             'description' => $node->getDescriptionValue(),
465
-            'fields'      => $node->hasFields() ? function () use ($node) {
465
+            'fields'      => $node->hasFields() ? function() use ($node) {
466 466
                 return keyValueMap(
467 467
                     $node->getFields(),
468
-                    function (InputValueDefinitionNode $value): ?string {
468
+                    function(InputValueDefinitionNode $value): ?string {
469 469
                         return $value->getNameValue();
470 470
                     },
471
-                    function (InputValueDefinitionNode $value): array {
471
+                    function(InputValueDefinitionNode $value): array {
472 472
                         $type         = $this->buildWrappedType($value->getType());
473 473
                         $defaultValue = $value->getDefaultValue();
474 474
                         return [
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
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function buildTypes(): array
79 79
     {
80
-        return \array_map(function (NamedTypeNodeInterface $definition) {
80
+        return \array_map(function(NamedTypeNodeInterface $definition) {
81 81
             return $this->definitionBuilder->buildType($definition);
82 82
         }, \array_values($this->info->getTypeDefinitionMap()));
83 83
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function buildDirectives(): array
89 89
     {
90
-        $directives = \array_map(function (DirectiveDefinitionNode $definition) {
90
+        $directives = \array_map(function(DirectiveDefinitionNode $definition) {
91 91
             return $this->definitionBuilder->buildDirective($definition);
92 92
         }, $this->info->getDirectiveDefinitions());
93 93
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         ];
99 99
 
100 100
         foreach ($specifiedDirectivesMap as $name => $directive) {
101
-            if (!arraySome($directives, function (Directive $directive) use ($name) {
101
+            if (!arraySome($directives, function(Directive $directive) use ($name) {
102 102
                 return $directive->getName() === $name;
103 103
             })) {
104 104
                 $directives[] = $directive;
Please login to merge, or discard this patch.