Completed
Pull Request — master (#33)
by Sam
02:40
created
src/Language/AST/Node/SchemaDefinitionNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      */
34 34
     public function getOperationTypesAsArray(): array
35 35
     {
36
-        return array_map(function (SerializationInterface $node) {
36
+        return array_map(function(SerializationInterface $node) {
37 37
             return $node->toArray();
38 38
         }, $this->operationTypes);
39 39
     }
Please login to merge, or discard this patch.
src/Language/AST/Node/ObjectValueNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     public function getFieldsAsArray(): array
28 28
     {
29
-        return array_map(function (SerializationInterface $node) {
29
+        return array_map(function(SerializationInterface $node) {
30 30
             return $node->toArray();
31 31
         }, $this->fields);
32 32
     }
Please login to merge, or discard this patch.
src/Language/Parser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
          * @return mixed
440 440
          * @throws GraphQLError
441 441
          */
442
-        $parseType = function (LexerInterface $lexer) {
442
+        $parseType = function(LexerInterface $lexer) {
443 443
             $this->expect($lexer, TokenKindEnum::COLON);
444 444
             return $this->parseTypeReference($lexer);
445 445
         };
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
          * @return mixed
570 570
          * @throws GraphQLError
571 571
          */
572
-        $parseValue = function (LexerInterface $lexer) {
572
+        $parseValue = function(LexerInterface $lexer) {
573 573
             $this->expect($lexer, TokenKindEnum::COLON);
574 574
             return $this->parseValueLiteral($lexer, false);
575 575
         };
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
          * @return mixed
597 597
          * @throws GraphQLError
598 598
          */
599
-        $parseValue = function (LexerInterface $lexer) {
599
+        $parseValue = function(LexerInterface $lexer) {
600 600
             $this->expect($lexer, TokenKindEnum::COLON);
601 601
             return $this->parseConstValue($lexer);
602 602
         };
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 
658 658
         $this->expectKeyword($lexer, KeywordEnum::FRAGMENT);
659 659
 
660
-        $parseTypeCondition = function (LexerInterface $lexer) {
660
+        $parseTypeCondition = function(LexerInterface $lexer) {
661 661
             $this->expectKeyword($lexer, 'on');
662 662
             return $this->parseNamedType($lexer);
663 663
         };
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
     {
855 855
         $start = $lexer->getToken();
856 856
 
857
-        $parseValue = function (LexerInterface $lexer, bool $isConst) {
857
+        $parseValue = function(LexerInterface $lexer, bool $isConst) {
858 858
             $this->expect($lexer, TokenKindEnum::COLON);
859 859
             return $this->parseValueLiteral($lexer, $isConst);
860 860
         };
Please login to merge, or discard this patch.
src/Language/AST/Schema/DefinitionBuilder.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         $builtInTypes = keyMap(
79 79
             array_merge(specifiedScalarTypes()/*, introspectionTypes()*/),
80
-            function (NamedTypeInterface $type) {
80
+            function(NamedTypeInterface $type) {
81 81
                 return $type->getName();
82 82
             }
83 83
         );
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         return GraphQLDirective([
133 133
             'name'        => $node->getNameValue(),
134 134
             'description' => $node->getDescriptionValue(),
135
-            'locations'   => array_map(function (NameNode $node) {
135
+            'locations'   => array_map(function(NameNode $node) {
136 136
                 return $node->getValue();
137 137
             }, $node->getLocations()),
138 138
             'arguments'   => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [],
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
     {
180 180
         return keyValMap(
181 181
             $nodes,
182
-            function (InputValueDefinitionNode $value) {
182
+            function(InputValueDefinitionNode $value) {
183 183
                 return $value->getNameValue();
184 184
             },
185
-            function (InputValueDefinitionNode $value): array {
185
+            function(InputValueDefinitionNode $value): array {
186 186
                 $type = $this->buildWrappedType($value->getType());
187 187
                 return [
188 188
                     'type'         => $type,
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
         return GraphQLObjectType([
232 232
             'name'        => $node->getNameValue(),
233 233
             'description' => $node->getDescriptionValue(),
234
-            'fields'      => function () use ($node) {
234
+            'fields'      => function() use ($node) {
235 235
                 return $this->buildFields($node);
236 236
             },
237
-            'interfaces'  => function () use ($node) {
238
-                return $node->hasInterfaces() ? array_map(function (InterfaceTypeDefinitionNode $interface) {
237
+            'interfaces'  => function() use ($node) {
238
+                return $node->hasInterfaces() ? array_map(function(InterfaceTypeDefinitionNode $interface) {
239 239
                     return $this->buildType($interface);
240 240
                 }, $node->getInterfaces()) : [];
241 241
             },
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
     {
253 253
         return $node->hasFields() ? keyValMap(
254 254
             $node->getFields(),
255
-            function ($value) {
255
+            function($value) {
256 256
                 /** @noinspection PhpUndefinedMethodInspection */
257 257
                 return $value->getNameValue();
258 258
             },
259
-            function ($value) {
259
+            function($value) {
260 260
                 return $this->buildField($value);
261 261
             }
262 262
         ) : [];
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         return GraphQLInterfaceType([
272 272
             'name'        => $node->getNameValue(),
273 273
             'description' => $node->getDescriptionValue(),
274
-            'fields'      => function () use ($node): array {
274
+            'fields'      => function() use ($node): array {
275 275
                 return $this->buildFields($node);
276 276
             },
277 277
             'astNode'     => $node,
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
             'description' => $node->getDescriptionValue(),
290 290
             'values'      => $node->hasValues() ? keyValMap(
291 291
                 $node->getValues(),
292
-                function (EnumValueDefinitionNode $value): string {
292
+                function(EnumValueDefinitionNode $value): string {
293 293
                     return $value->getNameValue();
294 294
                 },
295
-                function (EnumValueDefinitionNode $value): array {
295
+                function(EnumValueDefinitionNode $value): array {
296 296
                     return [
297 297
                         'description'       => $value->getDescriptionValue(),
298 298
                         'deprecationReason' => getDeprecationReason($value),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         return GraphQLUnionType([
310 310
             'name'        => $node->getNameValue(),
311 311
             'description' => $node->getDescriptionValue(),
312
-            'types'       => $node->hasTypes() ? array_map(function (TypeNodeInterface $type) {
312
+            'types'       => $node->hasTypes() ? array_map(function(TypeNodeInterface $type) {
313 313
                 return $this->buildType($type);
314 314
             }, $node->getTypes()) : [],
315 315
             'astNode'     => $node,
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         return GraphQLScalarType([
326 326
             'name'        => $node->getNameValue(),
327 327
             'description' => $node->getDescriptionValue(),
328
-            'serialize'   => function ($value) {
328
+            'serialize'   => function($value) {
329 329
                 return $value;
330 330
             },
331 331
             'astNode'     => $node,
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
             'description' => $node->getDescriptionValue(),
346 346
             'fields'      => $node->hasFields() ? keyValMap(
347 347
                 $node->getFields(),
348
-                function (InputValueDefinitionNode $value): string {
348
+                function(InputValueDefinitionNode $value): string {
349 349
                     return $value->getNameValue();
350 350
                 },
351
-                function (InputValueDefinitionNode $value): array {
351
+                function(InputValueDefinitionNode $value): array {
352 352
                     $type = $this->buildWrappedType($value->getType());
353 353
                     return [
354 354
                         'type'         => $type,
Please login to merge, or discard this patch.
src/Type/scalars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 {
73 73
     return arraySome(
74 74
         specifiedScalarTypes(),
75
-        function (ScalarType $specifiedScalarType) use ($type) {
75
+        function(ScalarType $specifiedScalarType) use ($type) {
76 76
             /** @noinspection PhpUndefinedMethodInspection */
77 77
             return $type->getName() === $specifiedScalarType->getName();
78 78
         }
Please login to merge, or discard this patch.
src/Type/introspection.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
                 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' .
34 34
                 'exposes all available types and directives on the server, as well as ' .
35 35
                 'the entry points for query, mutation, and subscription operations.',
36
-            'fields'          => function () {
36
+            'fields'          => function() {
37 37
                 return [
38 38
                     'types'            => [
39 39
                         'description' => 'A list of all types supported by this server.',
40 40
                         'type'        => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type()))),
41
-                        'resolve'     => function (SchemaInterface $schema): array {
41
+                        'resolve'     => function(SchemaInterface $schema): array {
42 42
                             return array_values($schema->getTypeMap());
43 43
                         },
44 44
                     ],
45 45
                     'queryType'        => [
46 46
                         'description' => 'The type that query operations will be rooted at.',
47 47
                         'type'        => GraphQLNonNull(__Type()),
48
-                        'resolve'     => function (SchemaInterface $schema): ObjectType {
48
+                        'resolve'     => function(SchemaInterface $schema): ObjectType {
49 49
                             return $schema->getQuery();
50 50
                         },
51 51
                     ],
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                             'If this server supports mutation, the type that ' .
55 55
                             'mutation operations will be rooted at.',
56 56
                         'type'        => __Type(),
57
-                        'resolve'     => function (SchemaInterface $schema): ObjectType {
57
+                        'resolve'     => function(SchemaInterface $schema): ObjectType {
58 58
                             return $schema->getMutation();
59 59
                         },
60 60
                     ],
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
                             'If this server support subscription, the type that ' .
64 64
                             'subscription operations will be rooted at.',
65 65
                         'type'        => __Type(),
66
-                        'resolve'     => function (SchemaInterface $schema): ObjectType {
66
+                        'resolve'     => function(SchemaInterface $schema): ObjectType {
67 67
                             return $schema->getSubscription();
68 68
                         },
69 69
                     ],
70 70
                     'directives'       => [
71 71
                         'description' => 'A list of all directives supported by this server.',
72 72
                         'type'        => GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive()))),
73
-                        'resolve'     => function (SchemaInterface $schema): array {
73
+                        'resolve'     => function(SchemaInterface $schema): array {
74 74
                             return $schema->getDirectives();
75 75
                         },
76 76
                     ],
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 'execution behavior in ways field arguments will not suffice, such as ' .
101 101
                 'conditionally including or skipping a field. Directives provide this by ' .
102 102
                 'describing additional information to the executor.',
103
-            'fields'          => function () {
103
+            'fields'          => function() {
104 104
                 return [
105 105
                     'name'        => ['type' => GraphQLNonNull(GraphQLString())],
106 106
                     'description' => ['type' => GraphQLString()],
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                     ],
110 110
                     'args'        => [
111 111
                         'type'    => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))),
112
-                        'resolve' => function (DirectiveInterface $directive): array {
112
+                        'resolve' => function(DirectiveInterface $directive): array {
113 113
                             return $directive->getArguments() ?: [];
114 114
                         },
115 115
                     ],
@@ -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
                     ],
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
             'description'     =>
343 343
                 'Object and Interface types are described by a list of Fields, each of ' .
344 344
                 'which has a name, potentially a list of arguments, and a return type.',
345
-            'fields'          => function () {
345
+            'fields'          => function() {
346 346
                 return [
347 347
                     'name'              => ['type' => GraphQLNonNull(GraphQLString())],
348 348
                     'description'       => ['type' => GraphQLString()],
349 349
                     'args'              => [
350 350
                         'type'    => GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue()))),
351
-                        'resolve' => function (DirectiveInterface $directive): array {
351
+                        'resolve' => function(DirectiveInterface $directive): array {
352 352
                             return $directive->getArguments() ?: [];
353 353
                         },
354 354
                     ],
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
                 'Arguments provided to Fields or Directives and the input fields of an ' .
379 379
                 'InputObject are represented as Input Values which describe their type ' .
380 380
                 'and optionally a default value.',
381
-            'fields'          => function () {
381
+            'fields'          => function() {
382 382
                 return [
383 383
                     'name'         => ['type' => GraphQLNonNull(GraphQLString())],
384 384
                     'description'  => ['type' => GraphQLString()],
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                         'description' =>
389 389
                             'A GraphQL-formatted string representing the default value for this ' .
390 390
                             'input value.',
391
-                        'resolve'     => function ($inputValue) {
391
+                        'resolve'     => function($inputValue) {
392 392
                             // TODO: Implement this when we have support for printing AST.
393 393
                             return null;
394 394
                         }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                 'One possible value for a given Enum. Enum values are unique values, not ' .
417 417
                 'a placeholder for a string or numeric value. However an Enum value is ' .
418 418
                 'returned in a JSON response as a string.',
419
-            'fields'          => function () {
419
+            'fields'          => function() {
420 420
                 return [
421 421
                     'name'              => ['type' => GraphQLNonNull(GraphQLString())],
422 422
                     'description'       => ['type' => GraphQLString()],
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
         'name'        => '__schema',
482 482
         'type'        => GraphQLNonNull(__Schema()),
483 483
         'description' => 'Access the current type schema of this server.',
484
-        'resolve'     => function ($source, $args, $context, $info): SchemaInterface {
484
+        'resolve'     => function($source, $args, $context, $info): SchemaInterface {
485 485
             [$schema] = $info;
486 486
             return $schema;
487 487
         }
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         'args'        => [
502 502
             'name' => ['type' => GraphQLNonNull(GraphQLString())],
503 503
         ],
504
-        'resolve'     => function ($source, $args, $context, $info): TypeInterface {
504
+        'resolve'     => function($source, $args, $context, $info): TypeInterface {
505 505
             /** @var SchemaInterface $schema */
506 506
             [$name] = $args;
507 507
             [$schema] = $info;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         'name'        => '__typename',
521 521
         'type'        => GraphQLNonNull(GraphQLString()),
522 522
         'description' => 'The name of the current Object type at runtime.',
523
-        'resolve'     => function ($source, $args, $context, $info): string {
523
+        'resolve'     => function($source, $args, $context, $info): string {
524 524
             /** @var NamedTypeInterface $parentType */
525 525
             [$parentType] = $info;
526 526
             return $parentType->getName();
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 {
554 554
     return arraySome(
555 555
         introspectionTypes(),
556
-        function (TypeInterface $introspectionType) use ($type) {
556
+        function(TypeInterface $introspectionType) use ($type) {
557 557
             /** @noinspection PhpUndefinedMethodInspection */
558 558
             return $type->getName() === $introspectionType->getName();
559 559
         }
Please login to merge, or discard this patch.
src/Provider/ParserProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
29 29
      */
30 30
     public function register()
31 31
     {
32
-        $this->container->add(NodeBuilderInterface::class, function () {
32
+        $this->container->add(NodeBuilderInterface::class, function() {
33 33
             return new NodeBuilder(SupportedBuilders::get());
34 34
         });
35 35
 
36 36
         $this->container->add(ParserInterface::class, Parser::class, true/* $shared */)
37 37
             ->withArgument(NodeBuilderInterface::class);
38 38
 
39
-        $this->container->add(LexerInterface::class, function () {
39
+        $this->container->add(LexerInterface::class, function() {
40 40
             return new Lexer(SupportedReaders::get());
41 41
         });
42 42
     }
Please login to merge, or discard this patch.
src/Provider/DirectivesProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function register()
29 29
     {
30
-        $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function () {
30
+        $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function() {
31 31
             return GraphQLDirective([
32 32
                 'name'        => 'include',
33 33
                 'description' =>
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             ]);
48 48
         }, true/* $shared */);
49 49
 
50
-        $this->container->add(GraphQL::SKIP_DIRECTIVE, function () {
50
+        $this->container->add(GraphQL::SKIP_DIRECTIVE, function() {
51 51
             return GraphQLDirective([
52 52
                 'name'        => 'skip',
53 53
                 'description' =>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             ]);
68 68
         }, true/* $shared */);
69 69
 
70
-        $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function () {
70
+        $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function() {
71 71
             return GraphQLDirective([
72 72
                 'name'        => 'deprecated',
73 73
                 'description' => 'Marks an element of a GraphQL schema as no longer supported.',
Please login to merge, or discard this patch.
src/Provider/SchemaBuilderProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     {
29 29
         $this->container->add(DefinitionBuilderInterface::class, DefinitionBuilder::class, true/* $shared */)
30 30
             ->withArguments([
31
-                function (NamedTypeNode $node) {
31
+                function(NamedTypeNode $node) {
32 32
                     throw new \Exception(sprintf('Type "%s" not found in document.', $node->getNameValue()));
33 33
                 },
34 34
                 CacheInterface::class,
Please login to merge, or discard this patch.