Passed
Pull Request — master (#141)
by Christoffer
02:56
created
src/Type/IntrospectionTypesProvider.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function register()
44 44
     {
45
-        $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function () {
45
+        $this->container->add(GraphQL::INTROSPECTION_SCHEMA, function() {
46 46
             return GraphQLObjectType([
47 47
                 'name'            => GraphQL::INTROSPECTION_SCHEMA,
48 48
                 'isIntrospection' => true,
@@ -50,19 +50,19 @@  discard block
 block discarded – undo
50 50
                     'A GraphQL Schema defines the capabilities of a GraphQL server. It ' .
51 51
                     'exposes all available types and directives on the server, as well as ' .
52 52
                     'the entry points for query, mutation, and subscription operations.',
53
-                'fields'          => function () {
53
+                'fields'          => function() {
54 54
                     return [
55 55
                         'types'            => [
56 56
                             'description' => 'A list of all types supported by this server.',
57 57
                             'type'        => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))),
58
-                            'resolve'     => function (SchemaInterface $schema): array {
58
+                            'resolve'     => function(SchemaInterface $schema): array {
59 59
                                 return array_values($schema->getTypeMap());
60 60
                             },
61 61
                         ],
62 62
                         'queryType'        => [
63 63
                             'description' => 'The type that query operations will be rooted at.',
64 64
                             'type'        => GraphQLNonNull(__Type()),
65
-                            'resolve'     => function (SchemaInterface $schema): ?TypeInterface {
65
+                            'resolve'     => function(SchemaInterface $schema): ?TypeInterface {
66 66
                                 return $schema->getQueryType();
67 67
                             },
68 68
                         ],
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                                 'If this server supports mutation, the type that ' .
72 72
                                 'mutation operations will be rooted at.',
73 73
                             'type'        => __Type(),
74
-                            'resolve'     => function (SchemaInterface $schema): ?TypeInterface {
74
+                            'resolve'     => function(SchemaInterface $schema): ?TypeInterface {
75 75
                                 return $schema->getMutationType();
76 76
                             },
77 77
                         ],
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
                                 'If this server support subscription, the type that ' .
81 81
                                 'subscription operations will be rooted at.',
82 82
                             'type'        => __Type(),
83
-                            'resolve'     => function (SchemaInterface $schema): ?TypeInterface {
83
+                            'resolve'     => function(SchemaInterface $schema): ?TypeInterface {
84 84
                                 return $schema->getSubscriptionType();
85 85
                             },
86 86
                         ],
87 87
                         'directives'       => [
88 88
                             'description' => 'A list of all directives supported by this server.',
89 89
                             'type'        => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))),
90
-                            'resolve'     => function (SchemaInterface $schema): array {
90
+                            'resolve'     => function(SchemaInterface $schema): array {
91 91
                                 return $schema->getDirectives();
92 92
                             },
93 93
                         ],
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             ]);
97 97
         }, true/* $shared */);
98 98
 
99
-        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function () {
99
+        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE, function() {
100 100
             return GraphQLObjectType([
101 101
                 'name'            => GraphQL::INTROSPECTION_DIRECTIVE,
102 102
                 'isIntrospection' => true,
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     'execution behavior in ways field arguments will not suffice, such as ' .
108 108
                     'conditionally including or skipping a field. Directives provide this by ' .
109 109
                     'describing additional information to the executor.',
110
-                'fields'          => function () {
110
+                'fields'          => function() {
111 111
                     return [
112 112
                         'name'        => ['type' => GraphQLNonNull(GraphQLString())],
113 113
                         'description' => ['type' => GraphQLString()],
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                         ],
117 117
                         'args'        => [
118 118
                             'type'    => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))),
119
-                            'resolve' => function (DirectiveInterface $directive): array {
119
+                            'resolve' => function(DirectiveInterface $directive): array {
120 120
                                 return $directive->getArguments() ?: [];
121 121
                             },
122 122
                         ],
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             ]);
126 126
         }, true/* $shared */);
127 127
 
128
-        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function () {
128
+        $this->container->add(GraphQL::INTROSPECTION_DIRECTIVE_LOCATION, function() {
129 129
             return GraphQLEnumType([
130 130
                 'name'            => GraphQL::INTROSPECTION_DIRECTIVE_LOCATION,
131 131
                 'isIntrospection' => true,
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             ]);
192 192
         }, true/* $shared */);
193 193
 
194
-        $this->container->add(GraphQL::INTROSPECTION_TYPE, function () {
194
+        $this->container->add(GraphQL::INTROSPECTION_TYPE, function() {
195 195
             return GraphQLObjectType([
196 196
                 'name'            => GraphQL::INTROSPECTION_TYPE,
197 197
                 'isIntrospection' => true,
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
                     'Object and Interface types provide the fields they describe. Abstract ' .
205 205
                     'types, Union and Interface, provide the Object types possible ' .
206 206
                     'at runtime. List and NonNull types compose other types.',
207
-                'fields'          => function () {
207
+                'fields'          => function() {
208 208
                     return [
209 209
                         'kind'          => [
210 210
                             'type'    => GraphQLNonNull(__TypeKind()),
211
-                            'resolve' => function (TypeInterface $type) {
211
+                            'resolve' => function(TypeInterface $type) {
212 212
                                 if ($type instanceof ScalarType) {
213 213
                                     return TypeKindEnum::SCALAR;
214 214
                                 }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                             'args'    => [
245 245
                                 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false],
246 246
                             ],
247
-                            'resolve' => function (TypeInterface $type, array $args):
247
+                            'resolve' => function(TypeInterface $type, array $args):
248 248
                             ?array {
249 249
                                 $includeDeprecated = $args[0] ?? null;
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                                     $fields = array_values($type->getFields());
253 253
 
254 254
                                     if (!$includeDeprecated) {
255
-                                        $fields = array_filter($fields, function (Field $field) {
255
+                                        $fields = array_filter($fields, function(Field $field) {
256 256
                                             return !$field->getIsDeprecated();
257 257
                                         });
258 258
                                     }
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
                         ],
266 266
                         'interfaces'    => [
267 267
                             'type'    => GraphQLList(GraphQLNonNull(__Type())),
268
-                            'resolve' => function (TypeInterface $type): ?array {
268
+                            'resolve' => function(TypeInterface $type): ?array {
269 269
                                 return $type instanceof ObjectType ? $type->getInterfaces() : null;
270 270
                             },
271 271
                         ],
272 272
                         'possibleTypes' => [
273 273
                             'type'    => GraphQLList(GraphQLNonNull(__Type())),
274
-                            'resolve' => function (TypeInterface $type, array $args, array $context, ResolveInfo
274
+                            'resolve' => function(TypeInterface $type, array $args, array $context, ResolveInfo
275 275
                             $info):
276 276
                             ?array {
277 277
                                 /** @var SchemaInterface $schema */
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
                             'args'    => [
286 286
                                 'includeDeprecated' => ['type' => GraphQLBoolean(), 'defaultValue' => false],
287 287
                             ],
288
-                            'resolve' => function (TypeInterface $type, array $args): ?array {
288
+                            'resolve' => function(TypeInterface $type, array $args): ?array {
289 289
                                 [$includeDeprecated] = $args;
290 290
 
291 291
                                 if ($type instanceof EnumType) {
292 292
                                     $values = array_values($type->getValues());
293 293
 
294 294
                                     if (!$includeDeprecated) {
295
-                                        $values = array_filter($values, function (Field $field) {
295
+                                        $values = array_filter($values, function(Field $field) {
296 296
                                             return !$field->getIsDeprecated();
297 297
                                         });
298 298
                                     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         ],
306 306
                         'inputFields'   => [
307 307
                             'type'    => GraphQLList(GraphQLNonNull(__InputValue())),
308
-                            'resolve' => function (TypeInterface $type): ?array {
308
+                            'resolve' => function(TypeInterface $type): ?array {
309 309
                                 return $type instanceof InputObjectType ? $type->getFields() : null;
310 310
                             },
311 311
                         ],
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
             ]);
316 316
         }, true/* $shared */);
317 317
 
318
-        $this->container->add(GraphQL::INTROSPECTION_FIELD, function () {
318
+        $this->container->add(GraphQL::INTROSPECTION_FIELD, function() {
319 319
             return GraphQLObjectType([
320 320
                 'name'            => GraphQL::INTROSPECTION_FIELD,
321 321
                 'isIntrospection' => true,
322 322
                 'description'     =>
323 323
                     'Object and Interface types are described by a list of Fields, each of ' .
324 324
                     'which has a name, potentially a list of arguments, and a return type.',
325
-                'fields'          => function () {
325
+                'fields'          => function() {
326 326
                     return [
327 327
                         'name'              => ['type' => GraphQLNonNull(GraphQLString())],
328 328
                         'description'       => ['type' => GraphQLString()],
329 329
                         'args'              => [
330 330
                             'type'    => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))),
331
-                            'resolve' => function (ArgumentsAwareInterface $directive): array {
331
+                            'resolve' => function(ArgumentsAwareInterface $directive): array {
332 332
                                 return $directive->getArguments() ?? [];
333 333
                             },
334 334
                         ],
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             ]);
341 341
         }, true/* $shared */);
342 342
 
343
-        $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function () {
343
+        $this->container->add(GraphQL::INTROSPECTION_INPUT_VALUE, function() {
344 344
             return GraphQLObjectType([
345 345
                 'name'            => GraphQL::INTROSPECTION_INPUT_VALUE,
346 346
                 'isIntrospection' => true,
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                     'Arguments provided to Fields or Directives and the input fields of an ' .
349 349
                     'InputObject are represented as Input Values which describe their type ' .
350 350
                     'and optionally a default value.',
351
-                'fields'          => function () {
351
+                'fields'          => function() {
352 352
                     return [
353 353
                         'name'         => ['type' => GraphQLNonNull(GraphQLString())],
354 354
                         'description'  => ['type' => GraphQLString()],
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                             'description' =>
359 359
                                 'A GraphQL-formatted string representing the default value for this ' .
360 360
                                 'input value.',
361
-                            'resolve'     => function ($inputValue) {
361
+                            'resolve'     => function($inputValue) {
362 362
                                 // TODO: Implement this when we have support for printing AST.
363 363
                                 return null;
364 364
                             }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             ]);
369 369
         }, true/* $shared */);
370 370
 
371
-        $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function () {
371
+        $this->container->add(GraphQL::INTROSPECTION_ENUM_VALUE, function() {
372 372
             return GraphQLObjectType([
373 373
                 'name'            => GraphQL::INTROSPECTION_ENUM_VALUE,
374 374
                 'isIntrospection' => true,
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                     'One possible value for a given Enum. Enum values are unique values, not ' .
377 377
                     'a placeholder for a string or numeric value. However an Enum value is ' .
378 378
                     'returned in a JSON response as a string.',
379
-                'fields'          => function () {
379
+                'fields'          => function() {
380 380
                     return [
381 381
                         'name'              => ['type' => GraphQLNonNull(GraphQLString())],
382 382
                         'description'       => ['type' => GraphQLString()],
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             ]);
388 388
         }, true/* $shared */);
389 389
 
390
-        $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function () {
390
+        $this->container->add(GraphQL::INTROSPECTION_TYPE_KIND, function() {
391 391
             return GraphQLEnumType([
392 392
                 'name'            => GraphQL::INTROSPECTION_TYPE_KIND,
393 393
                 'isIntrospection' => true,
Please login to merge, or discard this patch.