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 query-batch (6bd0d3)
by Šimon
03:56
created
src/Type/Definition/StringType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             || (is_object($value) && method_exists($value, '__toString'))
39 39
             || $value === null;
40 40
 
41
-        if (! $canCast) {
41
+        if (!$canCast) {
42 42
             throw new Error(
43 43
                 'String cannot represent value: ' . Utils::printSafe($value)
44 44
             );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function parseValue($value)
58 58
     {
59
-        if (! is_string($value)) {
59
+        if (!is_string($value)) {
60 60
             throw new Error(
61 61
                 'String cannot represent a non string value: ' . Utils::printSafe($value)
62 62
             );
Please login to merge, or discard this patch.
src/Type/Definition/ObjectType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function __construct(array $config)
81 81
     {
82
-        if (! isset($config['name'])) {
82
+        if (!isset($config['name'])) {
83 83
             $config['name'] = $this->tryInferName();
84 84
         }
85 85
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                 ? call_user_func($interfaces)
190 190
                 : $interfaces;
191 191
 
192
-            if ($interfaces !== null && ! is_array($interfaces)) {
192
+            if ($interfaces !== null && !is_array($interfaces)) {
193 193
                 throw new InvariantViolation(
194 194
                     sprintf('%s interfaces must be an Array or a callable which returns an Array.', $this->name)
195 195
                 );
Please login to merge, or discard this patch.
src/Type/Definition/EnumType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function __construct($config)
44 44
     {
45
-        if (! isset($config['name'])) {
45
+        if (!isset($config['name'])) {
46 46
             $config['name'] = $this->tryInferName();
47 47
         }
48 48
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $lookup = $this->getNameLookup();
66 66
 
67
-        if (! is_string($name)) {
67
+        if (!is_string($name)) {
68 68
             return null;
69 69
         }
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     private function getNameLookup() : ArrayObject
75 75
     {
76
-        if (! $this->nameLookup) {
76
+        if (!$this->nameLookup) {
77 77
             /** @var ArrayObject<string, EnumValueDefinition> $lookup */
78 78
             $lookup = new ArrayObject();
79 79
             foreach ($this->getValues() as $value) {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $config       = $this->config;
96 96
 
97 97
             if (isset($config['values'])) {
98
-                if (! is_array($config['values'])) {
98
+                if (!is_array($config['values'])) {
99 99
                     throw new InvariantViolation(sprintf('%s values must be an array', $this->name));
100 100
                 }
101 101
                 foreach ($config['values'] as $name => $value) {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $values = $this->getValues();
212 212
         foreach ($values as $value) {
213 213
             Utils::invariant(
214
-                ! isset($value->config['isDeprecated']),
214
+                !isset($value->config['isDeprecated']),
215 215
                 sprintf(
216 216
                     '%s.%s should provide "deprecationReason" instead of "isDeprecated".',
217 217
                     $this->name,
Please login to merge, or discard this patch.
src/Type/Definition/QueryPlan.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function hasType(string $type) : bool
81 81
     {
82
-        return count(array_filter($this->getReferencedTypes(), static function (string $referencedType) use ($type) {
82
+        return count(array_filter($this->getReferencedTypes(), static function(string $referencedType) use ($type) {
83 83
                 return $type === $referencedType;
84 84
         })) > 0;
85 85
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function hasField(string $field) : bool
96 96
     {
97
-        return count(array_filter($this->getReferencedFields(), static function (string $referencedField) use ($field) {
97
+        return count(array_filter($this->getReferencedFields(), static function(string $referencedField) use ($field) {
98 98
             return $field === $referencedField;
99 99
         })) > 0;
100 100
     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function subFields(string $typename) : array
106 106
     {
107
-        if (! array_key_exists($typename, $this->types)) {
107
+        if (!array_key_exists($typename, $this->types)) {
108 108
             return [];
109 109
         }
110 110
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $implementors = [];
121 121
         /** @var FieldNode $fieldNode */
122 122
         foreach ($fieldNodes as $fieldNode) {
123
-            if (! $fieldNode->selectionSet) {
123
+            if (!$fieldNode->selectionSet) {
124 124
                 continue;
125 125
             }
126 126
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     private function mergeFields(Type $parentType, Type $type, array $fields, array $subfields, array &$implementors) : array
230 230
     {
231
-        if ($this->groupImplementorFields && $parentType instanceof AbstractType && ! $type instanceof AbstractType) {
231
+        if ($this->groupImplementorFields && $parentType instanceof AbstractType && !$type instanceof AbstractType) {
232 232
             $implementors[$type->name] = [
233 233
                 'type'   => $type,
234 234
                 'fields' => $this->arrayMergeDeep(
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
         foreach ($array2 as $key => & $value) {
270 270
             if (is_numeric($key)) {
271
-                if (! in_array($value, $merged, true)) {
271
+                if (!in_array($value, $merged, true)) {
272 272
                     $merged[] = $value;
273 273
                 }
274 274
             } elseif (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
Please login to merge, or discard this patch.
src/Type/Definition/IDType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             || is_int($value)
42 42
             || (is_object($value) && method_exists($value, '__toString'));
43 43
 
44
-        if (! $canCast) {
44
+        if (!$canCast) {
45 45
             throw new Error('ID cannot represent value: ' . Utils::printSafe($value));
46 46
         }
47 47
 
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
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function __construct(array $config)
33 33
     {
34
-        if (! isset($config['name'])) {
34
+        if (!isset($config['name'])) {
35 35
             $config['name'] = $this->tryInferName();
36 36
         }
37 37
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 ? call_user_func($fields)
74 74
                 : $fields;
75 75
 
76
-            if (! is_array($fields)) {
76
+            if (!is_array($fields)) {
77 77
                 throw new InvariantViolation(
78 78
                     sprintf('%s fields must be an array or a callable which returns such an array.', $this->name)
79 79
                 );
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         parent::assertValid();
103 103
 
104 104
         Utils::invariant(
105
-            ! empty($this->getFields()),
105
+            !empty($this->getFields()),
106 106
             sprintf(
107 107
                 '%s fields must be an associative array with field names as keys or a callable which returns such an array.',
108 108
                 $this->name
Please login to merge, or discard this patch.
src/Type/Definition/BooleanType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
      */
56 56
     public function parseLiteral(Node $valueNode, ?array $variables = null)
57 57
     {
58
-        if (! $valueNode instanceof BooleanValueNode) {
58
+        if (!$valueNode instanceof BooleanValueNode) {
59 59
             // Intentionally without message, as all information already in wrapped Exception
60 60
             throw new Exception();
61 61
         }
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/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.