GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch kind (653eae)
by Šimon
03:43
created
Category
src/Type/Definition/FieldDefinition.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         if (is_callable($fields)) {
91 91
             $fields = $fields();
92 92
         }
93
-        if (! is_array($fields)) {
93
+        if (!is_array($fields)) {
94 94
             throw new InvariantViolation(
95 95
                 sprintf('%s fields must be an array or a callable which returns such an array.', $type->name)
96 96
             );
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
         $map = [];
99 99
         foreach ($fields as $name => $field) {
100 100
             if (is_array($field)) {
101
-                if (! isset($field['name'])) {
102
-                    if (! is_string($name)) {
101
+                if (!isset($field['name'])) {
102
+                    if (!is_string($name)) {
103 103
                         throw new InvariantViolation(
104 104
                             sprintf(
105 105
                                 '%s fields must be an associative array with field names as keys or a function which returns such an array.',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
                     $field['name'] = $name;
112 112
                 }
113
-                if (isset($field['args']) && ! is_array($field['args'])) {
113
+                if (isset($field['args']) && !is_array($field['args'])) {
114 114
                     throw new InvariantViolation(
115 115
                         sprintf('%s.%s args must be an array.', $type->name, $name)
116 116
                     );
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             } elseif ($field instanceof self) {
120 120
                 $fieldDef = $field;
121 121
             } else {
122
-                if (! is_string($name) || ! $field) {
122
+                if (!is_string($name) || !$field) {
123 123
                     throw new InvariantViolation(
124 124
                         sprintf(
125 125
                             '%s.%s field config must be an array, but got: %s',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             throw new InvariantViolation(sprintf('%s.%s: %s', $parentType->name, $this->name, $e->getMessage()));
208 208
         }
209 209
         Utils::invariant(
210
-            ! isset($this->config['isDeprecated']),
210
+            !isset($this->config['isDeprecated']),
211 211
             sprintf(
212 212
                 '%s.%s should provide "deprecationReason" instead of "isDeprecated".',
213 213
                 $parentType->name,
Please login to merge, or discard this patch.
src/Type/Definition/InputObjectType.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct(array $config)
32 32
     {
33
-        if (! isset($config['name'])) {
33
+        if (!isset($config['name'])) {
34 34
             $config['name'] = $this->tryInferName();
35 35
         }
36 36
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             $fields       = $this->config['fields'] ?? [];
68 68
             $fields       = is_callable($fields) ? call_user_func($fields) : $fields;
69 69
 
70
-            if (! is_array($fields)) {
70
+            if (!is_array($fields)) {
71 71
                 throw new InvariantViolation(
72 72
                     sprintf('%s fields must be an array or a callable which returns such an array.', $this->name)
73 73
                 );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         parent::assertValid();
97 97
 
98 98
         Utils::invariant(
99
-            ! empty($this->getFields()),
99
+            !empty($this->getFields()),
100 100
             sprintf(
101 101
                 '%s fields must be an associative array with field names as keys or a callable which returns such an array.',
102 102
                 $this->name
Please login to merge, or discard this patch.
src/Type/Introspection.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             );
57 57
             $descriptions = $options;
58 58
         } else {
59
-            $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true;
59
+            $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true;
60 60
         }
61 61
         $descriptionField = $descriptions ? 'description' : '';
62 62
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     public static function _schema()
182 182
     {
183
-        if (! isset(self::$map['__Schema'])) {
183
+        if (!isset(self::$map['__Schema'])) {
184 184
             self::$map['__Schema'] = new ObjectType([
185 185
                 'name'            => '__Schema',
186 186
                 'isIntrospection' => true,
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
                     'types'            => [
194 194
                         'description' => 'A list of all types supported by this server.',
195 195
                         'type'        => new NonNull(new ListOfType(new NonNull(self::_type()))),
196
-                        'resolve'     => function (Schema $schema) {
196
+                        'resolve'     => function(Schema $schema) {
197 197
                             return array_values($schema->getTypeMap());
198 198
                         },
199 199
                     ],
200 200
                     'queryType'        => [
201 201
                         'description' => 'The type that query operations will be rooted at.',
202 202
                         'type'        => new NonNull(self::_type()),
203
-                        'resolve'     => function (Schema $schema) {
203
+                        'resolve'     => function(Schema $schema) {
204 204
                             return $schema->getQueryType();
205 205
                         },
206 206
                     ],
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
                             'If this server supports mutation, the type that ' .
210 210
                             'mutation operations will be rooted at.',
211 211
                         'type'        => self::_type(),
212
-                        'resolve'     => function (Schema $schema) {
212
+                        'resolve'     => function(Schema $schema) {
213 213
                             return $schema->getMutationType();
214 214
                         },
215 215
                     ],
216 216
                     'subscriptionType' => [
217 217
                         'description' => 'If this server support subscription, the type that subscription operations will be rooted at.',
218 218
                         'type'        => self::_type(),
219
-                        'resolve'     => function (Schema $schema) {
219
+                        'resolve'     => function(Schema $schema) {
220 220
                             return $schema->getSubscriptionType();
221 221
                         },
222 222
                     ],
223 223
                     'directives'       => [
224 224
                         'description' => 'A list of all directives supported by this server.',
225 225
                         'type'        => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))),
226
-                        'resolve'     => function (Schema $schema) {
226
+                        'resolve'     => function(Schema $schema) {
227 227
                             return $schema->getDirectives();
228 228
                         },
229 229
                     ],
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
     public static function _type()
238 238
     {
239
-        if (! isset(self::$map['__Type'])) {
239
+        if (!isset(self::$map['__Type'])) {
240 240
             self::$map['__Type'] = new ObjectType([
241 241
                 'name'            => '__Type',
242 242
                 'isIntrospection' => true,
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
                     'Object and Interface types provide the fields they describe. Abstract ' .
251 251
                     'types, Union and Interface, provide the Object types possible ' .
252 252
                     'at runtime. List and NonNull types compose other types.',
253
-                'fields'          => function () {
253
+                'fields'          => function() {
254 254
                     return [
255 255
                         'kind'          => [
256 256
                             'type'    => Type::nonNull(self::_typeKind()),
257
-                            'resolve' => function (Type $type) {
257
+                            'resolve' => function(Type $type) {
258 258
                                 switch (true) {
259 259
                                     case $type instanceof ListOfType:
260 260
                                         return TypeKind::LIST_KIND;
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
                             'args'    => [
285 285
                                 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false],
286 286
                             ],
287
-                            'resolve' => function (Type $type, $args) {
287
+                            'resolve' => function(Type $type, $args) {
288 288
                                 if ($type instanceof ObjectType || $type instanceof InterfaceType) {
289 289
                                     $fields = $type->getFields();
290 290
 
291 291
                                     if (empty($args['includeDeprecated'])) {
292 292
                                         $fields = array_filter(
293 293
                                             $fields,
294
-                                            function (FieldDefinition $field) {
295
-                                                return ! $field->deprecationReason;
294
+                                            function(FieldDefinition $field) {
295
+                                                return !$field->deprecationReason;
296 296
                                             }
297 297
                                         );
298 298
                                     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         ],
306 306
                         'interfaces'    => [
307 307
                             'type'    => Type::listOf(Type::nonNull(self::_type())),
308
-                            'resolve' => function ($type) {
308
+                            'resolve' => function($type) {
309 309
                                 if ($type instanceof ObjectType) {
310 310
                                     return $type->getInterfaces();
311 311
                                 }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         ],
316 316
                         'possibleTypes' => [
317 317
                             'type'    => Type::listOf(Type::nonNull(self::_type())),
318
-                            'resolve' => function ($type, $args, $context, ResolveInfo $info) {
318
+                            'resolve' => function($type, $args, $context, ResolveInfo $info) {
319 319
                                 if ($type instanceof InterfaceType || $type instanceof UnionType) {
320 320
                                     return $info->schema->getPossibleTypes($type);
321 321
                                 }
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
                             'args'    => [
329 329
                                 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false],
330 330
                             ],
331
-                            'resolve' => function ($type, $args) {
331
+                            'resolve' => function($type, $args) {
332 332
                                 if ($type instanceof EnumType) {
333 333
                                     $values = array_values($type->getValues());
334 334
 
335 335
                                     if (empty($args['includeDeprecated'])) {
336 336
                                         $values = array_filter(
337 337
                                             $values,
338
-                                            function ($value) {
339
-                                                return ! $value->deprecationReason;
338
+                                            function($value) {
339
+                                                return !$value->deprecationReason;
340 340
                                             }
341 341
                                         );
342 342
                                     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                         ],
350 350
                         'inputFields'   => [
351 351
                             'type'    => Type::listOf(Type::nonNull(self::_inputValue())),
352
-                            'resolve' => function ($type) {
352
+                            'resolve' => function($type) {
353 353
                                 if ($type instanceof InputObjectType) {
354 354
                                     return array_values($type->getFields());
355 355
                                 }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                         ],
360 360
                         'ofType'        => [
361 361
                             'type'    => self::_type(),
362
-                            'resolve' => function ($type) {
362
+                            'resolve' => function($type) {
363 363
                                 if ($type instanceof WrappingType) {
364 364
                                     return $type->getWrappedType();
365 365
                                 }
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 
378 378
     public static function _typeKind()
379 379
     {
380
-        if (! isset(self::$map['__TypeKind'])) {
380
+        if (!isset(self::$map['__TypeKind'])) {
381 381
             self::$map['__TypeKind'] = new EnumType([
382 382
                 'name'            => '__TypeKind',
383 383
                 'isIntrospection' => true,
@@ -424,32 +424,32 @@  discard block
 block discarded – undo
424 424
 
425 425
     public static function _field()
426 426
     {
427
-        if (! isset(self::$map['__Field'])) {
427
+        if (!isset(self::$map['__Field'])) {
428 428
             self::$map['__Field'] = new ObjectType([
429 429
                 'name'            => '__Field',
430 430
                 'isIntrospection' => true,
431 431
                 'description'     =>
432 432
                     'Object and Interface types are described by a list of Fields, each of ' .
433 433
                     'which has a name, potentially a list of arguments, and a return type.',
434
-                'fields'          => function () {
434
+                'fields'          => function() {
435 435
                     return [
436 436
                         'name'              => ['type' => Type::nonNull(Type::string())],
437 437
                         'description'       => ['type' => Type::string()],
438 438
                         'args'              => [
439 439
                             'type'    => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
440
-                            'resolve' => function (FieldDefinition $field) {
440
+                            'resolve' => function(FieldDefinition $field) {
441 441
                                 return empty($field->args) ? [] : $field->args;
442 442
                             },
443 443
                         ],
444 444
                         'type'              => [
445 445
                             'type'    => Type::nonNull(self::_type()),
446
-                            'resolve' => function (FieldDefinition $field) {
446
+                            'resolve' => function(FieldDefinition $field) {
447 447
                                 return $field->getType();
448 448
                             },
449 449
                         ],
450 450
                         'isDeprecated'      => [
451 451
                             'type'    => Type::nonNull(Type::boolean()),
452
-                            'resolve' => function (FieldDefinition $field) {
452
+                            'resolve' => function(FieldDefinition $field) {
453 453
                                 return (bool) $field->deprecationReason;
454 454
                             },
455 455
                         ],
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
     public static function _inputValue()
468 468
     {
469
-        if (! isset(self::$map['__InputValue'])) {
469
+        if (!isset(self::$map['__InputValue'])) {
470 470
             self::$map['__InputValue'] = new ObjectType([
471 471
                 'name'            => '__InputValue',
472 472
                 'isIntrospection' => true,
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
                     'Arguments provided to Fields or Directives and the input fields of an ' .
475 475
                     'InputObject are represented as Input Values which describe their type ' .
476 476
                     'and optionally a default value.',
477
-                'fields'          => function () {
477
+                'fields'          => function() {
478 478
                     return [
479 479
                         'name'         => ['type' => Type::nonNull(Type::string())],
480 480
                         'description'  => ['type' => Type::string()],
481 481
                         'type'         => [
482 482
                             'type'    => Type::nonNull(self::_type()),
483
-                            'resolve' => function ($value) {
483
+                            'resolve' => function($value) {
484 484
                                 return method_exists($value, 'getType') ? $value->getType() : $value->type;
485 485
                             },
486 486
                         ],
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
                             'type'        => Type::string(),
489 489
                             'description' =>
490 490
                                 'A GraphQL-formatted string representing the default value for this input value.',
491
-                            'resolve'     => function ($inputValue) {
491
+                            'resolve'     => function($inputValue) {
492 492
                                 /** @var FieldArgument|InputObjectField $inputValue */
493
-                                return ! $inputValue->defaultValueExists()
493
+                                return !$inputValue->defaultValueExists()
494 494
                                     ? null
495 495
                                     : Printer::doPrint(AST::astFromValue(
496 496
                                         $inputValue->defaultValue,
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
     public static function _enumValue()
510 510
     {
511
-        if (! isset(self::$map['__EnumValue'])) {
511
+        if (!isset(self::$map['__EnumValue'])) {
512 512
             self::$map['__EnumValue'] = new ObjectType([
513 513
                 'name'            => '__EnumValue',
514 514
                 'isIntrospection' => true,
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                     'description'       => ['type' => Type::string()],
522 522
                     'isDeprecated'      => [
523 523
                         'type'    => Type::nonNull(Type::boolean()),
524
-                        'resolve' => function ($enumValue) {
524
+                        'resolve' => function($enumValue) {
525 525
                             return (bool) $enumValue->deprecationReason;
526 526
                         },
527 527
                     ],
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
     public static function _directive()
539 539
     {
540
-        if (! isset(self::$map['__Directive'])) {
540
+        if (!isset(self::$map['__Directive'])) {
541 541
             self::$map['__Directive'] = new ObjectType([
542 542
                 'name'            => '__Directive',
543 543
                 'isIntrospection' => true,
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                     ],
558 558
                     'args'        => [
559 559
                         'type'    => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
560
-                        'resolve' => function (Directive $directive) {
560
+                        'resolve' => function(Directive $directive) {
561 561
                             return $directive->args ?: [];
562 562
                         },
563 563
                     ],
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                     'onOperation' => [
568 568
                         'deprecationReason' => 'Use `locations`.',
569 569
                         'type'              => Type::nonNull(Type::boolean()),
570
-                        'resolve'           => function ($d) {
570
+                        'resolve'           => function($d) {
571 571
                             return in_array(DirectiveLocation::QUERY, $d->locations) ||
572 572
                                 in_array(DirectiveLocation::MUTATION, $d->locations) ||
573 573
                                 in_array(DirectiveLocation::SUBSCRIPTION, $d->locations);
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
                     'onFragment'  => [
577 577
                         'deprecationReason' => 'Use `locations`.',
578 578
                         'type'              => Type::nonNull(Type::boolean()),
579
-                        'resolve'           => function ($d) {
579
+                        'resolve'           => function($d) {
580 580
                             return in_array(DirectiveLocation::FRAGMENT_SPREAD, $d->locations) ||
581 581
                                 in_array(DirectiveLocation::INLINE_FRAGMENT, $d->locations) ||
582 582
                                 in_array(DirectiveLocation::FRAGMENT_DEFINITION, $d->locations);
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
                     'onField'     => [
586 586
                         'deprecationReason' => 'Use `locations`.',
587 587
                         'type'              => Type::nonNull(Type::boolean()),
588
-                        'resolve'           => function ($d) {
588
+                        'resolve'           => function($d) {
589 589
                             return in_array(DirectiveLocation::FIELD, $d->locations);
590 590
                         },
591 591
                     ],
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 
599 599
     public static function _directiveLocation()
600 600
     {
601
-        if (! isset(self::$map['__DirectiveLocation'])) {
601
+        if (!isset(self::$map['__DirectiveLocation'])) {
602 602
             self::$map['__DirectiveLocation'] = new EnumType([
603 603
                 'name'            => '__DirectiveLocation',
604 604
                 'isIntrospection' => true,
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
 
689 689
     public static function schemaMetaFieldDef()
690 690
     {
691
-        if (! isset(self::$map['__schema'])) {
691
+        if (!isset(self::$map['__schema'])) {
692 692
             self::$map['__schema'] = FieldDefinition::create([
693 693
                 'name'        => '__schema',
694 694
                 'type'        => Type::nonNull(self::_schema()),
695 695
                 'description' => 'Access the current type schema of this server.',
696 696
                 'args'        => [],
697
-                'resolve'     => function (
697
+                'resolve'     => function(
698 698
                     $source,
699 699
                     $args,
700 700
                     $context,
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 
711 711
     public static function typeMetaFieldDef()
712 712
     {
713
-        if (! isset(self::$map['__type'])) {
713
+        if (!isset(self::$map['__type'])) {
714 714
             self::$map['__type'] = FieldDefinition::create([
715 715
                 'name'        => '__type',
716 716
                 'type'        => self::_type(),
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
                 'args'        => [
719 719
                     ['name' => 'name', 'type' => Type::nonNull(Type::string())],
720 720
                 ],
721
-                'resolve'     => function ($source, $args, $context, ResolveInfo $info) {
721
+                'resolve'     => function($source, $args, $context, ResolveInfo $info) {
722 722
                     return $info->schema->getType($args['name']);
723 723
                 },
724 724
             ]);
@@ -729,13 +729,13 @@  discard block
 block discarded – undo
729 729
 
730 730
     public static function typeNameMetaFieldDef()
731 731
     {
732
-        if (! isset(self::$map['__typename'])) {
732
+        if (!isset(self::$map['__typename'])) {
733 733
             self::$map['__typename'] = FieldDefinition::create([
734 734
                 'name'        => '__typename',
735 735
                 'type'        => Type::nonNull(Type::string()),
736 736
                 'description' => 'The name of the current Object type at runtime.',
737 737
                 'args'        => [],
738
-                'resolve'     => function (
738
+                'resolve'     => function(
739 739
                     $source,
740 740
                     $args,
741 741
                     $context,
Please login to merge, or discard this patch.
src/Executor/Executor.php 1 patch
Spacing   +43 added lines, -45 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     private function __construct(ExecutionContext $context)
67 67
     {
68
-        if (! self::$UNDEFINED) {
68
+        if (!self::$UNDEFINED) {
69 69
             self::$UNDEFINED = Utils::undefined();
70 70
         }
71 71
 
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
         foreach ($documentNode->definitions as $definition) {
214 214
             switch ($definition->kind) {
215 215
                 case NodeKind::OPERATION_DEFINITION:
216
-                    if (! $operationName && $operation) {
216
+                    if (!$operationName && $operation) {
217 217
                         $hasMultipleAssumedOperations = true;
218 218
                     }
219
-                    if (! $operationName ||
219
+                    if (!$operationName ||
220 220
                         (isset($definition->name) && $definition->name->value === $operationName)) {
221 221
                         $operation = $definition;
222 222
                     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             }
228 228
         }
229 229
 
230
-        if (! $operation) {
230
+        if (!$operation) {
231 231
             if ($operationName) {
232 232
                 $errors[] = new Error(sprintf('Unknown operation named "%s".', $operationName));
233 233
             } else {
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     private function buildResponse($data)
304 304
     {
305 305
         if ($this->isPromise($data)) {
306
-            return $data->then(function ($resolved) {
306
+            return $data->then(function($resolved) {
307 307
                 return $this->buildResponse($resolved);
308 308
             });
309 309
         }
@@ -333,13 +333,12 @@  discard block
 block discarded – undo
333 333
         // Similar to completeValueCatchingError.
334 334
         try {
335 335
             $result = $operation->operation === 'mutation' ?
336
-                $this->executeFieldsSerially($type, $rootValue, $path, $fields) :
337
-                $this->executeFields($type, $rootValue, $path, $fields);
336
+                $this->executeFieldsSerially($type, $rootValue, $path, $fields) : $this->executeFields($type, $rootValue, $path, $fields);
338 337
 
339 338
             if ($this->isPromise($result)) {
340 339
                 return $result->then(
341 340
                     null,
342
-                    function ($error) {
341
+                    function($error) {
343 342
                         $this->exeContext->addError($error);
344 343
                         return $this->exeContext->promises->createFulfilled(null);
345 344
                     }
@@ -364,7 +363,7 @@  discard block
 block discarded – undo
364 363
         switch ($operation->operation) {
365 364
             case 'query':
366 365
                 $queryType = $schema->getQueryType();
367
-                if (! $queryType) {
366
+                if (!$queryType) {
368 367
                     throw new Error(
369 368
                         'Schema does not define the required query root type.',
370 369
                         [$operation]
@@ -374,7 +373,7 @@  discard block
 block discarded – undo
374 373
                 return $queryType;
375 374
             case 'mutation':
376 375
                 $mutationType = $schema->getMutationType();
377
-                if (! $mutationType) {
376
+                if (!$mutationType) {
378 377
                     throw new Error(
379 378
                         'Schema is not configured for mutations.',
380 379
                         [$operation]
@@ -384,7 +383,7 @@  discard block
 block discarded – undo
384 383
                 return $mutationType;
385 384
             case 'subscription':
386 385
                 $subscriptionType = $schema->getSubscriptionType();
387
-                if (! $subscriptionType) {
386
+                if (!$subscriptionType) {
388 387
                     throw new Error(
389 388
                         'Schema is not configured for subscriptions.',
390 389
                         [$operation]
@@ -423,18 +422,18 @@  discard block
 block discarded – undo
423 422
         foreach ($selectionSet->selections as $selection) {
424 423
             switch ($selection->kind) {
425 424
                 case NodeKind::FIELD:
426
-                    if (! $this->shouldIncludeNode($selection)) {
425
+                    if (!$this->shouldIncludeNode($selection)) {
427 426
                         break;
428 427
                     }
429 428
                     $name = self::getFieldEntryKey($selection);
430
-                    if (! isset($fields[$name])) {
429
+                    if (!isset($fields[$name])) {
431 430
                         $fields[$name] = new \ArrayObject();
432 431
                     }
433 432
                     $fields[$name][] = $selection;
434 433
                     break;
435 434
                 case NodeKind::INLINE_FRAGMENT:
436
-                    if (! $this->shouldIncludeNode($selection) ||
437
-                        ! $this->doesFragmentConditionMatch($selection, $runtimeType)
435
+                    if (!$this->shouldIncludeNode($selection) ||
436
+                        !$this->doesFragmentConditionMatch($selection, $runtimeType)
438 437
                     ) {
439 438
                         break;
440 439
                     }
@@ -447,14 +446,14 @@  discard block
 block discarded – undo
447 446
                     break;
448 447
                 case NodeKind::FRAGMENT_SPREAD:
449 448
                     $fragName = $selection->name->value;
450
-                    if (! empty($visitedFragmentNames[$fragName]) || ! $this->shouldIncludeNode($selection)) {
449
+                    if (!empty($visitedFragmentNames[$fragName]) || !$this->shouldIncludeNode($selection)) {
451 450
                         break;
452 451
                     }
453 452
                     $visitedFragmentNames[$fragName] = true;
454 453
 
455 454
                     /** @var FragmentDefinitionNode|null $fragment */
456 455
                     $fragment = $exeContext->fragments[$fragName] ?? null;
457
-                    if (! $fragment || ! $this->doesFragmentConditionMatch($fragment, $runtimeType)) {
456
+                    if (!$fragment || !$this->doesFragmentConditionMatch($fragment, $runtimeType)) {
458 457
                         break;
459 458
                     }
460 459
                     $this->collectFields(
@@ -557,7 +556,7 @@  discard block
 block discarded – undo
557 556
     {
558 557
         $result = $this->promiseReduce(
559 558
             array_keys($fields->getArrayCopy()),
560
-            function ($results, $responseName) use ($path, $parentType, $sourceValue, $fields) {
559
+            function($results, $responseName) use ($path, $parentType, $sourceValue, $fields) {
561 560
                 $fieldNodes  = $fields[$responseName];
562 561
                 $fieldPath   = $path;
563 562
                 $fieldPath[] = $responseName;
@@ -567,7 +566,7 @@  discard block
 block discarded – undo
567 566
                 }
568 567
                 $promise = $this->getPromise($result);
569 568
                 if ($promise) {
570
-                    return $promise->then(function ($resolvedResult) use ($responseName, $results) {
569
+                    return $promise->then(function($resolvedResult) use ($responseName, $results) {
571 570
                         $results[$responseName] = $resolvedResult;
572 571
                         return $results;
573 572
                     });
@@ -578,7 +577,7 @@  discard block
 block discarded – undo
578 577
             []
579 578
         );
580 579
         if ($this->isPromise($result)) {
581
-            return $result->then(function ($resolvedResults) {
580
+            return $result->then(function($resolvedResults) {
582 581
                 return self::fixResultsIfEmptyArray($resolvedResults);
583 582
             });
584 583
         }
@@ -605,7 +604,7 @@  discard block
 block discarded – undo
605 604
         $fieldName = $fieldNode->name->value;
606 605
         $fieldDef  = $this->getFieldDef($exeContext->schema, $parentType, $fieldName);
607 606
 
608
-        if (! $fieldDef) {
607
+        if (!$fieldDef) {
609 608
             return self::$UNDEFINED;
610 609
         }
611 610
 
@@ -771,7 +770,7 @@  discard block
 block discarded – undo
771 770
             if ($promise) {
772 771
                 return $promise->then(
773 772
                     null,
774
-                    function ($error) use ($exeContext) {
773
+                    function($error) use ($exeContext) {
775 774
                         $exeContext->addError($error);
776 775
 
777 776
                         return $this->exeContext->promises->createFulfilled(null);
@@ -814,11 +813,11 @@  discard block
 block discarded – undo
814 813
                 $path,
815 814
                 $result
816 815
             );
817
-            $promise   = $this->getPromise($completed);
816
+            $promise = $this->getPromise($completed);
818 817
             if ($promise) {
819 818
                 return $promise->then(
820 819
                     null,
821
-                    function ($error) use ($fieldNodes, $path) {
820
+                    function($error) use ($fieldNodes, $path) {
822 821
                         return $this->exeContext->promises->createRejected(Error::createLocatedError(
823 822
                             $error,
824 823
                             $fieldNodes,
@@ -875,7 +874,7 @@  discard block
 block discarded – undo
875 874
 
876 875
         // If result is a Promise, apply-lift over completeValue.
877 876
         if ($promise) {
878
-            return $promise->then(function (&$resolved) use ($returnType, $fieldNodes, $info, $path) {
877
+            return $promise->then(function(&$resolved) use ($returnType, $fieldNodes, $info, $path) {
879 878
                 return $this->completeValue($returnType, $fieldNodes, $info, $path, $resolved);
880 879
             });
881 880
         }
@@ -975,7 +974,7 @@  discard block
 block discarded – undo
975 974
         }
976 975
         if ($this->exeContext->promises->isThenable($value)) {
977 976
             $promise = $this->exeContext->promises->convertThenable($value);
978
-            if (! $promise instanceof Promise) {
977
+            if (!$promise instanceof Promise) {
979 978
                 throw new InvariantViolation(sprintf(
980 979
                     '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s',
981 980
                     get_class($this->exeContext->promises),
@@ -1002,10 +1001,10 @@  discard block
 block discarded – undo
1002 1001
      */
1003 1002
     private function promiseReduce(array $values, \Closure $callback, $initialValue)
1004 1003
     {
1005
-        return array_reduce($values, function ($previous, $value) use ($callback) {
1004
+        return array_reduce($values, function($previous, $value) use ($callback) {
1006 1005
             $promise = $this->getPromise($previous);
1007 1006
             if ($promise) {
1008
-                return $promise->then(function ($resolved) use ($callback, $value) {
1007
+                return $promise->then(function($resolved) use ($callback, $value) {
1009 1008
                     return $callback($resolved, $value);
1010 1009
                 });
1011 1010
             }
@@ -1038,7 +1037,7 @@  discard block
 block discarded – undo
1038 1037
             $fieldPath     = $path;
1039 1038
             $fieldPath[]   = $i++;
1040 1039
             $completedItem = $this->completeValueCatchingError($itemType, $fieldNodes, $info, $fieldPath, $item);
1041
-            if (! $containsPromise && $this->getPromise($completedItem)) {
1040
+            if (!$containsPromise && $this->getPromise($completedItem)) {
1042 1041
                 $containsPromise = true;
1043 1042
             }
1044 1043
             $completedItems[] = $completedItem;
@@ -1094,7 +1093,7 @@  discard block
 block discarded – undo
1094 1093
 
1095 1094
         $promise = $this->getPromise($runtimeType);
1096 1095
         if ($promise) {
1097
-            return $promise->then(function ($resolvedRuntimeType) use (
1096
+            return $promise->then(function($resolvedRuntimeType) use (
1098 1097
                 $returnType,
1099 1098
                 $fieldNodes,
1100 1099
                 $info,
@@ -1188,9 +1187,9 @@  discard block
 block discarded – undo
1188 1187
             }
1189 1188
         }
1190 1189
 
1191
-        if (! empty($promisedIsTypeOfResults)) {
1190
+        if (!empty($promisedIsTypeOfResults)) {
1192 1191
             return $this->exeContext->promises->all($promisedIsTypeOfResults)
1193
-                ->then(function ($isTypeOfResults) use ($possibleTypes) {
1192
+                ->then(function($isTypeOfResults) use ($possibleTypes) {
1194 1193
                     foreach ($isTypeOfResults as $index => $result) {
1195 1194
                         if ($result) {
1196 1195
                             return $possibleTypes[$index];
@@ -1223,14 +1222,14 @@  discard block
 block discarded – undo
1223 1222
         if ($isTypeOf !== null) {
1224 1223
             $promise = $this->getPromise($isTypeOf);
1225 1224
             if ($promise) {
1226
-                return $promise->then(function ($isTypeOfResult) use (
1225
+                return $promise->then(function($isTypeOfResult) use (
1227 1226
                     $returnType,
1228 1227
                     $fieldNodes,
1229 1228
                     $info,
1230 1229
                     $path,
1231 1230
                     &$result
1232 1231
                 ) {
1233
-                    if (! $isTypeOfResult) {
1232
+                    if (!$isTypeOfResult) {
1234 1233
                         throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes);
1235 1234
                     }
1236 1235
 
@@ -1243,7 +1242,7 @@  discard block
 block discarded – undo
1243 1242
                     );
1244 1243
                 });
1245 1244
             }
1246
-            if (! $isTypeOf) {
1245
+            if (!$isTypeOf) {
1247 1246
                 throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes);
1248 1247
             }
1249 1248
         }
@@ -1293,16 +1292,16 @@  discard block
 block discarded – undo
1293 1292
 
1294 1293
     private function collectSubFields(ObjectType $returnType, $fieldNodes) : ArrayObject
1295 1294
     {
1296
-        if (! isset($this->subFieldCache[$returnType])) {
1295
+        if (!isset($this->subFieldCache[$returnType])) {
1297 1296
             $this->subFieldCache[$returnType] = new \SplObjectStorage();
1298 1297
         }
1299
-        if (! isset($this->subFieldCache[$returnType][$fieldNodes])) {
1298
+        if (!isset($this->subFieldCache[$returnType][$fieldNodes])) {
1300 1299
             // Collect sub-fields to execute to complete this value.
1301 1300
             $subFieldNodes        = new \ArrayObject();
1302 1301
             $visitedFragmentNames = new \ArrayObject();
1303 1302
 
1304 1303
             foreach ($fieldNodes as $fieldNode) {
1305
-                if (! isset($fieldNode->selectionSet)) {
1304
+                if (!isset($fieldNode->selectionSet)) {
1306 1305
                     continue;
1307 1306
                 }
1308 1307
 
@@ -1339,14 +1338,14 @@  discard block
 block discarded – undo
1339 1338
             if ($result === self::$UNDEFINED) {
1340 1339
                 continue;
1341 1340
             }
1342
-            if (! $containsPromise && $this->getPromise($result)) {
1341
+            if (!$containsPromise && $this->getPromise($result)) {
1343 1342
                 $containsPromise = true;
1344 1343
             }
1345 1344
             $finalResults[$responseName] = $result;
1346 1345
         }
1347 1346
 
1348 1347
         // If there are no promises, we can just return the object
1349
-        if (! $containsPromise) {
1348
+        if (!$containsPromise) {
1350 1349
             return self::fixResultsIfEmptyArray($finalResults);
1351 1350
         }
1352 1351
 
@@ -1389,7 +1388,7 @@  discard block
 block discarded – undo
1389 1388
 
1390 1389
         $promise = $this->exeContext->promises->all($valuesAndPromises);
1391 1390
 
1392
-        return $promise->then(function ($values) use ($keys) {
1391
+        return $promise->then(function($values) use ($keys) {
1393 1392
             $resolvedResults = [];
1394 1393
             foreach ($values as $i => $value) {
1395 1394
                 $resolvedResults[$keys[$i]] = $value;
@@ -1412,10 +1411,9 @@  discard block
 block discarded – undo
1412 1411
         &$result
1413 1412
     ) {
1414 1413
         $runtimeType = is_string($runtimeTypeOrName) ?
1415
-            $this->exeContext->schema->getType($runtimeTypeOrName) :
1416
-            $runtimeTypeOrName;
1414
+            $this->exeContext->schema->getType($runtimeTypeOrName) : $runtimeTypeOrName;
1417 1415
 
1418
-        if (! $runtimeType instanceof ObjectType) {
1416
+        if (!$runtimeType instanceof ObjectType) {
1419 1417
             throw new InvariantViolation(
1420 1418
                 sprintf(
1421 1419
                     'Abstract type %s must resolve to an Object type at ' .
@@ -1432,7 +1430,7 @@  discard block
 block discarded – undo
1432 1430
             );
1433 1431
         }
1434 1432
 
1435
-        if (! $this->exeContext->schema->isPossibleType($returnType, $runtimeType)) {
1433
+        if (!$this->exeContext->schema->isPossibleType($returnType, $runtimeType)) {
1436 1434
             throw new InvariantViolation(
1437 1435
                 sprintf('Runtime Object type "%s" is not a possible type for "%s".', $runtimeType, $returnType)
1438 1436
             );
Please login to merge, or discard this patch.
src/Language/Printer.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
             $ast,
95 95
             [
96 96
                 'leave' => [
97
-                    NodeKind::NAME => function (Node $node) {
97
+                    NodeKind::NAME => function(Node $node) {
98 98
                         return '' . $node->value;
99 99
                     },
100 100
 
101
-                    NodeKind::VARIABLE => function ($node) {
101
+                    NodeKind::VARIABLE => function($node) {
102 102
                         return '$' . $node->name;
103 103
                     },
104 104
 
105
-                    NodeKind::DOCUMENT => function (DocumentNode $node) {
105
+                    NodeKind::DOCUMENT => function(DocumentNode $node) {
106 106
                         return $this->join($node->definitions, "\n\n") . "\n";
107 107
                     },
108 108
 
109
-                    NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) {
109
+                    NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) {
110 110
                         $op           = $node->operation;
111 111
                         $name         = $node->name;
112 112
                         $varDefs      = $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')');
@@ -114,20 +114,20 @@  discard block
 block discarded – undo
114 114
                         $selectionSet = $node->selectionSet;
115 115
                         // Anonymous queries with no directives or variable definitions can use
116 116
                         // the query short form.
117
-                        return ! $name && ! $directives && ! $varDefs && $op === 'query'
117
+                        return !$name && !$directives && !$varDefs && $op === 'query'
118 118
                             ? $selectionSet
119 119
                             : $this->join([$op, $this->join([$name, $varDefs]), $directives, $selectionSet], ' ');
120 120
                     },
121 121
 
122
-                    NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) {
122
+                    NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) {
123 123
                         return $node->variable . ': ' . $node->type . $this->wrap(' = ', $node->defaultValue);
124 124
                     },
125 125
 
126
-                    NodeKind::SELECTION_SET => function (SelectionSetNode $node) {
126
+                    NodeKind::SELECTION_SET => function(SelectionSetNode $node) {
127 127
                         return $this->block($node->selections);
128 128
                     },
129 129
 
130
-                    NodeKind::FIELD => function (FieldNode $node) {
130
+                    NodeKind::FIELD => function(FieldNode $node) {
131 131
                         return $this->join(
132 132
                             [
133 133
                                 $this->wrap('', $node->alias, ': ') . $node->name . $this->wrap(
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
                         );
143 143
                     },
144 144
 
145
-                    NodeKind::ARGUMENT => function (ArgumentNode $node) {
145
+                    NodeKind::ARGUMENT => function(ArgumentNode $node) {
146 146
                         return $node->name . ': ' . $node->value;
147 147
                     },
148 148
 
149
-                    NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) {
149
+                    NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) {
150 150
                         return '...' . $node->name . $this->wrap(' ', $this->join($node->directives, ' '));
151 151
                     },
152 152
 
153
-                    NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) {
153
+                    NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) {
154 154
                         return $this->join(
155 155
                             [
156 156
                                 '...',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                         );
163 163
                     },
164 164
 
165
-                    NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) {
165
+                    NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) {
166 166
                         // Note: fragment variable definitions are experimental and may be changed or removed in the future.
167 167
                         return sprintf('fragment %s', $node->name)
168 168
                             . $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')')
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
                             . $node->selectionSet;
172 172
                     },
173 173
 
174
-                    NodeKind::INT => function (IntValueNode $node) {
174
+                    NodeKind::INT => function(IntValueNode $node) {
175 175
                         return $node->value;
176 176
                     },
177 177
 
178
-                    NodeKind::FLOAT => function (FloatValueNode $node) {
178
+                    NodeKind::FLOAT => function(FloatValueNode $node) {
179 179
                         return $node->value;
180 180
                     },
181 181
 
182
-                    NodeKind::STRING => function (StringValueNode $node, $key) {
182
+                    NodeKind::STRING => function(StringValueNode $node, $key) {
183 183
                         if ($node->block) {
184 184
                             return $this->printBlockString($node->value, $key === 'description');
185 185
                         }
@@ -187,47 +187,47 @@  discard block
 block discarded – undo
187 187
                         return json_encode($node->value);
188 188
                     },
189 189
 
190
-                    NodeKind::BOOLEAN => function (BooleanValueNode $node) {
190
+                    NodeKind::BOOLEAN => function(BooleanValueNode $node) {
191 191
                         return $node->value ? 'true' : 'false';
192 192
                     },
193 193
 
194
-                    NodeKind::NULL => function (NullValueNode $node) {
194
+                    NodeKind::NULL => function(NullValueNode $node) {
195 195
                         return 'null';
196 196
                     },
197 197
 
198
-                    NodeKind::ENUM => function (EnumValueNode $node) {
198
+                    NodeKind::ENUM => function(EnumValueNode $node) {
199 199
                         return $node->value;
200 200
                     },
201 201
 
202
-                    NodeKind::LST => function (ListValueNode $node) {
202
+                    NodeKind::LST => function(ListValueNode $node) {
203 203
                         return '[' . $this->join($node->values, ', ') . ']';
204 204
                     },
205 205
 
206
-                    NodeKind::OBJECT => function (ObjectValueNode $node) {
206
+                    NodeKind::OBJECT => function(ObjectValueNode $node) {
207 207
                         return '{' . $this->join($node->fields, ', ') . '}';
208 208
                     },
209 209
 
210
-                    NodeKind::OBJECT_FIELD => function (ObjectFieldNode $node) {
210
+                    NodeKind::OBJECT_FIELD => function(ObjectFieldNode $node) {
211 211
                         return $node->name . ': ' . $node->value;
212 212
                     },
213 213
 
214
-                    NodeKind::DIRECTIVE => function (DirectiveNode $node) {
214
+                    NodeKind::DIRECTIVE => function(DirectiveNode $node) {
215 215
                         return '@' . $node->name . $this->wrap('(', $this->join($node->arguments, ', '), ')');
216 216
                     },
217 217
 
218
-                    NodeKind::NAMED_TYPE => function (NamedTypeNode $node) {
218
+                    NodeKind::NAMED_TYPE => function(NamedTypeNode $node) {
219 219
                         return $node->name;
220 220
                     },
221 221
 
222
-                    NodeKind::LIST_TYPE => function (ListTypeNode $node) {
222
+                    NodeKind::LIST_TYPE => function(ListTypeNode $node) {
223 223
                         return '[' . $node->type . ']';
224 224
                     },
225 225
 
226
-                    NodeKind::NON_NULL_TYPE => function (NonNullTypeNode $node) {
226
+                    NodeKind::NON_NULL_TYPE => function(NonNullTypeNode $node) {
227 227
                         return $node->type . '!';
228 228
                     },
229 229
 
230
-                    NodeKind::SCHEMA_DEFINITION => function (SchemaDefinitionNode $def) {
230
+                    NodeKind::SCHEMA_DEFINITION => function(SchemaDefinitionNode $def) {
231 231
                         return $this->join(
232 232
                             [
233 233
                                 'schema',
@@ -238,15 +238,15 @@  discard block
 block discarded – undo
238 238
                         );
239 239
                     },
240 240
 
241
-                    NodeKind::OPERATION_TYPE_DEFINITION => function (OperationTypeDefinitionNode $def) {
241
+                    NodeKind::OPERATION_TYPE_DEFINITION => function(OperationTypeDefinitionNode $def) {
242 242
                         return $def->operation . ': ' . $def->type;
243 243
                     },
244 244
 
245
-                    NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function (ScalarTypeDefinitionNode $def) {
245
+                    NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function(ScalarTypeDefinitionNode $def) {
246 246
                         return $this->join(['scalar', $def->name, $this->join($def->directives, ' ')], ' ');
247 247
                     }),
248 248
 
249
-                    NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function (ObjectTypeDefinitionNode $def) {
249
+                    NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function(ObjectTypeDefinitionNode $def) {
250 250
                         return $this->join(
251 251
                             [
252 252
                                 'type',
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
                         );
260 260
                     }),
261 261
 
262
-                    NodeKind::FIELD_DEFINITION => $this->addDescription(function (FieldDefinitionNode $def) {
262
+                    NodeKind::FIELD_DEFINITION => $this->addDescription(function(FieldDefinitionNode $def) {
263 263
                         return $def->name
264 264
                             . $this->wrap('(', $this->join($def->arguments, ', '), ')')
265 265
                             . ': ' . $def->type
266 266
                             . $this->wrap(' ', $this->join($def->directives, ' '));
267 267
                     }),
268 268
 
269
-                    NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function (InputValueDefinitionNode $def) {
269
+                    NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function(InputValueDefinitionNode $def) {
270 270
                         return $this->join(
271 271
                             [
272 272
                                 $def->name . ': ' . $def->type,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                     }),
279 279
 
280 280
                     NodeKind::INTERFACE_TYPE_DEFINITION => $this->addDescription(
281
-                        function (InterfaceTypeDefinitionNode $def) {
281
+                        function(InterfaceTypeDefinitionNode $def) {
282 282
                             return $this->join(
283 283
                                 [
284 284
                                     'interface',
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                         }
292 292
                     ),
293 293
 
294
-                    NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function (UnionTypeDefinitionNode $def) {
294
+                    NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function(UnionTypeDefinitionNode $def) {
295 295
                         return $this->join(
296 296
                             [
297 297
                                 'union',
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         );
306 306
                     }),
307 307
 
308
-                    NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function (EnumTypeDefinitionNode $def) {
308
+                    NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function(EnumTypeDefinitionNode $def) {
309 309
                         return $this->join(
310 310
                             [
311 311
                                 'enum',
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
                         );
318 318
                     }),
319 319
 
320
-                    NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function (EnumValueDefinitionNode $def) {
320
+                    NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function(EnumValueDefinitionNode $def) {
321 321
                         return $this->join([$def->name, $this->join($def->directives, ' ')], ' ');
322 322
                     }),
323 323
 
324
-                    NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function (
324
+                    NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function(
325 325
                         InputObjectTypeDefinitionNode $def
326 326
                     ) {
327 327
                         return $this->join(
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                         );
336 336
                     }),
337 337
 
338
-                    NodeKind::SCALAR_TYPE_EXTENSION => function (ScalarTypeExtensionNode $def) {
338
+                    NodeKind::SCALAR_TYPE_EXTENSION => function(ScalarTypeExtensionNode $def) {
339 339
                         return $this->join(
340 340
                             [
341 341
                                 'extend scalar',
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                         );
347 347
                     },
348 348
 
349
-                    NodeKind::OBJECT_TYPE_EXTENSION => function (ObjectTypeExtensionNode $def) {
349
+                    NodeKind::OBJECT_TYPE_EXTENSION => function(ObjectTypeExtensionNode $def) {
350 350
                         return $this->join(
351 351
                             [
352 352
                                 'extend type',
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                         );
360 360
                     },
361 361
 
362
-                    NodeKind::INTERFACE_TYPE_EXTENSION => function (InterfaceTypeExtensionNode $def) {
362
+                    NodeKind::INTERFACE_TYPE_EXTENSION => function(InterfaceTypeExtensionNode $def) {
363 363
                         return $this->join(
364 364
                             [
365 365
                                 'extend interface',
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                         );
372 372
                     },
373 373
 
374
-                    NodeKind::UNION_TYPE_EXTENSION => function (UnionTypeExtensionNode $def) {
374
+                    NodeKind::UNION_TYPE_EXTENSION => function(UnionTypeExtensionNode $def) {
375 375
                         return $this->join(
376 376
                             [
377 377
                                 'extend union',
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                         );
386 386
                     },
387 387
 
388
-                    NodeKind::ENUM_TYPE_EXTENSION => function (EnumTypeExtensionNode $def) {
388
+                    NodeKind::ENUM_TYPE_EXTENSION => function(EnumTypeExtensionNode $def) {
389 389
                         return $this->join(
390 390
                             [
391 391
                                 'extend enum',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                         );
398 398
                     },
399 399
 
400
-                    NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function (InputObjectTypeExtensionNode $def) {
400
+                    NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function(InputObjectTypeExtensionNode $def) {
401 401
                         return $this->join(
402 402
                             [
403 403
                                 'extend input',
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                         );
410 410
                     },
411 411
 
412
-                    NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function (DirectiveDefinitionNode $def) {
412
+                    NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function(DirectiveDefinitionNode $def) {
413 413
                         return 'directive @'
414 414
                             . $def->name
415 415
                             . $this->wrap('(', $this->join($def->arguments, ', '), ')')
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
     public function addDescription(\Closure $cb)
424 424
     {
425
-        return function ($node) use ($cb) {
425
+        return function($node) use ($cb) {
426 426
             return $this->join([$node->description, $cb($node)], "\n");
427 427
         };
428 428
     }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                 $separator,
470 470
                 Utils::filter(
471 471
                     $maybeArray,
472
-                    function ($x) {
472
+                    function($x) {
473 473
                         return (bool) $x;
474 474
                     }
475 475
                 )
Please login to merge, or discard this patch.
src/Language/Visitor.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $isEdited  = $isLeaving && count($edits) !== 0;
202 202
 
203 203
             if ($isLeaving) {
204
-                $key    = ! $ancestors ? $UNDEFINED : $path[count($path) - 1];
204
+                $key    = !$ancestors ? $UNDEFINED : $path[count($path) - 1];
205 205
                 $node   = $parent;
206 206
                 $parent = array_pop($ancestors);
207 207
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
             }
256 256
 
257 257
             $result = null;
258
-            if (! $node instanceof NodeList && ! is_array($node)) {
259
-                if (! ($node instanceof Node)) {
258
+            if (!$node instanceof NodeList && !is_array($node)) {
259
+                if (!($node instanceof Node)) {
260 260
                     throw new \Exception('Invalid AST Node: ' . json_encode($node));
261 261
                 }
262 262
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                             if ($result->doBreak) {
272 272
                                 break;
273 273
                             }
274
-                            if (! $isLeaving && $result->doContinue) {
274
+                            if (!$isLeaving && $result->doContinue) {
275 275
                                 array_pop($path);
276 276
                                 continue;
277 277
                             }
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
                         }
284 284
 
285 285
                         $edits[] = [$key, $editValue];
286
-                        if (! $isLeaving) {
287
-                            if (! ($editValue instanceof Node)) {
286
+                        if (!$isLeaving) {
287
+                            if (!($editValue instanceof Node)) {
288 288
                                 array_pop($path);
289 289
                                 continue;
290 290
                             }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             if ($isLeaving) {
303 303
                 array_pop($path);
304 304
             } else {
305
-                $stack   = [
305
+                $stack = [
306 306
                     'inArray' => $inArray,
307 307
                     'index'   => $index,
308 308
                     'keys'    => $keys,
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
         $skipping      = new \SplFixedArray($visitorsCount);
381 381
 
382 382
         return [
383
-            'enter' => function (Node $node) use ($visitors, $skipping, $visitorsCount) {
383
+            'enter' => function(Node $node) use ($visitors, $skipping, $visitorsCount) {
384 384
                 for ($i = 0; $i < $visitorsCount; $i++) {
385
-                    if (! empty($skipping[$i])) {
385
+                    if (!empty($skipping[$i])) {
386 386
                         continue;
387 387
                     }
388 388
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                         false
393 393
                     );
394 394
 
395
-                    if (! $fn) {
395
+                    if (!$fn) {
396 396
                         continue;
397 397
                     }
398 398
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                     }
412 412
                 }
413 413
             },
414
-            'leave' => function (Node $node) use ($visitors, $skipping, $visitorsCount) {
414
+            'leave' => function(Node $node) use ($visitors, $skipping, $visitorsCount) {
415 415
                 for ($i = 0; $i < $visitorsCount; $i++) {
416 416
                     if (empty($skipping[$i])) {
417 417
                         $fn = self::getVisitFn(
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor)
448 448
     {
449 449
         return [
450
-            'enter' => function (Node $node) use ($typeInfo, $visitor) {
450
+            'enter' => function(Node $node) use ($typeInfo, $visitor) {
451 451
                 $typeInfo->enter($node);
452 452
                 $fn = self::getVisitFn($visitor, $node->getKind(), false);
453 453
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
                 return null;
467 467
             },
468
-            'leave' => function (Node $node) use ($typeInfo, $visitor) {
468
+            'leave' => function(Node $node) use ($typeInfo, $visitor) {
469 469
                 $fn     = self::getVisitFn($visitor, $node->getKind(), true);
470 470
                 $result = $fn ? call_user_func_array($fn, func_get_args()) : null;
471 471
                 $typeInfo->leave($node);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 
490 490
         $kindVisitor = $visitor[$kind] ?? null;
491 491
 
492
-        if (! $isLeaving && is_callable($kindVisitor)) {
492
+        if (!$isLeaving && is_callable($kindVisitor)) {
493 493
             // { Kind() {} }
494 494
             return $kindVisitor;
495 495
         }
Please login to merge, or discard this patch.
src/Utils/ASTDefinitionBuilder.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'description' => $this->getDescription($directiveNode),
83 83
             'locations'   => Utils::map(
84 84
                 $directiveNode->locations,
85
-                function ($node) {
85
+                function($node) {
86 86
                     return $node->value;
87 87
                 }
88 88
             ),
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     private function getLeadingCommentBlock($node)
113 113
     {
114 114
         $loc = $node->loc;
115
-        if (! $loc || ! $loc->startToken) {
115
+        if (!$loc || !$loc->startToken) {
116 116
             return null;
117 117
         }
118 118
         $comments = [];
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
     {
136 136
         return Utils::keyValMap(
137 137
             $values,
138
-            function ($value) {
138
+            function($value) {
139 139
                 return $value->name->value;
140 140
             },
141
-            function ($value) {
141
+            function($value) {
142 142
                 // Note: While this could make assertions to get the correctly typed
143 143
                 // value, that would throw immediately while type system validation
144 144
                 // with validateSchema() will produce more actionable results.
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     private function internalBuildType($typeName, $typeNode = null)
193 193
     {
194
-        if (! isset($this->cache[$typeName])) {
194
+        if (!isset($this->cache[$typeName])) {
195 195
             if (isset($this->typeDefintionsMap[$typeName])) {
196 196
                 $type = $this->makeSchemaDef($this->typeDefintionsMap[$typeName]);
197 197
                 if ($this->typeConfigDecorator) {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                             $e
210 210
                         );
211 211
                     }
212
-                    if (! is_array($config) || isset($config[0])) {
212
+                    if (!is_array($config) || isset($config[0])) {
213 213
                         throw new Error(
214 214
                             sprintf(
215 215
                                 'Type config decorator passed to %s is expected to return an array, but got %s',
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     private function makeSchemaDef($def)
239 239
     {
240
-        if (! $def) {
240
+        if (!$def) {
241 241
             throw new Error('def must be defined.');
242 242
         }
243 243
         switch ($def->getKind()) {
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
         return new ObjectType([
266 266
             'name'        => $typeName,
267 267
             'description' => $this->getDescription($def),
268
-            'fields'      => function () use ($def) {
268
+            'fields'      => function() use ($def) {
269 269
                 return $this->makeFieldDefMap($def);
270 270
             },
271
-            'interfaces'  => function () use ($def) {
271
+            'interfaces'  => function() use ($def) {
272 272
                 return $this->makeImplementedInterfaces($def);
273 273
             },
274 274
             'astNode'     => $def,
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
         return $def->fields
281 281
             ? Utils::keyValMap(
282 282
                 $def->fields,
283
-                function ($field) {
283
+                function($field) {
284 284
                     return $field->name->value;
285 285
                 },
286
-                function ($field) {
286
+                function($field) {
287 287
                     return $this->buildField($field);
288 288
                 }
289 289
             )
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             // validation with validateSchema() will produce more actionable results.
327 327
             return Utils::map(
328 328
                 $def->interfaces,
329
-                function ($iface) {
329
+                function($iface) {
330 330
                     return $this->buildType($iface);
331 331
                 }
332 332
             );
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
         return new InterfaceType([
343 343
             'name'        => $typeName,
344 344
             'description' => $this->getDescription($def),
345
-            'fields'      => function () use ($def) {
345
+            'fields'      => function() use ($def) {
346 346
                 return $this->makeFieldDefMap($def);
347 347
             },
348 348
             'astNode'     => $def,
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
             'values'      => $def->values
358 358
                 ? Utils::keyValMap(
359 359
                     $def->values,
360
-                    function ($enumValue) {
360
+                    function($enumValue) {
361 361
                         return $enumValue->name->value;
362 362
                     },
363
-                    function ($enumValue) {
363
+                    function($enumValue) {
364 364
                         return [
365 365
                             'description'       => $this->getDescription($enumValue),
366 366
                             'deprecationReason' => $this->getDeprecationReason($enumValue),
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             'types'       => $def->types
385 385
                 ? Utils::map(
386 386
                     $def->types,
387
-                    function ($typeNode) {
387
+                    function($typeNode) {
388 388
                         return $this->buildType($typeNode);
389 389
                     }
390 390
                 ) :
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             'name'        => $def->name->value,
400 400
             'description' => $this->getDescription($def),
401 401
             'astNode'     => $def,
402
-            'serialize'   => function ($value) {
402
+            'serialize'   => function($value) {
403 403
                 return $value;
404 404
             },
405 405
         ]);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         return new InputObjectType([
411 411
             'name'        => $def->name->value,
412 412
             'description' => $this->getDescription($def),
413
-            'fields'      => function () use ($def) {
413
+            'fields'      => function() use ($def) {
414 414
                 return $def->fields
415 415
                     ? $this->makeInputValues($def->fields)
416 416
                     : [];
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      */
428 428
     private function makeSchemaDefFromConfig($def, array $config)
429 429
     {
430
-        if (! $def) {
430
+        if (!$def) {
431 431
             throw new Error('def must be defined.');
432 432
         }
433 433
         switch ($def->getKind()) {
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
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     public static function runQueue()
26 26
     {
27 27
         $q = self::$queue;
28
-        while ($q && ! $q->isEmpty()) {
28
+        while ($q && !$q->isEmpty()) {
29 29
             /** @var self $dfd */
30 30
             $dfd = $q->dequeue();
31 31
             $dfd->run();
Please login to merge, or discard this patch.
src/GraphQL.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 $queryComplexity->setRawVariableValues($variableValues);
135 135
             } else {
136 136
                 foreach ($validationRules as $rule) {
137
-                    if (! ($rule instanceof QueryComplexity)) {
137
+                    if (!($rule instanceof QueryComplexity)) {
138 138
                         continue;
139 139
                     }
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
             $validationErrors = DocumentValidator::validate($schema, $documentNode, $validationRules);
146 146
 
147
-            if (! empty($validationErrors)) {
147
+            if (!empty($validationErrors)) {
148 148
                 return $promiseAdapter->createFulfilled(
149 149
                     new ExecutionResult(null, $validationErrors)
150 150
                 );
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         if ($promiseAdapter instanceof SyncPromiseAdapter) {
204 204
             $result = $promiseAdapter->wait($result)->toArray();
205 205
         } else {
206
-            $result = $result->then(function (ExecutionResult $r) {
206
+            $result = $result->then(function(ExecutionResult $r) {
207 207
                 return $r->toArray();
208 208
             });
209 209
         }
Please login to merge, or discard this patch.