Passed
Pull Request — master (#557)
by Max
03:00
created
src/Type/SchemaValidationContext.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
     public function validateRootTypes()
75 75
     {
76 76
         $queryType = $this->schema->getQueryType();
77
-        if (! $queryType) {
77
+        if (!$queryType) {
78 78
             $this->reportError(
79 79
                 'Query root type must be provided.',
80 80
                 $this->schema->getAstNode()
81 81
             );
82
-        } elseif (! $queryType instanceof ObjectType) {
82
+        } elseif (!$queryType instanceof ObjectType) {
83 83
             $this->reportError(
84 84
                 'Query root type must be Object type, it cannot be ' . Utils::printSafe($queryType) . '.',
85 85
                 $this->getOperationTypeNode($queryType, 'query')
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         }
88 88
 
89 89
         $mutationType = $this->schema->getMutationType();
90
-        if ($mutationType && ! $mutationType instanceof ObjectType) {
90
+        if ($mutationType && !$mutationType instanceof ObjectType) {
91 91
             $this->reportError(
92 92
                 'Mutation root type must be Object type if provided, it cannot be ' . Utils::printSafe($mutationType) . '.',
93 93
                 $this->getOperationTypeNode($mutationType, 'mutation')
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         }
96 96
 
97 97
         $subscriptionType = $this->schema->getSubscriptionType();
98
-        if (! $subscriptionType || $subscriptionType instanceof ObjectType) {
98
+        if (!$subscriptionType || $subscriptionType instanceof ObjectType) {
99 99
             return;
100 100
         }
101 101
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $directives = $this->schema->getDirectives();
167 167
         foreach ($directives as $directive) {
168 168
             // Ensure all directives are in fact GraphQL directives.
169
-            if (! $directive instanceof Directive) {
169
+            if (!$directive instanceof Directive) {
170 170
                 $this->reportError(
171 171
                     'Expected directive but got: ' . Utils::printSafe($directive) . '.',
172 172
                     is_object($directive) ? $directive->astNode : null
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
             $nodes = Utils::map(
224 224
                 $directiveList,
225
-                static function (Directive $directive) {
225
+                static function(Directive $directive) {
226 226
                     return $directive->astNode;
227 227
                 }
228 228
             );
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         // Ensure names are valid, however introspection types opt out.
242 242
         $error = Utils::isValidNameError($node->name, $node->astNode);
243
-        if (! $error || Introspection::isIntrospectionType($node)) {
243
+        if (!$error || Introspection::isIntrospectionType($node)) {
244 244
             return;
245 245
         }
246 246
 
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $subNodes = $this->getAllSubNodes(
258 258
             $directive,
259
-            static function ($directiveNode) {
259
+            static function($directiveNode) {
260 260
                 return $directiveNode->arguments;
261 261
             }
262 262
         );
263 263
 
264 264
         return Utils::filter(
265 265
             $subNodes,
266
-            static function ($argNode) use ($argName) {
266
+            static function($argNode) use ($argName) {
267 267
                 return $argNode->name->value === $argName;
268 268
             }
269 269
         );
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $typeMap = $this->schema->getTypeMap();
287 287
         foreach ($typeMap as $typeName => $type) {
288 288
             // Ensure all provided types are in fact GraphQL type.
289
-            if (! $type instanceof NamedType) {
289
+            if (!$type instanceof NamedType) {
290 290
                 $this->reportError(
291 291
                     'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.',
292 292
                     $type instanceof Type ? $type->astNode : null
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
             }
379 379
             $includes = Utils::some(
380 380
                 $schemaDirective->locations,
381
-                static function ($schemaLocation) use ($location) {
381
+                static function($schemaLocation) use ($location) {
382 382
                     return $schemaLocation === $location;
383 383
                 }
384 384
             );
385
-            if (! $includes) {
385
+            if (!$includes) {
386 386
                 $errorNodes = $schemaDirective->astNode
387 387
                     ? [$directive, $schemaDirective->astNode]
388 388
                     : [$directive];
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         $fieldMap = $type->getFields();
417 417
 
418 418
         // Objects and Interfaces both must define one or more fields.
419
-        if (! $fieldMap) {
419
+        if (!$fieldMap) {
420 420
             $this->reportError(
421 421
                 sprintf('Type %s must define one or more fields.', $type->name),
422 422
                 $this->getAllNodes($type)
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             }
439 439
 
440 440
             // Ensure the type is an output type
441
-            if (! Type::isOutputType($field->getType())) {
441
+            if (!Type::isOutputType($field->getType())) {
442 442
                 $this->reportError(
443 443
                     sprintf(
444 444
                         'The type of %s.%s must be Output Type but got: %s.',
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
                 $argNames[$argName] = true;
473 473
 
474 474
                 // Ensure the type is an input type
475
-                if (! Type::isInputType($arg->getType())) {
475
+                if (!Type::isInputType($arg->getType())) {
476 476
                     $this->reportError(
477 477
                         sprintf(
478 478
                             'The type of %s.%s(%s:) must be Input Type but got: %s.',
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
                 }
487 487
 
488 488
                 // Ensure argument definition directives are valid
489
-                if (! isset($arg->astNode, $arg->astNode->directives)) {
489
+                if (!isset($arg->astNode, $arg->astNode->directives)) {
490 490
                     continue;
491 491
                 }
492 492
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             }
498 498
 
499 499
             // Ensure any directives are valid
500
-            if (! isset($field->astNode, $field->astNode->directives)) {
500
+            if (!isset($field->astNode, $field->astNode->directives)) {
501 501
                 continue;
502 502
             }
503 503
 
@@ -539,12 +539,12 @@  discard block
 block discarded – undo
539 539
     {
540 540
         $result = new NodeList([]);
541 541
         foreach ($this->getAllNodes($obj) as $astNode) {
542
-            if (! $astNode) {
542
+            if (!$astNode) {
543 543
                 continue;
544 544
             }
545 545
 
546 546
             $subNodes = $getter($astNode);
547
-            if (! $subNodes) {
547
+            if (!$subNodes) {
548 548
                 continue;
549 549
             }
550 550
 
@@ -562,11 +562,11 @@  discard block
 block discarded – undo
562 562
      */
563 563
     private function getAllFieldNodes($type, $fieldName)
564 564
     {
565
-        $subNodes = $this->getAllSubNodes($type, static function ($typeNode) {
565
+        $subNodes = $this->getAllSubNodes($type, static function($typeNode) {
566 566
             return $typeNode->fields;
567 567
         });
568 568
 
569
-        return Utils::filter($subNodes, static function ($fieldNode) use ($fieldName) {
569
+        return Utils::filter($subNodes, static function($fieldNode) use ($fieldName) {
570 570
             return $fieldNode->name->value === $fieldName;
571 571
         });
572 572
     }
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     {
654 654
         $implementedTypeNames = [];
655 655
         foreach ($object->getInterfaces() as $iface) {
656
-            if (! $iface instanceof InterfaceType) {
656
+            if (!$iface instanceof InterfaceType) {
657 657
                 $this->reportError(
658 658
                     sprintf(
659 659
                         'Type %s must only implement Interface types, it cannot implement %s.',
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
      */
684 684
     private function getDirectives($object)
685 685
     {
686
-        return $this->getAllSubNodes($object, static function ($node) {
686
+        return $this->getAllSubNodes($object, static function($node) {
687 687
             return $node->directives;
688 688
         });
689 689
     }
@@ -707,11 +707,11 @@  discard block
 block discarded – undo
707 707
      */
708 708
     private function getAllImplementsInterfaceNodes(ObjectType $type, $iface)
709 709
     {
710
-        $subNodes = $this->getAllSubNodes($type, static function ($typeNode) {
710
+        $subNodes = $this->getAllSubNodes($type, static function($typeNode) {
711 711
             return $typeNode->interfaces;
712 712
         });
713 713
 
714
-        return Utils::filter($subNodes, static function ($ifaceNode) use ($iface) {
714
+        return Utils::filter($subNodes, static function($ifaceNode) use ($iface) {
715 715
             return $ifaceNode->name->value === $iface->name;
716 716
         });
717 717
     }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                 : null;
732 732
 
733 733
             // Assert interface field exists on object.
734
-            if (! $objectField) {
734
+            if (!$objectField) {
735 735
                 $this->reportError(
736 736
                     sprintf(
737 737
                         'Interface field %s.%s expected but %s does not provide it.',
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 
750 750
             // Assert interface field type is satisfied by object field type, by being
751 751
             // a valid subtype. (covariant)
752
-            if (! TypeComparators::isTypeSubTypeOf(
752
+            if (!TypeComparators::isTypeSubTypeOf(
753 753
                 $this->schema,
754 754
                 $objectField->getType(),
755 755
                 $ifaceField->getType()
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                 }
786 786
 
787 787
                 // Assert interface field arg exists on object field.
788
-                if (! $objectArg) {
788
+                if (!$objectArg) {
789 789
                     $this->reportError(
790 790
                         sprintf(
791 791
                             'Interface field argument %s.%s(%s:) expected but %s.%s does not provide it.',
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
                 // Assert interface field arg type matches object field arg type.
807 807
                 // (invariant)
808 808
                 // TODO: change to contravariant?
809
-                if (! TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) {
809
+                if (!TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) {
810 810
                     $this->reportError(
811 811
                         sprintf(
812 812
                             'Interface field argument %s.%s(%s:) expects type %s but %s.%s(%s:) is type %s.',
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
                     }
841 841
                 }
842 842
 
843
-                if ($ifaceArg || ! ($objectArg->getType() instanceof NonNull)) {
843
+                if ($ifaceArg || !($objectArg->getType() instanceof NonNull)) {
844 844
                     continue;
845 845
                 }
846 846
 
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
     {
868 868
         $memberTypes = $union->getTypes();
869 869
 
870
-        if (! $memberTypes) {
870
+        if (!$memberTypes) {
871 871
             $this->reportError(
872 872
                 sprintf('Union type %s must define one or more member types.', $union->name),
873 873
                 $this->getAllNodes($union)
@@ -907,11 +907,11 @@  discard block
 block discarded – undo
907 907
      */
908 908
     private function getUnionMemberTypeNodes(UnionType $union, $typeName)
909 909
     {
910
-        $subNodes = $this->getAllSubNodes($union, static function ($unionNode) {
910
+        $subNodes = $this->getAllSubNodes($union, static function($unionNode) {
911 911
             return $unionNode->types;
912 912
         });
913 913
 
914
-        return Utils::filter($subNodes, static function ($typeNode) use ($typeName) {
914
+        return Utils::filter($subNodes, static function($typeNode) use ($typeName) {
915 915
             return $typeNode->name->value === $typeName;
916 916
         });
917 917
     }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
     {
921 921
         $enumValues = $enumType->getValues();
922 922
 
923
-        if (! $enumValues) {
923
+        if (!$enumValues) {
924 924
             $this->reportError(
925 925
                 sprintf('Enum type %s must define one or more values.', $enumType->name),
926 926
                 $this->getAllNodes($enumType)
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             }
950 950
 
951 951
             // Ensure valid directives
952
-            if (! isset($enumValue->astNode, $enumValue->astNode->directives)) {
952
+            if (!isset($enumValue->astNode, $enumValue->astNode->directives)) {
953 953
                 continue;
954 954
             }
955 955
 
@@ -967,11 +967,11 @@  discard block
 block discarded – undo
967 967
      */
968 968
     private function getEnumValueNodes(EnumType $enum, $valueName)
969 969
     {
970
-        $subNodes = $this->getAllSubNodes($enum, static function ($enumNode) {
970
+        $subNodes = $this->getAllSubNodes($enum, static function($enumNode) {
971 971
             return $enumNode->values;
972 972
         });
973 973
 
974
-        return Utils::filter($subNodes, static function ($valueNode) use ($valueName) {
974
+        return Utils::filter($subNodes, static function($valueNode) use ($valueName) {
975 975
             return $valueNode->name->value === $valueName;
976 976
         });
977 977
     }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
     {
981 981
         $fieldMap = $inputObj->getFields();
982 982
 
983
-        if (! $fieldMap) {
983
+        if (!$fieldMap) {
984 984
             $this->reportError(
985 985
                 sprintf('Input Object type %s must define one or more fields.', $inputObj->name),
986 986
                 $this->getAllNodes($inputObj)
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
             // TODO: Ensure they are unique per field.
996 996
 
997 997
             // Ensure the type is an input type
998
-            if (! Type::isInputType($field->getType())) {
998
+            if (!Type::isInputType($field->getType())) {
999 999
                 $this->reportError(
1000 1000
                     sprintf(
1001 1001
                         'The type of %s.%s must be Input Type but got: %s.',
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
             }
1009 1009
 
1010 1010
             // Ensure valid directives
1011
-            if (! isset($field->astNode, $field->astNode->directives)) {
1011
+            if (!isset($field->astNode, $field->astNode->directives)) {
1012 1012
                 continue;
1013 1013
             }
1014 1014
 
Please login to merge, or discard this patch.
src/Type/Introspection.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             );
62 62
             $descriptions = $options;
63 63
         } else {
64
-            $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true;
64
+            $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true;
65 65
         }
66 66
         $descriptionField = $descriptions ? 'description' : '';
67 67
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
     public static function _schema()
188 188
     {
189
-        if (! isset(self::$map['__Schema'])) {
189
+        if (!isset(self::$map['__Schema'])) {
190 190
             self::$map['__Schema'] = new ObjectType([
191 191
                 'name'            => '__Schema',
192 192
                 'isIntrospection' => true,
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
                     'types'            => [
200 200
                         'description' => 'A list of all types supported by this server.',
201 201
                         'type'        => new NonNull(new ListOfType(new NonNull(self::_type()))),
202
-                        'resolve'     => static function (Schema $schema) {
202
+                        'resolve'     => static function(Schema $schema) {
203 203
                             return array_values($schema->getTypeMap());
204 204
                         },
205 205
                     ],
206 206
                     'queryType'        => [
207 207
                         'description' => 'The type that query operations will be rooted at.',
208 208
                         'type'        => new NonNull(self::_type()),
209
-                        'resolve'     => static function (Schema $schema) {
209
+                        'resolve'     => static function(Schema $schema) {
210 210
                             return $schema->getQueryType();
211 211
                         },
212 212
                     ],
@@ -215,21 +215,21 @@  discard block
 block discarded – undo
215 215
                             'If this server supports mutation, the type that ' .
216 216
                             'mutation operations will be rooted at.',
217 217
                         'type'        => self::_type(),
218
-                        'resolve'     => static function (Schema $schema) {
218
+                        'resolve'     => static function(Schema $schema) {
219 219
                             return $schema->getMutationType();
220 220
                         },
221 221
                     ],
222 222
                     'subscriptionType' => [
223 223
                         'description' => 'If this server support subscription, the type that subscription operations will be rooted at.',
224 224
                         'type'        => self::_type(),
225
-                        'resolve'     => static function (Schema $schema) {
225
+                        'resolve'     => static function(Schema $schema) {
226 226
                             return $schema->getSubscriptionType();
227 227
                         },
228 228
                     ],
229 229
                     'directives'       => [
230 230
                         'description' => 'A list of all directives supported by this server.',
231 231
                         'type'        => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))),
232
-                        'resolve'     => static function (Schema $schema) {
232
+                        'resolve'     => static function(Schema $schema) {
233 233
                             return $schema->getDirectives();
234 234
                         },
235 235
                     ],
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
     public static function _type()
244 244
     {
245
-        if (! isset(self::$map['__Type'])) {
245
+        if (!isset(self::$map['__Type'])) {
246 246
             self::$map['__Type'] = new ObjectType([
247 247
                 'name'            => '__Type',
248 248
                 'isIntrospection' => true,
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
                     'Object and Interface types provide the fields they describe. Abstract ' .
257 257
                     'types, Union and Interface, provide the Object types possible ' .
258 258
                     'at runtime. List and NonNull types compose other types.',
259
-                'fields'          => static function () {
259
+                'fields'          => static function() {
260 260
                     return [
261 261
                         'kind'          => [
262 262
                             'type'    => Type::nonNull(self::_typeKind()),
263
-                            'resolve' => static function (Type $type) {
263
+                            'resolve' => static function(Type $type) {
264 264
                                 switch (true) {
265 265
                                     case $type instanceof ListOfType:
266 266
                                         return TypeKind::LIST_KIND;
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
                         ],
286 286
                         'name'          => [
287 287
                             'type' => Type::string(),
288
-                            'resolve' => static function ($obj) {
288
+                            'resolve' => static function($obj) {
289 289
                                 return $obj->name;
290 290
                             },
291 291
                         ],
292 292
                         'description'   => [
293 293
                             'type' => Type::string(),
294
-                            'resolve' => static function ($obj) {
294
+                            'resolve' => static function($obj) {
295 295
                                 return $obj->description;
296 296
                             },
297 297
                         ],
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
                             'args'    => [
301 301
                                 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false],
302 302
                             ],
303
-                            'resolve' => static function (Type $type, $args) {
303
+                            'resolve' => static function(Type $type, $args) {
304 304
                                 if ($type instanceof ObjectType || $type instanceof InterfaceType) {
305 305
                                     $fields = $type->getFields();
306 306
 
307 307
                                     if (empty($args['includeDeprecated'])) {
308 308
                                         $fields = array_filter(
309 309
                                             $fields,
310
-                                            static function (FieldDefinition $field) {
311
-                                                return ! $field->deprecationReason;
310
+                                            static function(FieldDefinition $field) {
311
+                                                return !$field->deprecationReason;
312 312
                                             }
313 313
                                         );
314 314
                                     }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                         ],
322 322
                         'interfaces'    => [
323 323
                             'type'    => Type::listOf(Type::nonNull(self::_type())),
324
-                            'resolve' => static function ($type) {
324
+                            'resolve' => static function($type) {
325 325
                                 if ($type instanceof ObjectType) {
326 326
                                     return $type->getInterfaces();
327 327
                                 }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                         ],
332 332
                         'possibleTypes' => [
333 333
                             'type'    => Type::listOf(Type::nonNull(self::_type())),
334
-                            'resolve' => static function ($type, $args, $context, ResolveInfo $info) {
334
+                            'resolve' => static function($type, $args, $context, ResolveInfo $info) {
335 335
                                 if ($type instanceof InterfaceType || $type instanceof UnionType) {
336 336
                                     return $info->schema->getPossibleTypes($type);
337 337
                                 }
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
                             'args'    => [
345 345
                                 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false],
346 346
                             ],
347
-                            'resolve' => static function ($type, $args) {
347
+                            'resolve' => static function($type, $args) {
348 348
                                 if ($type instanceof EnumType) {
349 349
                                     $values = array_values($type->getValues());
350 350
 
351 351
                                     if (empty($args['includeDeprecated'])) {
352 352
                                         $values = array_filter(
353 353
                                             $values,
354
-                                            static function ($value) {
355
-                                                return ! $value->deprecationReason;
354
+                                            static function($value) {
355
+                                                return !$value->deprecationReason;
356 356
                                             }
357 357
                                         );
358 358
                                     }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                         ],
366 366
                         'inputFields'   => [
367 367
                             'type'    => Type::listOf(Type::nonNull(self::_inputValue())),
368
-                            'resolve' => static function ($type) {
368
+                            'resolve' => static function($type) {
369 369
                                 if ($type instanceof InputObjectType) {
370 370
                                     return array_values($type->getFields());
371 371
                                 }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                         ],
376 376
                         'ofType'        => [
377 377
                             'type'    => self::_type(),
378
-                            'resolve' => static function ($type) {
378
+                            'resolve' => static function($type) {
379 379
                                 if ($type instanceof WrappingType) {
380 380
                                     return $type->getWrappedType();
381 381
                                 }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
     public static function _typeKind()
395 395
     {
396
-        if (! isset(self::$map['__TypeKind'])) {
396
+        if (!isset(self::$map['__TypeKind'])) {
397 397
             self::$map['__TypeKind'] = new EnumType([
398 398
                 'name'            => '__TypeKind',
399 399
                 'isIntrospection' => true,
@@ -440,48 +440,48 @@  discard block
 block discarded – undo
440 440
 
441 441
     public static function _field()
442 442
     {
443
-        if (! isset(self::$map['__Field'])) {
443
+        if (!isset(self::$map['__Field'])) {
444 444
             self::$map['__Field'] = new ObjectType([
445 445
                 'name'            => '__Field',
446 446
                 'isIntrospection' => true,
447 447
                 'description'     =>
448 448
                     'Object and Interface types are described by a list of Fields, each of ' .
449 449
                     'which has a name, potentially a list of arguments, and a return type.',
450
-                'fields'          => static function () {
450
+                'fields'          => static function() {
451 451
                     return [
452 452
                         'name'              => [
453 453
                             'type' => Type::nonNull(Type::string()),
454
-                            'resolve' => static function (FieldDefinition $field) {
454
+                            'resolve' => static function(FieldDefinition $field) {
455 455
                                 return $field->name;
456 456
                             },
457 457
                         ],
458 458
                         'description'       => [
459 459
                             'type' => Type::string(),
460
-                            'resolve' => static function (FieldDefinition $field) {
460
+                            'resolve' => static function(FieldDefinition $field) {
461 461
                                 return $field->description;
462 462
                             },
463 463
                         ],
464 464
                         'args'              => [
465 465
                             'type'    => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
466
-                            'resolve' => static function (FieldDefinition $field) {
466
+                            'resolve' => static function(FieldDefinition $field) {
467 467
                                 return empty($field->args) ? [] : $field->args;
468 468
                             },
469 469
                         ],
470 470
                         'type'              => [
471 471
                             'type'    => Type::nonNull(self::_type()),
472
-                            'resolve' => static function (FieldDefinition $field) {
472
+                            'resolve' => static function(FieldDefinition $field) {
473 473
                                 return $field->getType();
474 474
                             },
475 475
                         ],
476 476
                         'isDeprecated'      => [
477 477
                             'type'    => Type::nonNull(Type::boolean()),
478
-                            'resolve' => static function (FieldDefinition $field) {
478
+                            'resolve' => static function(FieldDefinition $field) {
479 479
                                 return (bool) $field->deprecationReason;
480 480
                             },
481 481
                         ],
482 482
                         'deprecationReason' => [
483 483
                             'type'    => Type::string(),
484
-                            'resolve' => static function (FieldDefinition $field) {
484
+                            'resolve' => static function(FieldDefinition $field) {
485 485
                                 return $field->deprecationReason;
486 486
                             },
487 487
                         ],
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 
496 496
     public static function _inputValue()
497 497
     {
498
-        if (! isset(self::$map['__InputValue'])) {
498
+        if (!isset(self::$map['__InputValue'])) {
499 499
             self::$map['__InputValue'] = new ObjectType([
500 500
                 'name'            => '__InputValue',
501 501
                 'isIntrospection' => true,
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
                     'Arguments provided to Fields or Directives and the input fields of an ' .
504 504
                     'InputObject are represented as Input Values which describe their type ' .
505 505
                     'and optionally a default value.',
506
-                'fields'          => static function () {
506
+                'fields'          => static function() {
507 507
                     return [
508 508
                         'name'         => [
509 509
                             'type' => Type::nonNull(Type::string()),
510
-                            'resolve' => static function ($inputValue) {
510
+                            'resolve' => static function($inputValue) {
511 511
                                 /** @var FieldArgument|InputObjectField $inputValue */
512 512
                                 $inputValue = $inputValue;
513 513
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                         ],
517 517
                         'description'  => [
518 518
                             'type' => Type::string(),
519
-                            'resolve' => static function ($inputValue) {
519
+                            'resolve' => static function($inputValue) {
520 520
                                 /** @var FieldArgument|InputObjectField $inputValue */
521 521
                                 $inputValue = $inputValue;
522 522
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                         ],
526 526
                         'type'         => [
527 527
                             'type'    => Type::nonNull(self::_type()),
528
-                            'resolve' => static function ($value) {
528
+                            'resolve' => static function($value) {
529 529
                                 return method_exists($value, 'getType')
530 530
                                     ? $value->getType()
531 531
                                     : $value->type;
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
                             'type'        => Type::string(),
536 536
                             'description' =>
537 537
                                 'A GraphQL-formatted string representing the default value for this input value.',
538
-                            'resolve'     => static function ($inputValue) {
538
+                            'resolve'     => static function($inputValue) {
539 539
                                 /** @var FieldArgument|InputObjectField $inputValue */
540 540
                                 $inputValue = $inputValue;
541 541
 
542
-                                return ! $inputValue->defaultValueExists()
542
+                                return !$inputValue->defaultValueExists()
543 543
                                     ? null
544 544
                                     : Printer::doPrint(AST::astFromValue(
545 545
                                         $inputValue->defaultValue,
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
     public static function _enumValue()
559 559
     {
560
-        if (! isset(self::$map['__EnumValue'])) {
560
+        if (!isset(self::$map['__EnumValue'])) {
561 561
             self::$map['__EnumValue'] = new ObjectType([
562 562
                 'name'            => '__EnumValue',
563 563
                 'isIntrospection' => true,
@@ -568,25 +568,25 @@  discard block
 block discarded – undo
568 568
                 'fields'          => [
569 569
                     'name'              => [
570 570
                         'type' => Type::nonNull(Type::string()),
571
-                        'resolve' => static function ($enumValue) {
571
+                        'resolve' => static function($enumValue) {
572 572
                             return $enumValue->name;
573 573
                         },
574 574
                     ],
575 575
                     'description'       => [
576 576
                         'type' => Type::string(),
577
-                        'resolve' => static function ($enumValue) {
577
+                        'resolve' => static function($enumValue) {
578 578
                             return $enumValue->description;
579 579
                         },
580 580
                     ],
581 581
                     'isDeprecated'      => [
582 582
                         'type'    => Type::nonNull(Type::boolean()),
583
-                        'resolve' => static function ($enumValue) {
583
+                        'resolve' => static function($enumValue) {
584 584
                             return (bool) $enumValue->deprecationReason;
585 585
                         },
586 586
                     ],
587 587
                     'deprecationReason' => [
588 588
                         'type' => Type::string(),
589
-                        'resolve' => static function ($enumValue) {
589
+                        'resolve' => static function($enumValue) {
590 590
                             return $enumValue->deprecationReason;
591 591
                         },
592 592
                     ],
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
     public static function _directive()
601 601
     {
602
-        if (! isset(self::$map['__Directive'])) {
602
+        if (!isset(self::$map['__Directive'])) {
603 603
             self::$map['__Directive'] = new ObjectType([
604 604
                 'name'            => '__Directive',
605 605
                 'isIntrospection' => true,
@@ -612,13 +612,13 @@  discard block
 block discarded – undo
612 612
                 'fields'          => [
613 613
                     'name'        => [
614 614
                         'type'    => Type::nonNull(Type::string()),
615
-                        'resolve' => static function ($obj) {
615
+                        'resolve' => static function($obj) {
616 616
                             return $obj->name;
617 617
                         },
618 618
                     ],
619 619
                     'description' => [
620 620
                         'type' => Type::string(),
621
-                        'resolve' => static function ($obj) {
621
+                        'resolve' => static function($obj) {
622 622
                             return $obj->description;
623 623
                         },
624 624
                     ],
@@ -626,13 +626,13 @@  discard block
 block discarded – undo
626 626
                         'type' => Type::nonNull(Type::listOf(Type::nonNull(
627 627
                             self::_directiveLocation()
628 628
                         ))),
629
-                        'resolve' => static function ($obj) {
629
+                        'resolve' => static function($obj) {
630 630
                             return $obj->locations;
631 631
                         },
632 632
                     ],
633 633
                     'args'        => [
634 634
                         'type'    => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
635
-                        'resolve' => static function (Directive $directive) {
635
+                        'resolve' => static function(Directive $directive) {
636 636
                             return $directive->args ?: [];
637 637
                         },
638 638
                     ],
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
     public static function _directiveLocation()
647 647
     {
648
-        if (! isset(self::$map['__DirectiveLocation'])) {
648
+        if (!isset(self::$map['__DirectiveLocation'])) {
649 649
             self::$map['__DirectiveLocation'] = new EnumType([
650 650
                 'name'            => '__DirectiveLocation',
651 651
                 'isIntrospection' => true,
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
 
740 740
     public static function schemaMetaFieldDef() : FieldDefinition
741 741
     {
742
-        if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) {
742
+        if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) {
743 743
             self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([
744 744
                 'name'        => self::SCHEMA_FIELD_NAME,
745 745
                 'type'        => Type::nonNull(self::_schema()),
746 746
                 'description' => 'Access the current type schema of this server.',
747 747
                 'args'        => [],
748
-                'resolve'     => static function (
748
+                'resolve'     => static function(
749 749
                     $source,
750 750
                     $args,
751 751
                     $context,
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 
762 762
     public static function typeMetaFieldDef() : FieldDefinition
763 763
     {
764
-        if (! isset(self::$map[self::TYPE_FIELD_NAME])) {
764
+        if (!isset(self::$map[self::TYPE_FIELD_NAME])) {
765 765
             self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([
766 766
                 'name'        => self::TYPE_FIELD_NAME,
767 767
                 'type'        => self::_type(),
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
                 'args'        => [
770 770
                     ['name' => 'name', 'type' => Type::nonNull(Type::string())],
771 771
                 ],
772
-                'resolve'     => static function ($source, $args, $context, ResolveInfo $info) {
772
+                'resolve'     => static function($source, $args, $context, ResolveInfo $info) {
773 773
                     return $info->schema->getType($args['name']);
774 774
                 },
775 775
             ]);
@@ -780,13 +780,13 @@  discard block
 block discarded – undo
780 780
 
781 781
     public static function typeNameMetaFieldDef() : FieldDefinition
782 782
     {
783
-        if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) {
783
+        if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) {
784 784
             self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([
785 785
                 'name'        => self::TYPE_NAME_FIELD_NAME,
786 786
                 'type'        => Type::nonNull(Type::string()),
787 787
                 'description' => 'The name of the current Object type at runtime.',
788 788
                 'args'        => [],
789
-                'resolve'     => static function (
789
+                'resolve'     => static function(
790 790
                     $source,
791 791
                     $args,
792 792
                     $context,
Please login to merge, or discard this patch.
src/Type/SchemaConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
     {
69 69
         $config = new static();
70 70
 
71
-        if (! empty($options)) {
71
+        if (!empty($options)) {
72 72
             if (isset($options['query'])) {
73 73
                 $config->setQuery($options['query']);
74 74
             }
Please login to merge, or discard this patch.
src/Deferred.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     public static function runQueue() : void
39 39
     {
40 40
         $queue = self::getQueue();
41
-        while (! $queue->isEmpty()) {
41
+        while (!$queue->isEmpty()) {
42 42
             /** @var self $dequeuedNodeValue */
43 43
             $dequeuedNodeValue = $queue->dequeue();
44 44
             $dequeuedNodeValue->run();
Please login to merge, or discard this patch.
src/Error/Warning.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
         if (self::$warningHandler !== null) {
102 102
             $fn = self::$warningHandler;
103 103
             $fn($errorMessage, $warningId, $messageLevel);
104
-        } elseif ((self::$enableWarnings & $warningId) > 0 && ! isset(self::$warned[$warningId])) {
104
+        } elseif ((self::$enableWarnings & $warningId) > 0 && !isset(self::$warned[$warningId])) {
105 105
             self::$warned[$warningId] = true;
106 106
             trigger_error($errorMessage, $messageLevel);
107 107
         }
Please login to merge, or discard this patch.
src/Error/FormattedError.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if ($error->nodes) {
70 70
             /** @var Node $node */
71 71
             foreach ($error->nodes as $node) {
72
-                if (! $node->loc) {
72
+                if (!$node->loc) {
73 73
                     continue;
74 74
                 }
75 75
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             }
90 90
         }
91 91
 
92
-        return ! $printedLocations
92
+        return !$printedLocations
93 93
             ? $error->getMessage()
94 94
             : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n";
95 95
     }
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
         if ($e instanceof Error) {
203 203
             $locations = Utils::map(
204 204
                 $e->getLocations(),
205
-                static function (SourceLocation $loc) {
205
+                static function(SourceLocation $loc) {
206 206
                     return $loc->toSerializableArray();
207 207
                 }
208 208
             );
209
-            if (! empty($locations)) {
209
+            if (!empty($locations)) {
210 210
                 $formattedError['locations'] = $locations;
211 211
             }
212
-            if (! empty($e->path)) {
212
+            if (!empty($e->path)) {
213 213
                 $formattedError['path'] = $e->path;
214 214
             }
215
-            if (! empty($e->getExtensions())) {
215
+            if (!empty($e->getExtensions())) {
216 216
                 $formattedError['extensions'] = $e->getExtensions() + $formattedError['extensions'];
217 217
             }
218 218
         }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public static function addDebugEntries(array $formattedError, $e, $debug)
240 240
     {
241
-        if (! $debug) {
241
+        if (!$debug) {
242 242
             return $formattedError;
243 243
         }
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $debug = (int) $debug;
252 252
 
253 253
         if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) {
254
-            if (! $e instanceof Error) {
254
+            if (!$e instanceof Error) {
255 255
                 throw $e;
256 256
             }
257 257
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             }
261 261
         }
262 262
 
263
-        $isUnsafe = ! $e instanceof ClientAware || ! $e->isClientSafe();
263
+        $isUnsafe = !$e instanceof ClientAware || !$e->isClientSafe();
264 264
 
265 265
         if (($debug & Debug::RETHROW_UNSAFE_EXCEPTIONS) && $isUnsafe) {
266 266
             if ($e->getPrevious()) {
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
                 ];
282 282
             }
283 283
 
284
-            $isTrivial = $e instanceof Error && ! $e->getPrevious();
284
+            $isTrivial = $e instanceof Error && !$e->getPrevious();
285 285
 
286
-            if (! $isTrivial) {
286
+            if (!$isTrivial) {
287 287
                 $debugging               = $e->getPrevious() ?: $e;
288 288
                 $formattedError['trace'] = static::toSafeTrace($debugging);
289 289
             }
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public static function prepareFormatter(?callable $formatter = null, $debug)
304 304
     {
305
-        $formatter = $formatter ?: static function ($e) {
305
+        $formatter = $formatter ?: static function($e) {
306 306
             return FormattedError::createFromException($e);
307 307
         };
308 308
         if ($debug) {
309
-            $formatter = static function ($e) use ($formatter, $debug) {
309
+            $formatter = static function($e) use ($formatter, $debug) {
310 310
                 return FormattedError::addDebugEntries($formatter($e), $e, $debug);
311 311
             };
312 312
         }
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
             // Remove invariant entries as they don't provide much value:
332 332
             ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) {
333 333
             array_shift($trace);
334
-        } elseif (! isset($trace[0]['file'])) {
334
+        } elseif (!isset($trace[0]['file'])) {
335 335
             // Remove root call as it's likely error handler trace:
336 336
             array_shift($trace);
337 337
         }
338 338
 
339 339
         return array_map(
340
-            static function ($err) {
340
+            static function($err) {
341 341
                 $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]);
342 342
 
343 343
                 if (isset($err['function'])) {
344 344
                     $func    = $err['function'];
345
-                    $args    = ! empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : [];
345
+                    $args    = !empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : [];
346 346
                     $funcStr = $func . '(' . implode(', ', $args) . ')';
347 347
 
348 348
                     if (isset($err['class'])) {
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $formatted = ['message' => $error];
413 413
 
414
-        if (! empty($locations)) {
414
+        if (!empty($locations)) {
415 415
             $formatted['locations'] = array_map(
416
-                static function ($loc) {
416
+                static function($loc) {
417 417
                     return $loc->toArray();
418 418
                 },
419 419
                 $locations
Please login to merge, or discard this patch.
src/Error/Error.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         // Compute list of blame nodes.
107 107
         if ($nodes instanceof Traversable) {
108 108
             $nodes = iterator_to_array($nodes);
109
-        } elseif ($nodes && ! is_array($nodes)) {
109
+        } elseif ($nodes && !is_array($nodes)) {
110 110
             $nodes = [$nodes];
111 111
         }
112 112
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     public function getSource()
213 213
     {
214 214
         if ($this->source === null) {
215
-            if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) {
215
+            if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) {
216 216
                 $this->source = $this->nodes[0]->loc->source;
217 217
             }
218 218
         }
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function getPositions()
227 227
     {
228
-        if ($this->positions === null && ! empty($this->nodes)) {
228
+        if ($this->positions === null && !empty($this->nodes)) {
229 229
             $positions = array_map(
230
-                static function ($node) {
230
+                static function($node) {
231 231
                     return isset($node->loc) ? $node->loc->start : null;
232 232
                 },
233 233
                 $this->nodes
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
             $positions = array_filter(
237 237
                 $positions,
238
-                static function ($p) {
238
+                static function($p) {
239 239
                     return $p !== null;
240 240
                 }
241 241
             );
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
 
271 271
             if ($positions && $source) {
272 272
                 $this->locations = array_map(
273
-                    static function ($pos) use ($source) {
273
+                    static function($pos) use ($source) {
274 274
                         return $source->getLocation($pos);
275 275
                     },
276 276
                     $positions
277 277
                 );
278 278
             } elseif ($nodes) {
279
-                $locations       = array_filter(
279
+                $locations = array_filter(
280 280
                     array_map(
281
-                        static function ($node) {
281
+                        static function($node) {
282 282
                             if ($node->loc && $node->loc->source) {
283 283
                                 return $node->loc->source->getLocation($node->loc->start);
284 284
                             }
@@ -341,18 +341,18 @@  discard block
 block discarded – undo
341 341
 
342 342
         $locations = Utils::map(
343 343
             $this->getLocations(),
344
-            static function (SourceLocation $loc) {
344
+            static function(SourceLocation $loc) {
345 345
                 return $loc->toSerializableArray();
346 346
             }
347 347
         );
348 348
 
349
-        if (! empty($locations)) {
349
+        if (!empty($locations)) {
350 350
             $arr['locations'] = $locations;
351 351
         }
352
-        if (! empty($this->path)) {
352
+        if (!empty($this->path)) {
353 353
             $arr['path'] = $this->path;
354 354
         }
355
-        if (! empty($this->extensions)) {
355
+        if (!empty($this->extensions)) {
356 356
             $arr['extensions'] = $this->extensions;
357 357
         }
358 358
 
Please login to merge, or discard this patch.
src/Language/Visitor.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $isEdited  = $isLeaving && count($edits) !== 0;
209 209
 
210 210
             if ($isLeaving) {
211
-                $key    = ! $ancestors ? $UNDEFINED : $path[count($path) - 1];
211
+                $key    = !$ancestors ? $UNDEFINED : $path[count($path) - 1];
212 212
                 $node   = $parent;
213 213
                 $parent = array_pop($ancestors);
214 214
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $inArray = $stack['inArray'];
252 252
                 $stack   = $stack['prev'];
253 253
             } else {
254
-                $key  = $parent !== null
254
+                $key = $parent !== null
255 255
                     ? ($inArray
256 256
                         ? $index
257 257
                         : $keys[$index]
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
             }
273 273
 
274 274
             $result = null;
275
-            if (! $node instanceof NodeList && ! is_array($node)) {
276
-                if (! ($node instanceof Node)) {
275
+            if (!$node instanceof NodeList && !is_array($node)) {
276
+                if (!($node instanceof Node)) {
277 277
                     throw new Exception('Invalid AST Node: ' . json_encode($node));
278 278
                 }
279 279
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                             if ($result->doBreak) {
289 289
                                 break;
290 290
                             }
291
-                            if (! $isLeaving && $result->doContinue) {
291
+                            if (!$isLeaving && $result->doContinue) {
292 292
                                 array_pop($path);
293 293
                                 continue;
294 294
                             }
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
                         }
301 301
 
302 302
                         $edits[] = [$key, $editValue];
303
-                        if (! $isLeaving) {
304
-                            if (! ($editValue instanceof Node)) {
303
+                        if (!$isLeaving) {
304
+                            if (!($editValue instanceof Node)) {
305 305
                                 array_pop($path);
306 306
                                 continue;
307 307
                             }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             if ($isLeaving) {
320 320
                 array_pop($path);
321 321
             } else {
322
-                $stack   = [
322
+                $stack = [
323 323
                     'inArray' => $inArray,
324 324
                     'index'   => $index,
325 325
                     'keys'    => $keys,
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
         $skipping      = new SplFixedArray($visitorsCount);
402 402
 
403 403
         return [
404
-            'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
404
+            'enter' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) {
405 405
                 for ($i = 0; $i < $visitorsCount; $i++) {
406
-                    if (! empty($skipping[$i])) {
406
+                    if (!empty($skipping[$i])) {
407 407
                         continue;
408 408
                     }
409 409
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         false
414 414
                     );
415 415
 
416
-                    if (! $fn) {
416
+                    if (!$fn) {
417 417
                         continue;
418 418
                     }
419 419
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                     }
433 433
                 }
434 434
             },
435
-            'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
435
+            'leave' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) {
436 436
                 for ($i = 0; $i < $visitorsCount; $i++) {
437 437
                     if (empty($skipping[$i])) {
438 438
                         $fn = self::getVisitFn(
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
     public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor)
469 469
     {
470 470
         return [
471
-            'enter' => static function (Node $node) use ($typeInfo, $visitor) {
471
+            'enter' => static function(Node $node) use ($typeInfo, $visitor) {
472 472
                 $typeInfo->enter($node);
473 473
                 $fn = self::getVisitFn($visitor, $node->kind, false);
474 474
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
                 return null;
488 488
             },
489
-            'leave' => static function (Node $node) use ($typeInfo, $visitor) {
489
+            'leave' => static function(Node $node) use ($typeInfo, $visitor) {
490 490
                 $fn     = self::getVisitFn($visitor, $node->kind, true);
491 491
                 $result = $fn ? call_user_func_array($fn, func_get_args()) : null;
492 492
                 $typeInfo->leave($node);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
         $kindVisitor = $visitor[$kind] ?? null;
513 513
 
514
-        if (! $isLeaving && is_callable($kindVisitor)) {
514
+        if (!$isLeaving && is_callable($kindVisitor)) {
515 515
             // { Kind() {} }
516 516
             return $kindVisitor;
517 517
         }
Please login to merge, or discard this patch.
src/Language/Printer.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
             $ast,
100 100
             [
101 101
                 'leave' => [
102
-                    NodeKind::NAME => static function (NameNode $node) {
102
+                    NodeKind::NAME => static function(NameNode $node) {
103 103
                         return '' . $node->value;
104 104
                     },
105 105
 
106
-                    NodeKind::VARIABLE => static function (VariableNode $node) {
106
+                    NodeKind::VARIABLE => static function(VariableNode $node) {
107 107
                         return '$' . $node->name;
108 108
                     },
109 109
 
110
-                    NodeKind::DOCUMENT => function (DocumentNode $node) {
110
+                    NodeKind::DOCUMENT => function(DocumentNode $node) {
111 111
                         return $this->join($node->definitions, "\n\n") . "\n";
112 112
                     },
113 113
 
114
-                    NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) {
114
+                    NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) {
115 115
                         $op           = $node->operation;
116 116
                         $name         = $node->name;
117 117
                         $varDefs      = $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')');
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 
121 121
                         // Anonymous queries with no directives or variable definitions can use
122 122
                         // the query short form.
123
-                        return ! $name && ! $directives && ! $varDefs && $op === 'query'
123
+                        return !$name && !$directives && !$varDefs && $op === 'query'
124 124
                             ? $selectionSet
125 125
                             : $this->join([$op, $this->join([$name, $varDefs]), $directives, $selectionSet], ' ');
126 126
                     },
127 127
 
128
-                    NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) {
128
+                    NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) {
129 129
                         return $node->variable
130 130
                             . ': '
131 131
                             . $node->type
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
                             . $this->wrap(' ', $this->join($node->directives, ' '));
134 134
                     },
135 135
 
136
-                    NodeKind::SELECTION_SET => function (SelectionSetNode $node) {
136
+                    NodeKind::SELECTION_SET => function(SelectionSetNode $node) {
137 137
                         return $this->block($node->selections);
138 138
                     },
139 139
 
140
-                    NodeKind::FIELD => function (FieldNode $node) {
140
+                    NodeKind::FIELD => function(FieldNode $node) {
141 141
                         return $this->join(
142 142
                             [
143 143
                                 $this->wrap('', $node->alias, ': ') . $node->name . $this->wrap(
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
                         );
153 153
                     },
154 154
 
155
-                    NodeKind::ARGUMENT => static function (ArgumentNode $node) {
155
+                    NodeKind::ARGUMENT => static function(ArgumentNode $node) {
156 156
                         return $node->name . ': ' . $node->value;
157 157
                     },
158 158
 
159
-                    NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) {
159
+                    NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) {
160 160
                         return '...' . $node->name . $this->wrap(' ', $this->join($node->directives, ' '));
161 161
                     },
162 162
 
163
-                    NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) {
163
+                    NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) {
164 164
                         return $this->join(
165 165
                             [
166 166
                                 '...',
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                         );
173 173
                     },
174 174
 
175
-                    NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) {
175
+                    NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) {
176 176
                         // Note: fragment variable definitions are experimental and may be changed or removed in the future.
177 177
                         return sprintf('fragment %s', $node->name)
178 178
                             . $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')')
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
                             . $node->selectionSet;
182 182
                     },
183 183
 
184
-                    NodeKind::INT => static function (IntValueNode $node) {
184
+                    NodeKind::INT => static function(IntValueNode $node) {
185 185
                         return $node->value;
186 186
                     },
187 187
 
188
-                    NodeKind::FLOAT => static function (FloatValueNode $node) {
188
+                    NodeKind::FLOAT => static function(FloatValueNode $node) {
189 189
                         return $node->value;
190 190
                     },
191 191
 
192
-                    NodeKind::STRING => function (StringValueNode $node, $key) {
192
+                    NodeKind::STRING => function(StringValueNode $node, $key) {
193 193
                         if ($node->block) {
194 194
                             return $this->printBlockString($node->value, $key === 'description');
195 195
                         }
@@ -197,47 +197,47 @@  discard block
 block discarded – undo
197 197
                         return json_encode($node->value);
198 198
                     },
199 199
 
200
-                    NodeKind::BOOLEAN => static function (BooleanValueNode $node) {
200
+                    NodeKind::BOOLEAN => static function(BooleanValueNode $node) {
201 201
                         return $node->value ? 'true' : 'false';
202 202
                     },
203 203
 
204
-                    NodeKind::NULL => static function (NullValueNode $node) {
204
+                    NodeKind::NULL => static function(NullValueNode $node) {
205 205
                         return 'null';
206 206
                     },
207 207
 
208
-                    NodeKind::ENUM => static function (EnumValueNode $node) {
208
+                    NodeKind::ENUM => static function(EnumValueNode $node) {
209 209
                         return $node->value;
210 210
                     },
211 211
 
212
-                    NodeKind::LST => function (ListValueNode $node) {
212
+                    NodeKind::LST => function(ListValueNode $node) {
213 213
                         return '[' . $this->join($node->values, ', ') . ']';
214 214
                     },
215 215
 
216
-                    NodeKind::OBJECT => function (ObjectValueNode $node) {
216
+                    NodeKind::OBJECT => function(ObjectValueNode $node) {
217 217
                         return '{' . $this->join($node->fields, ', ') . '}';
218 218
                     },
219 219
 
220
-                    NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) {
220
+                    NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) {
221 221
                         return $node->name . ': ' . $node->value;
222 222
                     },
223 223
 
224
-                    NodeKind::DIRECTIVE => function (DirectiveNode $node) {
224
+                    NodeKind::DIRECTIVE => function(DirectiveNode $node) {
225 225
                         return '@' . $node->name . $this->wrap('(', $this->join($node->arguments, ', '), ')');
226 226
                     },
227 227
 
228
-                    NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) {
228
+                    NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) {
229 229
                         return $node->name;
230 230
                     },
231 231
 
232
-                    NodeKind::LIST_TYPE => static function (ListTypeNode $node) {
232
+                    NodeKind::LIST_TYPE => static function(ListTypeNode $node) {
233 233
                         return '[' . $node->type . ']';
234 234
                     },
235 235
 
236
-                    NodeKind::NON_NULL_TYPE => static function (NonNullTypeNode $node) {
236
+                    NodeKind::NON_NULL_TYPE => static function(NonNullTypeNode $node) {
237 237
                         return $node->type . '!';
238 238
                     },
239 239
 
240
-                    NodeKind::SCHEMA_DEFINITION => function (SchemaDefinitionNode $def) {
240
+                    NodeKind::SCHEMA_DEFINITION => function(SchemaDefinitionNode $def) {
241 241
                         return $this->join(
242 242
                             [
243 243
                                 'schema',
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
                         );
249 249
                     },
250 250
 
251
-                    NodeKind::OPERATION_TYPE_DEFINITION => static function (OperationTypeDefinitionNode $def) {
251
+                    NodeKind::OPERATION_TYPE_DEFINITION => static function(OperationTypeDefinitionNode $def) {
252 252
                         return $def->operation . ': ' . $def->type;
253 253
                     },
254 254
 
255
-                    NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function (ScalarTypeDefinitionNode $def) {
255
+                    NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function(ScalarTypeDefinitionNode $def) {
256 256
                         return $this->join(['scalar', $def->name, $this->join($def->directives, ' ')], ' ');
257 257
                     }),
258 258
 
259
-                    NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function (ObjectTypeDefinitionNode $def) {
259
+                    NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function(ObjectTypeDefinitionNode $def) {
260 260
                         return $this->join(
261 261
                             [
262 262
                                 'type',
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
                         );
270 270
                     }),
271 271
 
272
-                    NodeKind::FIELD_DEFINITION => $this->addDescription(function (FieldDefinitionNode $def) {
273
-                        $noIndent = Utils::every($def->arguments, static function (string $arg) {
272
+                    NodeKind::FIELD_DEFINITION => $this->addDescription(function(FieldDefinitionNode $def) {
273
+                        $noIndent = Utils::every($def->arguments, static function(string $arg) {
274 274
                             return strpos($arg, "\n") === false;
275 275
                         });
276 276
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                             . $this->wrap(' ', $this->join($def->directives, ' '));
283 283
                     }),
284 284
 
285
-                    NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function (InputValueDefinitionNode $def) {
285
+                    NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function(InputValueDefinitionNode $def) {
286 286
                         return $this->join(
287 287
                             [
288 288
                                 $def->name . ': ' . $def->type,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                     }),
295 295
 
296 296
                     NodeKind::INTERFACE_TYPE_DEFINITION => $this->addDescription(
297
-                        function (InterfaceTypeDefinitionNode $def) {
297
+                        function(InterfaceTypeDefinitionNode $def) {
298 298
                             return $this->join(
299 299
                                 [
300 300
                                     'interface',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                         }
308 308
                     ),
309 309
 
310
-                    NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function (UnionTypeDefinitionNode $def) {
310
+                    NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function(UnionTypeDefinitionNode $def) {
311 311
                         return $this->join(
312 312
                             [
313 313
                                 'union',
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                         );
322 322
                     }),
323 323
 
324
-                    NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function (EnumTypeDefinitionNode $def) {
324
+                    NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function(EnumTypeDefinitionNode $def) {
325 325
                         return $this->join(
326 326
                             [
327 327
                                 'enum',
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
                         );
334 334
                     }),
335 335
 
336
-                    NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function (EnumValueDefinitionNode $def) {
336
+                    NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function(EnumValueDefinitionNode $def) {
337 337
                         return $this->join([$def->name, $this->join($def->directives, ' ')], ' ');
338 338
                     }),
339 339
 
340
-                    NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function (
340
+                    NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function(
341 341
                         InputObjectTypeDefinitionNode $def
342 342
                     ) {
343 343
                         return $this->join(
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                         );
352 352
                     }),
353 353
 
354
-                    NodeKind::SCHEMA_EXTENSION => function (SchemaTypeExtensionNode $def) {
354
+                    NodeKind::SCHEMA_EXTENSION => function(SchemaTypeExtensionNode $def) {
355 355
                         return $this->join(
356 356
                             [
357 357
                                 'extend schema',
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
                         );
363 363
                     },
364 364
 
365
-                    NodeKind::SCALAR_TYPE_EXTENSION => function (ScalarTypeExtensionNode $def) {
365
+                    NodeKind::SCALAR_TYPE_EXTENSION => function(ScalarTypeExtensionNode $def) {
366 366
                         return $this->join(
367 367
                             [
368 368
                                 'extend scalar',
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                         );
374 374
                     },
375 375
 
376
-                    NodeKind::OBJECT_TYPE_EXTENSION => function (ObjectTypeExtensionNode $def) {
376
+                    NodeKind::OBJECT_TYPE_EXTENSION => function(ObjectTypeExtensionNode $def) {
377 377
                         return $this->join(
378 378
                             [
379 379
                                 'extend type',
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                         );
387 387
                     },
388 388
 
389
-                    NodeKind::INTERFACE_TYPE_EXTENSION => function (InterfaceTypeExtensionNode $def) {
389
+                    NodeKind::INTERFACE_TYPE_EXTENSION => function(InterfaceTypeExtensionNode $def) {
390 390
                         return $this->join(
391 391
                             [
392 392
                                 'extend interface',
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                         );
399 399
                     },
400 400
 
401
-                    NodeKind::UNION_TYPE_EXTENSION => function (UnionTypeExtensionNode $def) {
401
+                    NodeKind::UNION_TYPE_EXTENSION => function(UnionTypeExtensionNode $def) {
402 402
                         return $this->join(
403 403
                             [
404 404
                                 'extend union',
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                         );
413 413
                     },
414 414
 
415
-                    NodeKind::ENUM_TYPE_EXTENSION => function (EnumTypeExtensionNode $def) {
415
+                    NodeKind::ENUM_TYPE_EXTENSION => function(EnumTypeExtensionNode $def) {
416 416
                         return $this->join(
417 417
                             [
418 418
                                 'extend enum',
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                         );
425 425
                     },
426 426
 
427
-                    NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function (InputObjectTypeExtensionNode $def) {
427
+                    NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function(InputObjectTypeExtensionNode $def) {
428 428
                         return $this->join(
429 429
                             [
430 430
                                 'extend input',
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
                         );
437 437
                     },
438 438
 
439
-                    NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function (DirectiveDefinitionNode $def) {
440
-                        $noIndent = Utils::every($def->arguments, static function (string $arg) {
439
+                    NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function(DirectiveDefinitionNode $def) {
440
+                        $noIndent = Utils::every($def->arguments, static function(string $arg) {
441 441
                             return strpos($arg, "\n") === false;
442 442
                         });
443 443
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
     public function addDescription(callable $cb)
457 457
     {
458
-        return function ($node) use ($cb) {
458
+        return function($node) use ($cb) {
459 459
             return $this->join([$node->description, $cb($node)], "\n");
460 460
         };
461 461
     }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                 $separator,
503 503
                 Utils::filter(
504 504
                     $maybeArray,
505
-                    static function ($x) {
505
+                    static function($x) {
506 506
                         return (bool) $x;
507 507
                     }
508 508
                 )
Please login to merge, or discard this patch.