Completed
Pull Request — master (#19)
by Christoffer
02:15
created
src/Language/AST/Schema/DefinitionBuilder.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->resolveTypeFunction = $resolveTypeFunction;
75 75
         $this->_cache              = keyMap(
76 76
             array_merge(specifiedScalarTypes()/*, introspectionTypes()*/),
77
-            function (NamedTypeInterface $type) {
77
+            function(NamedTypeInterface $type) {
78 78
                 return $type->getName();
79 79
             }
80 80
         );
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         return GraphQLDirective([
122 122
             'name'        => $node->getNameValue(),
123 123
             'description' => $node->getDescriptionValue(),
124
-            'locations'   => array_map(function (NameNode $node) {
124
+            'locations'   => array_map(function(NameNode $node) {
125 125
                 return $node->getValue();
126 126
             }, $node->getLocations()),
127 127
             'arguments'   => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [],
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
     {
168 168
         return keyValMap(
169 169
             $nodes,
170
-            function (InputValueDefinitionNode $value) {
170
+            function(InputValueDefinitionNode $value) {
171 171
                 return $value->getNameValue();
172 172
             },
173
-            function (InputValueDefinitionNode $value): array {
173
+            function(InputValueDefinitionNode $value): array {
174 174
                 return [
175 175
                     'type'         => $this->buildWrappedType($value->getType()),
176 176
                     'description'  => $value->getDescriptionValue(),
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
         return GraphQLObjectType([
220 220
             'name'        => $node->getNameValue(),
221 221
             'description' => $node->getDescriptionValue(),
222
-            'fields'      => function () use ($node) {
222
+            'fields'      => function() use ($node) {
223 223
                 return $this->buildFields($node);
224 224
             },
225
-            'interfaces'  => function () use ($node) {
226
-                return $node->hasInterfaces() ? array_map(function (InterfaceTypeDefinitionNode $interface) {
225
+            'interfaces'  => function() use ($node) {
226
+                return $node->hasInterfaces() ? array_map(function(InterfaceTypeDefinitionNode $interface) {
227 227
                     return $this->buildType($interface);
228 228
                 }, $node->getInterfaces()) : [];
229 229
             },
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
     {
239 239
         return $node->hasFields() ? keyValMap(
240 240
             $node->getFields(),
241
-            function ($value) {
241
+            function($value) {
242 242
                 return $value->getNameValue();
243 243
             },
244
-            function ($value) {
244
+            function($value) {
245 245
                 return $this->buildField($value);
246 246
             }
247 247
         ) : [];
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         return GraphQLInterfaceType([
257 257
             'name'        => $node->getNameValue(),
258 258
             'description' => $node->getDescriptionValue(),
259
-            'fields'      => function () use ($node): array {
259
+            'fields'      => function() use ($node): array {
260 260
                 return $this->buildFields($node);
261 261
             },
262 262
             'astNode'     => $node,
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
             'description' => $node->getDescriptionValue(),
275 275
             'values'      => $node->hasValues() ? keyValMap(
276 276
                 $node->getValues(),
277
-                function (EnumValueDefinitionNode $value): string {
277
+                function(EnumValueDefinitionNode $value): string {
278 278
                     return $value->getNameValue();
279 279
                 },
280
-                function (EnumValueDefinitionNode $value): array {
280
+                function(EnumValueDefinitionNode $value): array {
281 281
                     return [
282 282
                         'description'       => $value->getDescriptionValue(),
283 283
                         // TODO: Implement support for deprecation reason
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         return GraphQLUnionType([
296 296
             'name'        => $node->getNameValue(),
297 297
             'description' => $node->getDescriptionValue(),
298
-            'types'       => $node->hasTypes() ? array_map(function (TypeNodeInterface $type) {
298
+            'types'       => $node->hasTypes() ? array_map(function(TypeNodeInterface $type) {
299 299
                 return $this->buildType($type);
300 300
             }, $node->getTypes()) : [],
301 301
             'astNode'     => $node,
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         return GraphQLScalarType([
312 312
             'name'        => $node->getNameValue(),
313 313
             'description' => $node->getDescriptionValue(),
314
-            'serialize'   => function ($value) {
314
+            'serialize'   => function($value) {
315 315
                 return $value;
316 316
             },
317 317
             'astNode'     => $node,
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
             'description' => $node->getDescriptionValue(),
330 330
             'fields'      => $node->hasFields() ? keyValMap(
331 331
                 $node->getFields(),
332
-                function (InputValueDefinitionNode $value): string {
332
+                function(InputValueDefinitionNode $value): string {
333 333
                     return $value->getNameValue();
334 334
                 },
335
-                function (InputValueDefinitionNode $value): array {
335
+                function(InputValueDefinitionNode $value): array {
336 336
                     return [
337 337
                         'type'         => $this->buildWrappedType($value->getType()),
338 338
                         'description'  => $value->getDescriptionValue(),
Please login to merge, or discard this patch.
src/Util/helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function arraySome(array $array, callable $fn)
25 25
 {
26
-    return array_reduce($array, function ($result, $value) use ($fn) {
26
+    return array_reduce($array, function($result, $value) use ($fn) {
27 27
         return $result || $fn($value);
28 28
     });
29 29
 }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function keyMap(array $array, callable $keyFn): array
37 37
 {
38
-    return array_reduce($array, function ($map, $item) use ($keyFn) {
38
+    return array_reduce($array, function($map, $item) use ($keyFn) {
39 39
         $map[$keyFn($item)] = $item;
40 40
         return $map;
41 41
     }, []);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function keyValMap(array $array, callable $keyFn, callable $valFn): array
51 51
 {
52
-    return array_reduce($array, function ($map, $item) use ($keyFn, $valFn) {
52
+    return array_reduce($array, function($map, $item) use ($keyFn, $valFn) {
53 53
         $map[$keyFn($item)] = $valFn($item);
54 54
         return $map;
55 55
     }, []);
Please login to merge, or discard this patch.