Completed
Pull Request — master (#118)
by Christoffer
03:27
created
src/Validation/Conflict/FindsConflictsTrait.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/Validation/messages.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@
 block discarded – undo
218 218
         return conflictReasonMessage([$reason]);
219 219
     }
220 220
 
221
-    return implode(' and ', array_map(function ($reason) {
221
+    return implode(' and ', array_map(function($reason) {
222 222
         [$responseName, $subreason] = $reason;
223 223
         return sprintf('subfields "%s" conflict because %s', $responseName, conflictReasonMessage($subreason));
224 224
     }, $reason));
Please login to merge, or discard this patch.
src/Type/Schema.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getDirective(string $name): ?Directive
127 127
     {
128
-        return find($this->directives, function (Directive $directive) use ($name) {
128
+        return find($this->directives, function(Directive $directive) use ($name) {
129 129
             return $directive->getName() === $name;
130 130
         });
131 131
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                 )
178 178
             );
179 179
 
180
-            $this->_possibleTypeMap[$abstractTypeName] = array_reduce($possibleTypes, function (array $map, TypeInterface $type) {
180
+            $this->_possibleTypeMap[$abstractTypeName] = array_reduce($possibleTypes, function(array $map, TypeInterface $type) {
181 181
                 $map[$type->getName()] = true;
182 182
                 return $map;
183 183
             }, []);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     if ($type instanceof ObjectType || $type instanceof InterfaceType) {
389 389
         foreach ($type->getFields() as $field) {
390 390
             if ($field->hasArguments()) {
391
-                $fieldArgTypes = array_map(function (Argument $argument) {
391
+                $fieldArgTypes = array_map(function(Argument $argument) {
392 392
                     return $argument->getType();
393 393
                 }, $field->getArguments());
394 394
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         return $map;
420 420
     }
421 421
 
422
-    return array_reduce($directive->getArguments(), function ($map, Argument $argument) {
422
+    return array_reduce($directive->getArguments(), function($map, Argument $argument) {
423 423
         return typeMapReducer($map, $argument->getType());
424 424
     }, $map);
425 425
 }
Please login to merge, or discard this patch.
src/Language/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@
 block discarded – undo
146 146
  */
147 147
 function locationsShorthandToArray(array $locations): array
148 148
 {
149
-    return array_map(function ($shorthand) {
149
+    return array_map(function($shorthand) {
150 150
         return locationShorthandToArray($shorthand);
151 151
     }, $locations);
152 152
 }
Please login to merge, or discard this patch.
src/Util/TypeComparator.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/Util/orList.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     return $count === 1
20 20
         ? $selected[0]
21
-        : array_reduce($selected, function ($list, $item) use ($count, &$index) {
21
+        : array_reduce($selected, function($list, $item) use ($count, &$index) {
22 22
             $list .= ($index > 0 && $index < ($count - 1) ? ', ' : '') . ($index === ($count - 1) ? ' or ' : '') .
23 23
                 $item;
24 24
             $index++;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function quotedOrList(array $items): string
36 36
 {
37
-    return orList(array_map(function ($item) {
37
+    return orList(array_map(function($item) {
38 38
         return '"' . $item . '"';
39 39
     }, $items));
40 40
 }
Please login to merge, or discard this patch.
src/Util/suggestionList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     $result = \array_keys($optionsByDistance);
27 27
 
28
-    \usort($result, function ($a, $b) use ($optionsByDistance) {
28
+    \usort($result, function($a, $b) use ($optionsByDistance) {
29 29
         return $optionsByDistance[$a] - $optionsByDistance[$b];
30 30
     });
31 31
 
Please login to merge, or discard this patch.
src/Validation/Rule/ValuesOfCorrectTypeRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         // Ensure every required field exists.
116 116
         $inputFields  = $type->getFields();
117
-        $fieldNodeMap = keyMap($node->getFields(), function (ObjectFieldNode $field) {
117
+        $fieldNodeMap = keyMap($node->getFields(), function(ObjectFieldNode $field) {
118 118
             return $field->getNameValue();
119 119
         });
120 120
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     protected function getEnumTypeSuggestion(NamedTypeInterface $type, ValueNodeInterface $node): ?string
262 262
     {
263 263
         if ($type instanceof EnumType) {
264
-            $suggestions = suggestionList(printNode($node), \array_map(function (EnumValue $value) {
264
+            $suggestions = suggestionList(printNode($node), \array_map(function(EnumValue $value) {
265 265
                 return $value->getName();
266 266
             }, $type->getValues()));
267 267
 
Please login to merge, or discard this patch.
src/Type/IntrospectionTypesProvider.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function register()
57 57
     {
58
-        $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function () {
58
+        $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function() {
59 59
             return GraphQLObjectType([
60 60
                 'name'            => GraphQL::INTROSPECTION_SCHEMA,
61 61
                 'isIntrospection' => true,
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
                     'A GraphQL Schema defines the capabilities of a GraphQL server. It ' .
64 64
                     'exposes all available types and directives on the server, as well as ' .
65 65
                     'the entry points for query, mutation, and subscription operations.',
66
-                'fields'          => function () {
66
+                'fields'          => function() {
67 67
                     return [
68 68
                         'types'            => [
69 69
                             'description' => 'A list of all types supported by this server.',
70 70
                             'type'        => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))),
71
-                            'resolve'     => function (SchemaInterface $schema): array {
71
+                            'resolve'     => function(SchemaInterface $schema): array {
72 72
                                 return array_values($schema->getTypeMap());
73 73
                             },
74 74
                         ],
75 75
                         'queryType'        => [
76 76
                             'description' => 'The type that query operations will be rooted at.',
77 77
                             'type'        => GraphQLNonNull(__Type()),
78
-                            'resolve'     => function (SchemaInterface $schema): ObjectType {
78
+                            'resolve'     => function(SchemaInterface $schema): ObjectType {
79 79
                                 return $schema->getQuery();
80 80
                             },
81 81
                         ],
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                                 'If this server supports mutation, the type that ' .
85 85
                                 'mutation operations will be rooted at.',
86 86
                             'type'        => __Type(),
87
-                            'resolve'     => function (SchemaInterface $schema): ObjectType {
87
+                            'resolve'     => function(SchemaInterface $schema): ObjectType {
88 88
                                 return $schema->getMutation();
89 89
                             },
90 90
                         ],
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
                                 'If this server support subscription, the type that ' .
94 94
                                 'subscription operations will be rooted at.',
95 95
                             'type'        => __Type(),
96
-                            'resolve'     => function (SchemaInterface $schema): ObjectType {
96
+                            'resolve'     => function(SchemaInterface $schema): ObjectType {
97 97
                                 return $schema->getSubscription();
98 98
                             },
99 99
                         ],
100 100
                         'directives'       => [
101 101
                             'description' => 'A list of all directives supported by this server.',
102 102
                             'type'        => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))),
103
-                            'resolve'     => function (SchemaInterface $schema): array {
103
+                            'resolve'     => function(SchemaInterface $schema): array {
104 104
                                 return $schema->getDirectives();
105 105
                             },
106 106
                         ],
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             ]);
110 110
         }, true/* $shared */);
111 111
 
112
-        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function () {
112
+        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function() {
113 113
             return GraphQLObjectType([
114 114
                 'name'            => GraphQL::INTROSPECTION_DIRECTIVE,
115 115
                 'isIntrospection' => true,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                     'execution behavior in ways field arguments will not suffice, such as ' .
121 121
                     'conditionally including or skipping a field. Directives provide this by ' .
122 122
                     'describing additional information to the executor.',
123
-                'fields'          => function () {
123
+                'fields'          => function() {
124 124
                     return [
125 125
                         'name'        => ['type' => GraphQLNonNull(GraphQLString())],
126 126
                         'description' => ['type' => GraphQLString()],
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                         ],
130 130
                         'args'        => [
131 131
                             'type'    => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))),
132
-                            'resolve' => function (DirectiveInterface $directive): array {
132
+                            'resolve' => function(DirectiveInterface $directive): array {
133 133
                                 return $directive->getArguments() ?: [];
134 134
                             },
135 135
                         ],
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             ]);
139 139
         }, true/* $shared */);
140 140
 
141
-        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function () {
141
+        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function() {
142 142
             return GraphQLEnumType([
143 143
                 'name'            => GraphQL::INTROSPECTION_DIRECTIVE_LOCATION,
144 144
                 'isIntrospection' => true,
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             ]);
205 205
         }, true/* $shared */);
206 206
 
207
-        $this->container->add(GraphQL::INTROSPECTION_TYPE, function () {
207
+        $this->container->add(GraphQL::INTROSPECTION_TYPE, function() {
208 208
             return GraphQLObjectType([
209 209
                 'name'            => GraphQL::INTROSPECTION_TYPE,
210 210
                 'isIntrospection' => true,
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
                     'Object and Interface types provide the fields they describe. Abstract ' .
218 218
                     'types, Union and Interface, provide the Object types possible ' .
219 219
                     'at runtime. List and NonNull types compose other types.',
220
-                'fields'          => function () {
220
+                'fields'          => function() {
221 221
                     return [
222 222
                         'kind'          => [
223 223
                             'type'    => GraphQLNonNull(__TypeKind()),
224
-                            'resolve' => function (TypeInterface $type) {
224
+                            'resolve' => function(TypeInterface $type) {
225 225
                                 if ($type instanceof ScalarType) {
226 226
                                     return TypeKindEnum::SCALAR;
227 227
                                 }
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
                             'args'    => [
258 258
                                 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false],
259 259
                             ],
260
-                            'resolve' => function (TypeInterface $type, array $args): ?array {
260
+                            'resolve' => function(TypeInterface $type, array $args): ?array {
261 261
                                 [$includeDeprecated] = $args;
262 262
 
263 263
                                 if ($type instanceof ObjectType || $type instanceof InterfaceType) {
264 264
                                     $fields = array_values($type->getFields());
265 265
 
266 266
                                     if (!$includeDeprecated) {
267
-                                        $fields = array_filter($fields, function (Field $field) {
267
+                                        $fields = array_filter($fields, function(Field $field) {
268 268
                                             return !$field->isDeprecated();
269 269
                                         });
270 270
                                     }
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
                         ],
278 278
                         'interfaces'    => [
279 279
                             'type'    => GraphQLList(GraphQLNonNull(__Type())),
280
-                            'resolve' => function (TypeInterface $type): ?array {
280
+                            'resolve' => function(TypeInterface $type): ?array {
281 281
                                 return $type instanceof ObjectType ? $type->getInterfaces() : null;
282 282
                             },
283 283
                         ],
284 284
                         'possibleTypes' => [
285 285
                             'type'    => GraphQLList(GraphQLNonNull(__Type())),
286
-                            'resolve' => function (TypeInterface $type, $args, $context, $info): ?array {
286
+                            'resolve' => function(TypeInterface $type, $args, $context, $info): ?array {
287 287
                                 /** @var SchemaInterface $schema */
288 288
                                 [$schema] = $info;
289 289
                                 /** @noinspection PhpParamsInspection */
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
                             'args'    => [
296 296
                                 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false],
297 297
                             ],
298
-                            'resolve' => function (TypeInterface $type, array $args): ?array {
298
+                            'resolve' => function(TypeInterface $type, array $args): ?array {
299 299
                                 [$includeDeprecated] = $args;
300 300
 
301 301
                                 if ($type instanceof EnumType) {
302 302
                                     $values = array_values($type->getValues());
303 303
 
304 304
                                     if (!$includeDeprecated) {
305
-                                        $values = array_filter($values, function (Field $field) {
305
+                                        $values = array_filter($values, function(Field $field) {
306 306
                                             return !$field->isDeprecated();
307 307
                                         });
308 308
                                     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         ],
316 316
                         'inputFields'   => [
317 317
                             'type'    => GraphQLList(GraphQLNonNull(__InputValue())),
318
-                            'resolve' => function (TypeInterface $type): ?array {
318
+                            'resolve' => function(TypeInterface $type): ?array {
319 319
                                 return $type instanceof InputObjectType ? $type->getFields() : null;
320 320
                             },
321 321
                         ],
@@ -325,20 +325,20 @@  discard block
 block discarded – undo
325 325
             ]);
326 326
         }, true/* $shared */);
327 327
 
328
-        $this->container->add(GraphQL::INTROSPECTION_FIELD, function () {
328
+        $this->container->add(GraphQL::INTROSPECTION_FIELD, function() {
329 329
             return GraphQLObjectType([
330 330
                 'name'            => GraphQL::INTROSPECTION_FIELD,
331 331
                 'isIntrospection' => true,
332 332
                 'description'     =>
333 333
                     'Object and Interface types are described by a list of Fields, each of ' .
334 334
                     'which has a name, potentially a list of arguments, and a return type.',
335
-                'fields'          => function () {
335
+                'fields'          => function() {
336 336
                     return [
337 337
                         'name'              => ['type' => GraphQLNonNull(GraphQLString())],
338 338
                         'description'       => ['type' => GraphQLString()],
339 339
                         'args'              => [
340 340
                             'type'    => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))),
341
-                            'resolve' => function (DirectiveInterface $directive): array {
341
+                            'resolve' => function(DirectiveInterface $directive): array {
342 342
                                 return $directive->getArguments() ?: [];
343 343
                             },
344 344
                         ],
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
             ]);
351 351
         }, true/* $shared */);
352 352
 
353
-        $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function () {
353
+        $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function() {
354 354
             return GraphQLObjectType([
355 355
                 'name'            => GraphQL::INTROSPECTION_INPUT_VALUE,
356 356
                 'isIntrospection' => true,
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                     'Arguments provided to Fields or Directives and the input fields of an ' .
359 359
                     'InputObject are represented as Input Values which describe their type ' .
360 360
                     'and optionally a default value.',
361
-                'fields'          => function () {
361
+                'fields'          => function() {
362 362
                     return [
363 363
                         'name'         => ['type' => GraphQLNonNull(GraphQLString())],
364 364
                         'description'  => ['type' => GraphQLString()],
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                             'description' =>
369 369
                                 'A GraphQL-formatted string representing the default value for this ' .
370 370
                                 'input value.',
371
-                            'resolve'     => function ($inputValue) {
371
+                            'resolve'     => function($inputValue) {
372 372
                                 // TODO: Implement this when we have support for printing AST.
373 373
                                 return null;
374 374
                             }
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             ]);
379 379
         }, true/* $shared */);
380 380
 
381
-        $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function () {
381
+        $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function() {
382 382
             return GraphQLObjectType([
383 383
                 'name'            => GraphQL::INTROSPECTION_ENUM_VALUE,
384 384
                 'isIntrospection' => true,
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                     'One possible value for a given Enum. Enum values are unique values, not ' .
387 387
                     'a placeholder for a string or numeric value. However an Enum value is ' .
388 388
                     'returned in a JSON response as a string.',
389
-                'fields'          => function () {
389
+                'fields'          => function() {
390 390
                     return [
391 391
                         'name'              => ['type' => GraphQLNonNull(GraphQLString())],
392 392
                         'description'       => ['type' => GraphQLString()],
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             ]);
398 398
         }, true/* $shared */);
399 399
 
400
-        $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function () {
400
+        $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function() {
401 401
             return GraphQLEnumType([
402 402
                 'name'            => GraphQL::INTROSPECTION_TYPE_KIND,
403 403
                 'isIntrospection' => true,
Please login to merge, or discard this patch.