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/Utils/AST.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public static function fromArray(array $node) : Node
86 86
     {
87
-        if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) {
87
+        if (!isset($node['kind']) || !isset(NodeKind::$classMap[$node['kind']])) {
88 88
             throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node));
89 89
         }
90 90
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 $valuesNodes = [];
170 170
                 foreach ($value as $item) {
171 171
                     $itemNode = self::astFromValue($item, $itemType);
172
-                    if (! $itemNode) {
172
+                    if (!$itemNode) {
173 173
                         continue;
174 174
                     }
175 175
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         if ($type instanceof InputObjectType) {
188 188
             $isArray     = is_array($value);
189 189
             $isArrayLike = $isArray || $value instanceof \ArrayAccess;
190
-            if ($value === null || (! $isArrayLike && ! is_object($value))) {
190
+            if ($value === null || (!$isArrayLike && !is_object($value))) {
191 191
                 return null;
192 192
             }
193 193
             $fields     = $type->getFields();
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
                     $fieldExists = property_exists($value, $fieldName);
213 213
                 }
214 214
 
215
-                if (! $fieldExists) {
215
+                if (!$fieldExists) {
216 216
                     continue;
217 217
                 }
218 218
 
219 219
                 $fieldNode = self::astFromValue($fieldValue, $field->getType());
220 220
 
221
-                if (! $fieldNode) {
221
+                if (!$fieldNode) {
222 222
                     continue;
223 223
                 }
224 224
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         if ($valueNode instanceof VariableNode) {
342 342
             $variableName = $valueNode->name->value;
343 343
 
344
-            if (! $variables || ! array_key_exists($variableName, $variables)) {
344
+            if (!$variables || !array_key_exists($variableName, $variables)) {
345 345
                 // No valid return value.
346 346
                 return $undefined;
347 347
             }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         }
389 389
 
390 390
         if ($type instanceof InputObjectType) {
391
-            if (! $valueNode instanceof ObjectValueNode) {
391
+            if (!$valueNode instanceof ObjectValueNode) {
392 392
                 // Invalid: intentionally return no value.
393 393
                 return $undefined;
394 394
             }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             $fields     = $type->getFields();
398 398
             $fieldNodes = Utils::keyMap(
399 399
                 $valueNode->fields,
400
-                function ($field) {
400
+                function($field) {
401 401
                     return $field->name->value;
402 402
                 }
403 403
             );
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
                 $fieldName = $field->name;
407 407
                 $fieldNode = $fieldNodes[$fieldName] ?? null;
408 408
 
409
-                if (! $fieldNode || self::isMissingVariable($fieldNode->value, $variables)) {
409
+                if (!$fieldNode || self::isMissingVariable($fieldNode->value, $variables)) {
410 410
                     if ($field->defaultValueExists()) {
411 411
                         $coercedObj[$fieldName] = $field->defaultValue;
412 412
                     } elseif ($field->getType() instanceof NonNull) {
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
         }
430 430
 
431 431
         if ($type instanceof EnumType) {
432
-            if (! $valueNode instanceof EnumValueNode) {
432
+            if (!$valueNode instanceof EnumValueNode) {
433 433
                 return $undefined;
434 434
             }
435 435
             $enumValue = $type->getValue($valueNode->value);
436
-            if (! $enumValue) {
436
+            if (!$enumValue) {
437 437
                 return $undefined;
438 438
             }
439 439
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
     private static function isMissingVariable($valueNode, $variables)
467 467
     {
468 468
         return $valueNode instanceof VariableNode &&
469
-            (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables));
469
+            (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables));
470 470
     }
471 471
 
472 472
     /**
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
                 return $valueNode->value;
507 507
             case $valueNode instanceof ListValueNode:
508 508
                 return array_map(
509
-                    function ($node) use ($variables) {
509
+                    function($node) use ($variables) {
510 510
                         return self::valueFromASTUntyped($node, $variables);
511 511
                     },
512 512
                     iterator_to_array($valueNode->values)
@@ -514,13 +514,13 @@  discard block
 block discarded – undo
514 514
             case $valueNode instanceof ObjectValueNode:
515 515
                 return array_combine(
516 516
                     array_map(
517
-                        function ($field) {
517
+                        function($field) {
518 518
                             return $field->name->value;
519 519
                         },
520 520
                         iterator_to_array($valueNode->fields)
521 521
                     ),
522 522
                     array_map(
523
-                        function ($field) use ($variables) {
523
+                        function($field) use ($variables) {
524 524
                             return self::valueFromASTUntyped($field->value, $variables);
525 525
                         },
526 526
                         iterator_to_array($valueNode->fields)
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
     {
576 576
         if ($document->definitions) {
577 577
             foreach ($document->definitions as $def) {
578
-                if (! ($def instanceof OperationDefinitionNode)) {
578
+                if (!($def instanceof OperationDefinitionNode)) {
579 579
                     continue;
580 580
                 }
581 581
 
582
-                if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) {
582
+                if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) {
583 583
                     return $def->operation;
584 584
                 }
585 585
             }
Please login to merge, or discard this patch.
src/Utils/BreakingChangesFinder.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         $breakingChanges = [];
121 121
         foreach ($oldTypeMap as $typeName => $oldType) {
122
-            if (! isset($newTypeMap[$typeName])) {
122
+            if (!isset($newTypeMap[$typeName])) {
123 123
                 continue;
124 124
             }
125 125
             $newType = $newTypeMap[$typeName];
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
         $breakingChanges = [];
186 186
         foreach ($oldTypeMap as $typeName => $oldType) {
187 187
             $newType = $newTypeMap[$typeName] ?? null;
188
-            if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) ||
189
-                ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) ||
190
-                ! ($newType instanceof $oldType)
188
+            if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) ||
189
+                !($newType instanceof ObjectType || $newType instanceof InterfaceType) ||
190
+                !($newType instanceof $oldType)
191 191
             ) {
192 192
                 continue;
193 193
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             $newTypeFieldsDef = $newType->getFields();
197 197
             foreach ($oldTypeFieldsDef as $fieldName => $fieldDefinition) {
198 198
                 // Check if the field is missing on the type in the new schema.
199
-                if (! isset($newTypeFieldsDef[$fieldName])) {
199
+                if (!isset($newTypeFieldsDef[$fieldName])) {
200 200
                     $breakingChanges[] = [
201 201
                         'type'        => self::BREAKING_CHANGE_FIELD_REMOVED,
202 202
                         'description' => "${typeName}.${fieldName} was removed.",
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                         $oldFieldType,
209 209
                         $newFieldType
210 210
                     );
211
-                    if (! $isSafe) {
211
+                    if (!$isSafe) {
212 212
                         $oldFieldTypeString = $oldFieldType instanceof NamedType
213 213
                             ? $oldFieldType->name
214 214
                             : $oldFieldType;
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
         $dangerousChanges = [];
279 279
         foreach ($oldTypeMap as $typeName => $oldType) {
280 280
             $newType = $newTypeMap[$typeName] ?? null;
281
-            if (! ($oldType instanceof InputObjectType) || ! ($newType instanceof InputObjectType)) {
281
+            if (!($oldType instanceof InputObjectType) || !($newType instanceof InputObjectType)) {
282 282
                 continue;
283 283
             }
284 284
 
285 285
             $oldTypeFieldsDef = $oldType->getFields();
286 286
             $newTypeFieldsDef = $newType->getFields();
287 287
             foreach (array_keys($oldTypeFieldsDef) as $fieldName) {
288
-                if (! isset($newTypeFieldsDef[$fieldName])) {
288
+                if (!isset($newTypeFieldsDef[$fieldName])) {
289 289
                     $breakingChanges[] = [
290 290
                         'type'        => self::BREAKING_CHANGE_FIELD_REMOVED,
291 291
                         'description' => "${typeName}.${fieldName} was removed.",
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
                         $oldFieldType,
299 299
                         $newFieldType
300 300
                     );
301
-                    if (! $isSafe) {
301
+                    if (!$isSafe) {
302 302
                         $oldFieldTypeString = $oldFieldType instanceof NamedType
303 303
                             ? $oldFieldType->name
304 304
                             : $oldFieldType;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                         $newType->getWrappedType()
371 371
                     )) ||
372 372
                 // moving from non-null to nullable of the same underlying type is safe
373
-                (! ($newType instanceof NonNull) &&
373
+                (!($newType instanceof NonNull) &&
374 374
                     self::isChangeSafeForInputObjectFieldOrFieldArg($oldType->getWrappedType(), $newType));
375 375
         }
376 376
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         $typesRemovedFromUnion = [];
394 394
         foreach ($oldTypeMap as $typeName => $oldType) {
395 395
             $newType = $newTypeMap[$typeName] ?? null;
396
-            if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) {
396
+            if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) {
397 397
                 continue;
398 398
             }
399 399
             $typeNamesInNewUnion = [];
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         $valuesRemovedFromEnums = [];
432 432
         foreach ($oldTypeMap as $typeName => $oldType) {
433 433
             $newType = $newTypeMap[$typeName] ?? null;
434
-            if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) {
434
+            if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) {
435 435
                 continue;
436 436
             }
437 437
             $valuesInNewEnum = [];
@@ -473,9 +473,9 @@  discard block
 block discarded – undo
473 473
 
474 474
         foreach ($oldTypeMap as $typeName => $oldType) {
475 475
             $newType = $newTypeMap[$typeName] ?? null;
476
-            if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) ||
477
-                ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) ||
478
-                ! ($newType instanceof $oldType)
476
+            if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) ||
477
+                !($newType instanceof ObjectType || $newType instanceof InterfaceType) ||
478
+                !($newType instanceof $oldType)
479 479
             ) {
480 480
                 continue;
481 481
             }
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
             $newTypeFields = $newType->getFields();
485 485
 
486 486
             foreach ($oldTypeFields as $fieldName => $oldField) {
487
-                if (! isset($newTypeFields[$fieldName])) {
487
+                if (!isset($newTypeFields[$fieldName])) {
488 488
                     continue;
489 489
                 }
490 490
 
@@ -492,18 +492,18 @@  discard block
 block discarded – undo
492 492
                     $newArgs   = $newTypeFields[$fieldName]->args;
493 493
                     $newArgDef = Utils::find(
494 494
                         $newArgs,
495
-                        function ($arg) use ($oldArgDef) {
495
+                        function($arg) use ($oldArgDef) {
496 496
                             return $arg->name === $oldArgDef->name;
497 497
                         }
498 498
                     );
499 499
                     if ($newArgDef) {
500
-                        $isSafe     = self::isChangeSafeForInputObjectFieldOrFieldArg(
500
+                        $isSafe = self::isChangeSafeForInputObjectFieldOrFieldArg(
501 501
                             $oldArgDef->getType(),
502 502
                             $newArgDef->getType()
503 503
                         );
504 504
                         $oldArgType = $oldArgDef->getType();
505 505
                         $oldArgName = $oldArgDef->name;
506
-                        if (! $isSafe) {
506
+                        if (!$isSafe) {
507 507
                             $newArgType        = $newArgDef->getType();
508 508
                             $breakingChanges[] = [
509 509
                                 'type'        => self::BREAKING_CHANGE_ARG_CHANGED_KIND,
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                         $oldArgs   = $oldTypeFields[$fieldName]->args;
532 532
                         $oldArgDef = Utils::find(
533 533
                             $oldArgs,
534
-                            function ($arg) use ($newArgDef) {
534
+                            function($arg) use ($newArgDef) {
535 535
                                 return $arg->name === $newArgDef->name;
536 536
                             }
537 537
                         );
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 
578 578
         foreach ($oldTypeMap as $typeName => $oldType) {
579 579
             $newType = $newTypeMap[$typeName] ?? null;
580
-            if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) {
580
+            if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) {
581 581
                 continue;
582 582
             }
583 583
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
             foreach ($oldInterfaces as $oldInterface) {
587 587
                 if (Utils::find(
588 588
                     $newInterfaces,
589
-                    function (InterfaceType $interface) use ($oldInterface) {
589
+                    function(InterfaceType $interface) use ($oldInterface) {
590 590
                         return $interface->name === $oldInterface->name;
591 591
                     }
592 592
                 )) {
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
     {
630 630
         return Utils::keyMap(
631 631
             $schema->getDirectives(),
632
-            function ($dir) {
632
+            function($dir) {
633 633
                 return $dir->name;
634 634
             }
635 635
         );
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
         $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema);
642 642
 
643 643
         foreach ($newSchema->getDirectives() as $newDirective) {
644
-            if (! isset($oldSchemaDirectiveMap[$newDirective->name])) {
644
+            if (!isset($oldSchemaDirectiveMap[$newDirective->name])) {
645 645
                 continue;
646 646
             }
647 647
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
     {
679 679
         return Utils::keyMap(
680 680
             $directive->args ?: [],
681
-            function ($arg) {
681
+            function($arg) {
682 682
                 return $arg->name;
683 683
             }
684 684
         );
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
         $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema);
691 691
 
692 692
         foreach ($newSchema->getDirectives() as $newDirective) {
693
-            if (! isset($oldSchemaDirectiveMap[$newDirective->name])) {
693
+            if (!isset($oldSchemaDirectiveMap[$newDirective->name])) {
694 694
                 continue;
695 695
             }
696 696
 
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
                 $oldSchemaDirectiveMap[$newDirective->name],
699 699
                 $newDirective
700 700
             ) as $arg) {
701
-                if (! $arg->getType() instanceof NonNull) {
701
+                if (!$arg->getType() instanceof NonNull) {
702 702
                     continue;
703 703
                 }
704 704
                 $addedNonNullableArgs[] = [
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
         $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema);
743 743
 
744 744
         foreach ($newSchema->getDirectives() as $newDirective) {
745
-            if (! isset($oldSchemaDirectiveMap[$newDirective->name])) {
745
+            if (!isset($oldSchemaDirectiveMap[$newDirective->name])) {
746 746
                 continue;
747 747
             }
748 748
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
         $valuesAddedToEnums = [];
809 809
         foreach ($oldTypeMap as $typeName => $oldType) {
810 810
             $newType = $newTypeMap[$typeName] ?? null;
811
-            if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) {
811
+            if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) {
812 812
                 continue;
813 813
             }
814 814
             $valuesInOldEnum = [];
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 
845 845
         foreach ($newTypeMap as $typeName => $newType) {
846 846
             $oldType = $oldTypeMap[$typeName] ?? null;
847
-            if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) {
847
+            if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) {
848 848
                 continue;
849 849
             }
850 850
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
             foreach ($newInterfaces as $newInterface) {
854 854
                 if (Utils::find(
855 855
                     $oldInterfaces,
856
-                    function (InterfaceType $interface) use ($newInterface) {
856
+                    function(InterfaceType $interface) use ($newInterface) {
857 857
                         return $interface->name === $newInterface->name;
858 858
                     }
859 859
                 )) {
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
         $typesAddedToUnion = [];
891 891
         foreach ($newTypeMap as $typeName => $newType) {
892 892
             $oldType = $oldTypeMap[$typeName] ?? null;
893
-            if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) {
893
+            if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) {
894 894
                 continue;
895 895
             }
896 896
 
Please login to merge, or discard this patch.
src/Error/Error.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         // Compute list of blame nodes.
103 103
         if ($nodes instanceof \Traversable) {
104 104
             $nodes = iterator_to_array($nodes);
105
-        } elseif ($nodes && ! is_array($nodes)) {
105
+        } elseif ($nodes && !is_array($nodes)) {
106 106
             $nodes = [$nodes];
107 107
         }
108 108
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     public function getSource()
208 208
     {
209 209
         if ($this->source === null) {
210
-            if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) {
210
+            if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) {
211 211
                 $this->source = $this->nodes[0]->loc->source;
212 212
             }
213 213
         }
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function getPositions()
222 222
     {
223
-        if ($this->positions === null && ! empty($this->nodes)) {
223
+        if ($this->positions === null && !empty($this->nodes)) {
224 224
             $positions = array_map(
225
-                function ($node) {
225
+                function($node) {
226 226
                     return isset($node->loc) ? $node->loc->start : null;
227 227
                 },
228 228
                 $this->nodes
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
             $this->positions = array_filter(
232 232
                 $positions,
233
-                function ($p) {
233
+                function($p) {
234 234
                     return $p !== null;
235 235
                 }
236 236
             );
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
             if ($positions && $source) {
264 264
                 $this->locations = array_map(
265
-                    function ($pos) use ($source) {
265
+                    function($pos) use ($source) {
266 266
                         return $source->getLocation($pos);
267 267
                     },
268 268
                     $positions
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             } elseif ($nodes) {
271 271
                 $this->locations = array_filter(
272 272
                     array_map(
273
-                        function ($node) {
273
+                        function($node) {
274 274
                             if ($node->loc && $node->loc->source) {
275 275
                                 return $node->loc->source->getLocation($node->loc->start);
276 276
                             }
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
 
329 329
         $locations = Utils::map(
330 330
             $this->getLocations(),
331
-            function (SourceLocation $loc) {
331
+            function(SourceLocation $loc) {
332 332
                 return $loc->toSerializableArray();
333 333
             }
334 334
         );
335 335
 
336
-        if (! empty($locations)) {
336
+        if (!empty($locations)) {
337 337
             $arr['locations'] = $locations;
338 338
         }
339
-        if (! empty($this->path)) {
339
+        if (!empty($this->path)) {
340 340
             $arr['path'] = $this->path;
341 341
         }
342
-        if (! empty($this->extensions)) {
342
+        if (!empty($this->extensions)) {
343 343
             $arr['extensions'] = $this->extensions;
344 344
         }
345 345
 
Please login to merge, or discard this patch.
src/Utils/Value.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $suggestions = Utils::suggestionList(
96 96
                 Utils::printSafe($value),
97 97
                 array_map(
98
-                    function ($enumValue) {
98
+                    function($enumValue) {
99 99
                         return $enumValue->name;
100 100
                     },
101 101
                     $type->getValues()
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         }
145 145
 
146 146
         if ($type instanceof InputObjectType) {
147
-            if (! is_object($value) && ! is_array($value) && ! $value instanceof \Traversable) {
147
+            if (!is_object($value) && !is_array($value) && !$value instanceof \Traversable) {
148 148
                 return self::ofErrors([
149 149
                     self::coercionError(
150 150
                         sprintf('Expected type %s to be an object', $type->name),
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $pathStr     = '';
266 266
         $currentPath = $path;
267 267
         while ($currentPath) {
268
-            $pathStr     =
268
+            $pathStr =
269 269
                 (is_string($currentPath['key'])
270 270
                     ? '.' . $currentPath['key']
271 271
                     : '[' . $currentPath['key'] . ']') . $pathStr;
Please login to merge, or discard this patch.
src/Utils/Utils.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
     public static function assign($obj, array $vars, array $requiredKeys = [])
80 80
     {
81 81
         foreach ($requiredKeys as $key) {
82
-            if (! isset($vars[$key])) {
82
+            if (!isset($vars[$key])) {
83 83
                 throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key));
84 84
             }
85 85
         }
86 86
 
87 87
         foreach ($vars as $key => $value) {
88
-            if (! property_exists($obj, $key)) {
88
+            if (!property_exists($obj, $key)) {
89 89
                 $cls = get_class($obj);
90 90
                 Warning::warn(
91 91
                     sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls),
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
         $result = [];
134 134
         $assoc  = false;
135 135
         foreach ($traversable as $key => $value) {
136
-            if (! $assoc && ! is_int($key)) {
136
+            if (!$assoc && !is_int($key)) {
137 137
                 $assoc = true;
138 138
             }
139
-            if (! $predicate($value, $key)) {
139
+            if (!$predicate($value, $key)) {
140 140
                 continue;
141 141
             }
142 142
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $map = [];
203 203
         foreach ($traversable as $key => $value) {
204 204
             $newKey = $keyFn($value, $key);
205
-            if (! is_scalar($newKey)) {
205
+            if (!is_scalar($newKey)) {
206 206
                 continue;
207 207
             }
208 208
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     public static function every($traversable, callable $predicate)
279 279
     {
280 280
         foreach ($traversable as $key => $value) {
281
-            if (! $predicate($value, $key)) {
281
+            if (!$predicate($value, $key)) {
282 282
                 return false;
283 283
             }
284 284
         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public static function invariant($test, $message = '')
294 294
     {
295
-        if (! $test) {
295
+        if (!$test) {
296 296
             if (func_num_args() > 2) {
297 297
                 $args = func_get_args();
298 298
                 array_shift($args);
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
      */
425 425
     public static function ord($char, $encoding = 'UTF-8')
426 426
     {
427
-        if (! $char && $char !== '0') {
427
+        if (!$char && $char !== '0') {
428 428
             return 0;
429 429
         }
430
-        if (! isset($char[1])) {
430
+        if (!isset($char[1])) {
431 431
             return ord($char);
432 432
         }
433 433
         if ($encoding !== 'UCS-4BE') {
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             );
502 502
         }
503 503
 
504
-        if (! preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) {
504
+        if (!preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) {
505 505
             return new Error(
506 506
                 sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name),
507 507
                 $node
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
      */
521 521
     public static function withErrorHandling(callable $fn, array &$errors)
522 522
     {
523
-        return function () use ($fn, &$errors) {
523
+        return function() use ($fn, &$errors) {
524 524
             // Catch custom errors (to report them in query results)
525
-            set_error_handler(function ($severity, $message, $file, $line) use (&$errors) {
525
+            set_error_handler(function($severity, $message, $file, $line) use (&$errors) {
526 526
                 $errors[] = new \ErrorException($message, 0, $severity, $file, $line);
527 527
             });
528 528
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
     public static function quotedOrList(array $items)
542 542
     {
543 543
         $items = array_map(
544
-            function ($item) {
544
+            function($item) {
545 545
                 return sprintf('"%s"', $item);
546 546
             },
547 547
             $items
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
         return array_reduce(
571 571
             range(1, $selectedLength - 1),
572
-            function ($list, $index) use ($selected, $selectedLength) {
572
+            function($list, $index) use ($selected, $selectedLength) {
573 573
                 return $list .
574 574
                     ($selectedLength > 2 ? ', ' : ' ') .
575 575
                     ($index === $selectedLength - 1 ? 'or ' : '') .
Please login to merge, or discard this patch.
src/Utils/SchemaPrinter.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
     {
51 51
         return self::printFilteredSchema(
52 52
             $schema,
53
-            function ($type) {
54
-                return ! Directive::isSpecifiedDirective($type);
53
+            function($type) {
54
+                return !Directive::isSpecifiedDirective($type);
55 55
             },
56
-            function ($type) {
57
-                return ! Type::isBuiltInType($type);
56
+            function($type) {
57
+                return !Type::isBuiltInType($type);
58 58
             },
59 59
             $options
60 60
         );
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $directives = array_filter(
69 69
             $schema->getDirectives(),
70
-            function ($directive) use ($directiveFilter) {
70
+            function($directive) use ($directiveFilter) {
71 71
                 return $directiveFilter($directive);
72 72
             }
73 73
         );
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
                     array_merge(
85 85
                         [self::printSchemaDefinition($schema)],
86 86
                         array_map(
87
-                            function ($directive) use ($options) {
87
+                            function($directive) use ($options) {
88 88
                                 return self::printDirective($directive, $options);
89 89
                             },
90 90
                             $directives
91 91
                         ),
92 92
                         array_map(
93
-                            function ($type) use ($options) {
93
+                            function($type) use ($options) {
94 94
                                 return self::printType($type, $options);
95 95
                             },
96 96
                             $types
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
     private static function printDescription($options, $def, $indentation = '', $firstInBlock = true)
170 170
     {
171
-        if (! $def->description) {
171
+        if (!$def->description) {
172 172
             return '';
173 173
         }
174 174
         $lines = self::descriptionLines($def->description, 120 - strlen($indentation));
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             return self::printDescriptionWithComments($lines, $indentation, $firstInBlock);
177 177
         }
178 178
 
179
-        $description = ($indentation && ! $firstInBlock)
179
+        $description = ($indentation && !$firstInBlock)
180 180
             ? "\n" . $indentation . '"""'
181 181
             : $indentation . '"""';
182 182
 
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
                 substr($lines[0], 0, 1) === ' ' ||
195 195
                 substr($lines[0], 0, 1) === '\t'
196 196
             );
197
-        if (! $hasLeadingSpace) {
197
+        if (!$hasLeadingSpace) {
198 198
             $description .= "\n";
199 199
         }
200 200
 
201 201
         $lineLength = count($lines);
202 202
         for ($i = 0; $i < $lineLength; $i++) {
203
-            if ($i !== 0 || ! $hasLeadingSpace) {
203
+            if ($i !== 0 || !$hasLeadingSpace) {
204 204
                 $description .= $indentation;
205 205
             }
206 206
             $description .= self::escapeQuote($lines[$i]) . "\n";
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
     private static function printDescriptionWithComments($lines, $indentation, $firstInBlock)
245 245
     {
246
-        $description = $indentation && ! $firstInBlock ? "\n" : '';
246
+        $description = $indentation && !$firstInBlock ? "\n" : '';
247 247
         foreach ($lines as $line) {
248 248
             if ($line === '') {
249 249
                 $description .= $indentation . "#\n";
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 
263 263
     private static function printArgs($options, $args, $indentation = '')
264 264
     {
265
-        if (! $args) {
265
+        if (!$args) {
266 266
             return '';
267 267
         }
268 268
 
269 269
         // If every arg does not have a description, print them on one line.
270 270
         if (Utils::every(
271 271
             $args,
272
-            function ($arg) {
272
+            function($arg) {
273 273
                 return empty($arg->description);
274 274
             }
275 275
         )) {
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
             implode(
282 282
                 "\n",
283 283
                 array_map(
284
-                    function ($arg, $i) use ($indentation, $options) {
285
-                        return self::printDescription($options, $arg, '  ' . $indentation, ! $i) . '  ' . $indentation .
284
+                    function($arg, $i) use ($indentation, $options) {
285
+                        return self::printDescription($options, $arg, '  ' . $indentation, !$i) . '  ' . $indentation .
286 286
                             self::printInputValue($arg);
287 287
                     },
288 288
                     $args,
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
     private static function printObject(ObjectType $type, array $options)
350 350
     {
351 351
         $interfaces            = $type->getInterfaces();
352
-        $implementedInterfaces = ! empty($interfaces) ?
352
+        $implementedInterfaces = !empty($interfaces) ?
353 353
             ' implements ' . implode(
354 354
                 ' & ',
355 355
                 array_map(
356
-                    function ($i) {
356
+                    function($i) {
357 357
                         return $i->name;
358 358
                     },
359 359
                     $interfaces
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
         return implode(
375 375
             "\n",
376 376
             array_map(
377
-                function ($f, $i) use ($options) {
378
-                    return self::printDescription($options, $f, '  ', ! $i) . '  ' .
377
+                function($f, $i) use ($options) {
378
+                    return self::printDescription($options, $f, '  ', !$i) . '  ' .
379 379
                         $f->name . self::printArgs($options, $f->args, '  ') . ': ' .
380 380
                         (string) $f->getType() . self::printDeprecated($f);
381 381
                 },
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
         return implode(
435 435
             "\n",
436 436
             array_map(
437
-                function ($value, $i) use ($options) {
438
-                    return self::printDescription($options, $value, '  ', ! $i) . '  ' .
437
+                function($value, $i) use ($options) {
438
+                    return self::printDescription($options, $value, '  ', !$i) . '  ' .
439 439
                         $value->name . self::printDeprecated($value);
440 440
                 },
441 441
                 $values,
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
                 implode(
459 459
                     "\n",
460 460
                     array_map(
461
-                        function ($f, $i) use ($options) {
462
-                            return self::printDescription($options, $f, '  ', ! $i) . '  ' . self::printInputValue($f);
461
+                        function($f, $i) use ($options) {
462
+                            return self::printDescription($options, $f, '  ', !$i) . '  ' . self::printInputValue($f);
463 463
                         },
464 464
                         $fields,
465 465
                         array_keys($fields)
Please login to merge, or discard this patch.
src/Utils/TypeInfo.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->parentTypeStack = [];
75 75
         $this->inputTypeStack  = [];
76 76
         $this->fieldDefStack   = [];
77
-        if (! $initialType) {
77
+        if (!$initialType) {
78 78
             return;
79 79
         }
80 80
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         if (Type::isCompositeType($initialType)) {
85 85
             $this->parentTypeStack[] = $initialType;
86 86
         }
87
-        if (! Type::isOutputType($initialType)) {
87
+        if (!Type::isOutputType($initialType)) {
88 88
             return;
89 89
         }
90 90
 
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public static function extractTypes($type, ?array $typeMap = null)
134 134
     {
135
-        if (! $typeMap) {
135
+        if (!$typeMap) {
136 136
             $typeMap = [];
137 137
         }
138
-        if (! $type) {
138
+        if (!$type) {
139 139
             return $typeMap;
140 140
         }
141 141
 
142 142
         if ($type instanceof WrappingType) {
143 143
             return self::extractTypes($type->getWrappedType(true), $typeMap);
144 144
         }
145
-        if (! $type instanceof Type) {
145
+        if (!$type instanceof Type) {
146 146
             Warning::warnOnce(
147 147
                 'One of the schema types is not a valid type definition instance. ' .
148 148
                 'Try running $schema->assertValid() to find out the cause of this warning.',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             return $typeMap;
153 153
         }
154 154
 
155
-        if (! empty($typeMap[$type->name])) {
155
+        if (!empty($typeMap[$type->name])) {
156 156
             Utils::invariant(
157 157
                 $typeMap[$type->name] === $type,
158 158
                 sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) .
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
         }
174 174
         if ($type instanceof ObjectType || $type instanceof InterfaceType) {
175 175
             foreach ((array) $type->getFields() as $fieldName => $field) {
176
-                if (! empty($field->args)) {
176
+                if (!empty($field->args)) {
177 177
                     $fieldArgTypes = array_map(
178
-                        function (FieldArgument $arg) {
178
+                        function(FieldArgument $arg) {
179 179
                             return $arg->getType();
180 180
                         },
181 181
                         $field->args
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
                 if ($fieldOrDirective) {
305 305
                     $argDef = Utils::find(
306 306
                         $fieldOrDirective->args,
307
-                        function ($arg) use ($node) {
307
+                        function($arg) use ($node) {
308 308
                             return $arg->name === $node->name->value;
309 309
                         }
310 310
                     );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
      */
353 353
     public function getType()
354 354
     {
355
-        if (! empty($this->typeStack)) {
355
+        if (!empty($this->typeStack)) {
356 356
             return $this->typeStack[count($this->typeStack) - 1];
357 357
         }
358 358
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      */
365 365
     public function getParentType()
366 366
     {
367
-        if (! empty($this->parentTypeStack)) {
367
+        if (!empty($this->parentTypeStack)) {
368 368
             return $this->parentTypeStack[count($this->parentTypeStack) - 1];
369 369
         }
370 370
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      */
428 428
     public function getFieldDef()
429 429
     {
430
-        if (! empty($this->fieldDefStack)) {
430
+        if (!empty($this->fieldDefStack)) {
431 431
             return $this->fieldDefStack[count($this->fieldDefStack) - 1];
432 432
         }
433 433
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getInputType()
441 441
     {
442
-        if (! empty($this->inputTypeStack)) {
442
+        if (!empty($this->inputTypeStack)) {
443 443
             return $this->inputTypeStack[count($this->inputTypeStack) - 1];
444 444
         }
445 445
 
Please login to merge, or discard this patch.
src/Utils/BuildSchema.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 case NodeKind::UNION_TYPE_DEFINITION:
112 112
                 case NodeKind::INPUT_OBJECT_TYPE_DEFINITION:
113 113
                     $typeName = $d->name->value;
114
-                    if (! empty($this->nodeMap[$typeName])) {
114
+                    if (!empty($this->nodeMap[$typeName])) {
115 115
                         throw new Error(sprintf('Type "%s" was defined more than once.', $typeName));
116 116
                     }
117 117
                     $typeDefs[]               = $d;
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
         $defintionBuilder = new ASTDefinitionBuilder(
135 135
             $this->nodeMap,
136 136
             $this->options,
137
-            function ($typeName) {
137
+            function($typeName) {
138 138
                 throw new Error('Type "' . $typeName . '" not found in document.');
139 139
             },
140 140
             $this->typeConfigDecorator
141 141
         );
142 142
 
143 143
         $directives = array_map(
144
-            function ($def) use ($defintionBuilder) {
144
+            function($def) use ($defintionBuilder) {
145 145
                 return $defintionBuilder->buildDirective($def);
146 146
             },
147 147
             $directiveDefs
@@ -150,31 +150,31 @@  discard block
 block discarded – undo
150 150
         // If specified directives were not explicitly declared, add them.
151 151
         $skip = array_reduce(
152 152
             $directives,
153
-            function ($hasSkip, $directive) {
153
+            function($hasSkip, $directive) {
154 154
                 return $hasSkip || $directive->name === 'skip';
155 155
             }
156 156
         );
157
-        if (! $skip) {
157
+        if (!$skip) {
158 158
             $directives[] = Directive::skipDirective();
159 159
         }
160 160
 
161 161
         $include = array_reduce(
162 162
             $directives,
163
-            function ($hasInclude, $directive) {
163
+            function($hasInclude, $directive) {
164 164
                 return $hasInclude || $directive->name === 'include';
165 165
             }
166 166
         );
167
-        if (! $include) {
167
+        if (!$include) {
168 168
             $directives[] = Directive::includeDirective();
169 169
         }
170 170
 
171 171
         $deprecated = array_reduce(
172 172
             $directives,
173
-            function ($hasDeprecated, $directive) {
173
+            function($hasDeprecated, $directive) {
174 174
                 return $hasDeprecated || $directive->name === 'deprecated';
175 175
             }
176 176
         );
177
-        if (! $deprecated) {
177
+        if (!$deprecated) {
178 178
             $directives[] = Directive::deprecatedDirective();
179 179
         }
180 180
 
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
             'subscription' => isset($operationTypes['subscription'])
193 193
                 ? $defintionBuilder->buildType($operationTypes['subscription'])
194 194
                 : null,
195
-            'typeLoader'   => function ($name) use ($defintionBuilder) {
195
+            'typeLoader'   => function($name) use ($defintionBuilder) {
196 196
                 return $defintionBuilder->buildType($name);
197 197
             },
198 198
             'directives'   => $directives,
199 199
             'astNode'      => $schemaDef,
200
-            'types'        => function () use ($defintionBuilder) {
200
+            'types'        => function() use ($defintionBuilder) {
201 201
                 $types = [];
202 202
                 foreach ($this->nodeMap as $name => $def) {
203 203
                     $types[] = $defintionBuilder->buildType($def->name->value);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 throw new Error(sprintf('Must provide only one %s type in schema.', $operation));
228 228
             }
229 229
 
230
-            if (! isset($this->nodeMap[$typeName])) {
230
+            if (!isset($this->nodeMap[$typeName])) {
231 231
                 throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName));
232 232
             }
233 233
 
Please login to merge, or discard this patch.
src/Validator/ValidationContext.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $usages = $this->recursiveVariableUsages[$operation] ?? null;
100 100
 
101
-        if (! $usages) {
101
+        if (!$usages) {
102 102
             $usages    = $this->getVariableUsages($operation);
103 103
             $fragments = $this->getRecursivelyReferencedFragments($operation);
104 104
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $usages = $this->variableUsages[$node] ?? null;
122 122
 
123
-        if (! $usages) {
123
+        if (!$usages) {
124 124
             $newUsages = [];
125 125
             $typeInfo  = new TypeInfo($this->schema);
126 126
             Visitor::visit(
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
                 Visitor::visitWithTypeInfo(
129 129
                     $typeInfo,
130 130
                     [
131
-                        NodeKind::VARIABLE_DEFINITION => function () {
131
+                        NodeKind::VARIABLE_DEFINITION => function() {
132 132
                             return false;
133 133
                         },
134
-                        NodeKind::VARIABLE            => function (VariableNode $variable) use (
134
+                        NodeKind::VARIABLE            => function(VariableNode $variable) use (
135 135
                             &$newUsages,
136 136
                             $typeInfo
137 137
                         ) {
@@ -154,23 +154,23 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $fragments = $this->recursivelyReferencedFragments[$operation] ?? null;
156 156
 
157
-        if (! $fragments) {
157
+        if (!$fragments) {
158 158
             $fragments      = [];
159 159
             $collectedNames = [];
160 160
             $nodesToVisit   = [$operation];
161
-            while (! empty($nodesToVisit)) {
161
+            while (!empty($nodesToVisit)) {
162 162
                 $node    = array_pop($nodesToVisit);
163 163
                 $spreads = $this->getFragmentSpreads($node);
164 164
                 for ($i = 0; $i < count($spreads); $i++) {
165 165
                     $fragName = $spreads[$i]->name->value;
166 166
 
167
-                    if (! empty($collectedNames[$fragName])) {
167
+                    if (!empty($collectedNames[$fragName])) {
168 168
                         continue;
169 169
                     }
170 170
 
171 171
                     $collectedNames[$fragName] = true;
172 172
                     $fragment                  = $this->getFragment($fragName);
173
-                    if (! $fragment) {
173
+                    if (!$fragment) {
174 174
                         continue;
175 175
                     }
176 176
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
     public function getFragmentSpreads(HasSelectionSet $node)
191 191
     {
192 192
         $spreads = $this->fragmentSpreads[$node] ?? null;
193
-        if (! $spreads) {
193
+        if (!$spreads) {
194 194
             $spreads = [];
195 195
             /** @var SelectionSetNode[] $setsToVisit */
196 196
             $setsToVisit = [$node->selectionSet];
197
-            while (! empty($setsToVisit)) {
197
+            while (!empty($setsToVisit)) {
198 198
                 $set = array_pop($setsToVisit);
199 199
 
200 200
                 for ($i = 0; $i < count($set->selections); $i++) {
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public function getFragment($name)
220 220
     {
221 221
         $fragments = $this->fragments;
222
-        if (! $fragments) {
222
+        if (!$fragments) {
223 223
             $fragments = [];
224 224
             foreach ($this->getDocument()->definitions as $statement) {
225 225
                 if ($statement->kind !== NodeKind::FRAGMENT_DEFINITION) {
Please login to merge, or discard this patch.