Passed
Pull Request — master (#33)
by Sam
02:29
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/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.
src/Provider/ScalarTypesProvider.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -36,38 +36,38 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function register()
38 38
     {
39
-        $this->container->add(GraphQL::BOOLEAN, function () {
39
+        $this->container->add(GraphQL::BOOLEAN, function() {
40 40
             return GraphQLScalarType([
41 41
                 'name'        => TypeNameEnum::BOOLEAN,
42 42
                 'description' => 'The `Boolean` scalar type represents `true` or `false`.',
43
-                'serialize'   => function ($value) {
43
+                'serialize'   => function($value) {
44 44
                     return coerceBoolean($value);
45 45
                 },
46
-                'parseValue'  => function ($value) {
46
+                'parseValue'  => function($value) {
47 47
                     return coerceBoolean($value);
48 48
                 },
49 49
 
50
-                'parseLiteral' => function (NodeInterface $astNode) {
50
+                'parseLiteral' => function(NodeInterface $astNode) {
51 51
                     /** @var BooleanValueNode $astNode */
52 52
                     return $astNode->getKind() === NodeKindEnum::BOOLEAN ? $astNode->getValue() : null;
53 53
                 },
54 54
             ]);
55 55
         }, true/* $shared */);
56 56
 
57
-        $this->container->add(GraphQL::FLOAT, function () {
57
+        $this->container->add(GraphQL::FLOAT, function() {
58 58
             return GraphQLScalarType([
59 59
                 'name'         => TypeNameEnum::FLOAT,
60 60
                 'description'  =>
61 61
                     'The `Float` scalar type represents signed double-precision fractional ' .
62 62
                     'values as specified by ' .
63 63
                     '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).',
64
-                'serialize'    => function ($value) {
64
+                'serialize'    => function($value) {
65 65
                     return coerceFloat($value);
66 66
                 },
67
-                'parseValue'   => function ($value) {
67
+                'parseValue'   => function($value) {
68 68
                     return coerceFloat($value);
69 69
                 },
70
-                'parseLiteral' => function (NodeInterface $astNode) {
70
+                'parseLiteral' => function(NodeInterface $astNode) {
71 71
                     /** @var FloatValueNode $astNode */
72 72
                     return $astNode->getKind() === NodeKindEnum::FLOAT || $astNode->getKind() === NodeKindEnum::INT
73 73
                         ? $astNode->getValue()
@@ -76,26 +76,26 @@  discard block
 block discarded – undo
76 76
             ]);
77 77
         }, true/* $shared */);
78 78
 
79
-        $this->container->add(GraphQL::INT, function () {
79
+        $this->container->add(GraphQL::INT, function() {
80 80
             return GraphQLScalarType([
81 81
                 'name'         => TypeNameEnum::INT,
82 82
                 'description'  =>
83 83
                     'The `Int` scalar type represents non-fractional signed whole numeric ' .
84 84
                     'values. Int can represent values between -(2^31) and 2^31 - 1.',
85
-                'serialize'    => function ($value) {
85
+                'serialize'    => function($value) {
86 86
                     return coerceInt($value);
87 87
                 },
88
-                'parseValue'   => function ($value) {
88
+                'parseValue'   => function($value) {
89 89
                     return coerceInt($value);
90 90
                 },
91
-                'parseLiteral' => function (NodeInterface $astNode) {
91
+                'parseLiteral' => function(NodeInterface $astNode) {
92 92
                     /** @var IntValueNode $astNode */
93 93
                     return $astNode->getKind() === NodeKindEnum::INT ? $astNode->getValue() : null;
94 94
                 },
95 95
             ]);
96 96
         }, true/* $shared */);
97 97
 
98
-        $this->container->add(GraphQL::ID, function () {
98
+        $this->container->add(GraphQL::ID, function() {
99 99
             return GraphQLScalarType([
100 100
                 'name'         => TypeNameEnum::ID,
101 101
                 'description'  =>
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
                     'response as a String; however, it is not intended to be human-readable. ' .
105 105
                     'When expected as an input type, any string (such as `"4"`) or integer ' .
106 106
                     '(such as `4`) input value will be accepted as an ID.',
107
-                'serialize'    => function ($value) {
107
+                'serialize'    => function($value) {
108 108
                     return coerceString($value);
109 109
                 },
110
-                'parseValue'   => function ($value) {
110
+                'parseValue'   => function($value) {
111 111
                     return coerceString($value);
112 112
                 },
113
-                'parseLiteral' => function (NodeInterface $astNode) {
113
+                'parseLiteral' => function(NodeInterface $astNode) {
114 114
                     /** @var StringValueNode $astNode */
115 115
                     return $astNode->getKind() === NodeKindEnum::STRING || $astNode->getKind() === NodeKindEnum::INT
116 116
                         ? $astNode->getValue()
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
             ]);
120 120
         }, true/* $shared */);
121 121
 
122
-        $this->container->add(GraphQL::STRING, function () {
122
+        $this->container->add(GraphQL::STRING, function() {
123 123
             return GraphQLScalarType([
124 124
                 'name'         => TypeNameEnum::STRING,
125 125
                 'description'  =>
126 126
                     'The `String` scalar type represents textual data, represented as UTF-8 ' .
127 127
                     'character sequences. The String type is most often used by GraphQL to ' .
128 128
                     'represent free-form human-readable text.',
129
-                'serialize'    => function ($value) {
129
+                'serialize'    => function($value) {
130 130
                     return coerceString($value);
131 131
                 },
132
-                'parseValue'   => function ($value) {
132
+                'parseValue'   => function($value) {
133 133
                     return coerceString($value);
134 134
                 },
135
-                'parseLiteral' => function (NodeInterface $astNode) {
135
+                'parseLiteral' => function(NodeInterface $astNode) {
136 136
                     /** @var StringValueNode $astNode */
137 137
                     return $astNode->getKind() === NodeKindEnum::STRING ? $astNode->getValue() : null;
138 138
                 },
Please login to merge, or discard this patch.