Passed
Pull Request — master (#539)
by Benedikt
03:07
created
src/Type/Validation/InputObjectCircularRefs.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
                 if ($fieldType instanceof InputObjectType) {
72 72
                     $this->fieldPath[] = $field;
73 73
 
74
-                    if (! isset($this->fieldPathIndexByTypeName[$fieldType->name])) {
74
+                    if (!isset($this->fieldPathIndexByTypeName[$fieldType->name])) {
75 75
                         $this->validate($fieldType);
76 76
                     } else {
77 77
                         $cycleIndex = $this->fieldPathIndexByTypeName[$fieldType->name];
78 78
                         $cyclePath  = array_slice($this->fieldPath, $cycleIndex);
79 79
                         $fieldNames = array_map(
80
-                            static function (InputObjectField $field) : string {
80
+                            static function(InputObjectField $field) : string {
81 81
                                 return $field->name;
82 82
                             },
83 83
                             $cyclePath
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                             'Cannot reference Input Object "' . $fieldType->name . '" within itself '
88 88
                             . 'through a series of non-null fields: "' . implode('.', $fieldNames) . '".',
89 89
                             array_map(
90
-                                static function (InputObjectField $field) : ?InputValueDefinitionNode {
90
+                                static function(InputObjectField $field) : ?InputValueDefinitionNode {
91 91
                                     return $field->astNode;
92 92
                                 },
93 93
                                 $cyclePath
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.
src/Type/Schema.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
                 Utils::getVariableType($config)
109 109
             );
110 110
             Utils::invariant(
111
-                ! $config->types || is_array($config->types) || is_callable($config->types),
111
+                !$config->types || is_array($config->types) || is_callable($config->types),
112 112
                 '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types)
113 113
             );
114 114
             Utils::invariant(
115
-                ! $config->directives || is_array($config->directives),
115
+                !$config->directives || is_array($config->directives),
116 116
                 '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives)
117 117
             );
118 118
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             $types = $types();
165 165
         }
166 166
 
167
-        if (! is_array($types) && ! $types instanceof Traversable) {
167
+        if (!is_array($types) && !$types instanceof Traversable) {
168 168
             throw new InvariantViolation(sprintf(
169 169
                 'Schema types callable must return array or instance of Traversable but got: %s',
170 170
                 Utils::getVariableType($types)
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         }
173 173
 
174 174
         foreach ($types as $index => $type) {
175
-            if (! $type instanceof Type) {
175
+            if (!$type instanceof Type) {
176 176
                 throw new InvariantViolation(sprintf(
177 177
                     'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s',
178 178
                     $index,
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function getTypeMap()
197 197
     {
198
-        if (! $this->fullyLoaded) {
198
+        if (!$this->fullyLoaded) {
199 199
             $this->resolvedTypes = $this->collectAllTypes();
200 200
             $this->fullyLoaded   = true;
201 201
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $typeMap = TypeInfo::extractTypes($type, $typeMap);
214 214
         }
215 215
         foreach ($this->getDirectives() as $directive) {
216
-            if (! ($directive instanceof Directive)) {
216
+            if (!($directive instanceof Directive)) {
217 217
                 continue;
218 218
             }
219 219
 
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function getType(string $name) : ?Type
315 315
     {
316
-        if (! isset($this->resolvedTypes[$name])) {
316
+        if (!isset($this->resolvedTypes[$name])) {
317 317
             $type = $this->loadType($name);
318
-            if (! $type) {
318
+            if (!$type) {
319 319
                 return null;
320 320
             }
321 321
             $this->resolvedTypes[$name] = $type;
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
     {
334 334
         $typeLoader = $this->config->typeLoader;
335 335
 
336
-        if (! $typeLoader) {
336
+        if (!$typeLoader) {
337 337
             return $this->defaultTypeLoader($typeName);
338 338
         }
339 339
 
340 340
         $type = $typeLoader($typeName);
341 341
 
342
-        if (! $type instanceof Type) {
342
+        if (!$type instanceof Type) {
343 343
             throw new InvariantViolation(
344 344
                 sprintf(
345 345
                     'Type loader is expected to return valid type "%s", but it returned %s',
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             foreach ($this->getTypeMap() as $type) {
395 395
                 if ($type instanceof ObjectType) {
396 396
                     foreach ($type->getInterfaces() as $interface) {
397
-                        if (! ($interface instanceof InterfaceType)) {
397
+                        if (!($interface instanceof InterfaceType)) {
398 398
                             continue;
399 399
                         }
400 400
 
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
             $type->assertValid();
481 481
 
482 482
             // Make sure type loader returns the same instance as registered in other places of schema
483
-            if (! $this->config->typeLoader) {
483
+            if (!$this->config->typeLoader) {
484 484
                 continue;
485 485
             }
486 486
 
Please login to merge, or discard this patch.
src/Type/SchemaConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
     {
69 69
         $config = new static();
70 70
 
71
-        if (! empty($options)) {
71
+        if (!empty($options)) {
72 72
             if (isset($options['query'])) {
73 73
                 $config->setQuery($options['query']);
74 74
             }
Please login to merge, or discard this patch.
src/Deferred.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     public static function runQueue() : void
39 39
     {
40 40
         $queue = self::getQueue();
41
-        while (! $queue->isEmpty()) {
41
+        while (!$queue->isEmpty()) {
42 42
             /** @var self $dequeuedNodeValue */
43 43
             $dequeuedNodeValue = $queue->dequeue();
44 44
             $dequeuedNodeValue->run();
Please login to merge, or discard this patch.
src/Error/Warning.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
         if (self::$warningHandler !== null) {
102 102
             $fn = self::$warningHandler;
103 103
             $fn($errorMessage, $warningId, $messageLevel);
104
-        } elseif ((self::$enableWarnings & $warningId) > 0 && ! isset(self::$warned[$warningId])) {
104
+        } elseif ((self::$enableWarnings & $warningId) > 0 && !isset(self::$warned[$warningId])) {
105 105
             self::$warned[$warningId] = true;
106 106
             trigger_error($errorMessage, $messageLevel);
107 107
         }
Please login to merge, or discard this patch.
src/Error/FormattedError.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if ($error->nodes) {
70 70
             /** @var Node $node */
71 71
             foreach ($error->nodes as $node) {
72
-                if (! $node->loc) {
72
+                if (!$node->loc) {
73 73
                     continue;
74 74
                 }
75 75
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             }
90 90
         }
91 91
 
92
-        return ! $printedLocations
92
+        return !$printedLocations
93 93
             ? $error->getMessage()
94 94
             : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n";
95 95
     }
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
         if ($e instanceof Error) {
203 203
             $locations = Utils::map(
204 204
                 $e->getLocations(),
205
-                static function (SourceLocation $loc) {
205
+                static function(SourceLocation $loc) {
206 206
                     return $loc->toSerializableArray();
207 207
                 }
208 208
             );
209
-            if (! empty($locations)) {
209
+            if (!empty($locations)) {
210 210
                 $formattedError['locations'] = $locations;
211 211
             }
212
-            if (! empty($e->path)) {
212
+            if (!empty($e->path)) {
213 213
                 $formattedError['path'] = $e->path;
214 214
             }
215
-            if (! empty($e->getExtensions())) {
215
+            if (!empty($e->getExtensions())) {
216 216
                 $formattedError['extensions'] = $e->getExtensions() + $formattedError['extensions'];
217 217
             }
218 218
         }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public static function addDebugEntries(array $formattedError, $e, $debug)
240 240
     {
241
-        if (! $debug) {
241
+        if (!$debug) {
242 242
             return $formattedError;
243 243
         }
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $debug = (int) $debug;
252 252
 
253 253
         if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) {
254
-            if (! $e instanceof Error) {
254
+            if (!$e instanceof Error) {
255 255
                 throw $e;
256 256
             }
257 257
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             }
261 261
         }
262 262
 
263
-        $isUnsafe = ! $e instanceof ClientAware || ! $e->isClientSafe();
263
+        $isUnsafe = !$e instanceof ClientAware || !$e->isClientSafe();
264 264
 
265 265
         if (($debug & Debug::RETHROW_UNSAFE_EXCEPTIONS) && $isUnsafe) {
266 266
             if ($e->getPrevious()) {
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
                 ];
282 282
             }
283 283
 
284
-            $isTrivial = $e instanceof Error && ! $e->getPrevious();
284
+            $isTrivial = $e instanceof Error && !$e->getPrevious();
285 285
 
286
-            if (! $isTrivial) {
286
+            if (!$isTrivial) {
287 287
                 $debugging               = $e->getPrevious() ?: $e;
288 288
                 $formattedError['trace'] = static::toSafeTrace($debugging);
289 289
             }
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public static function prepareFormatter(?callable $formatter = null, $debug)
304 304
     {
305
-        $formatter = $formatter ?: static function ($e) {
305
+        $formatter = $formatter ?: static function($e) {
306 306
             return FormattedError::createFromException($e);
307 307
         };
308 308
         if ($debug) {
309
-            $formatter = static function ($e) use ($formatter, $debug) {
309
+            $formatter = static function($e) use ($formatter, $debug) {
310 310
                 return FormattedError::addDebugEntries($formatter($e), $e, $debug);
311 311
             };
312 312
         }
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
             // Remove invariant entries as they don't provide much value:
332 332
             ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) {
333 333
             array_shift($trace);
334
-        } elseif (! isset($trace[0]['file'])) {
334
+        } elseif (!isset($trace[0]['file'])) {
335 335
             // Remove root call as it's likely error handler trace:
336 336
             array_shift($trace);
337 337
         }
338 338
 
339 339
         return array_map(
340
-            static function ($err) {
340
+            static function($err) {
341 341
                 $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]);
342 342
 
343 343
                 if (isset($err['function'])) {
344 344
                     $func    = $err['function'];
345
-                    $args    = ! empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : [];
345
+                    $args    = !empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : [];
346 346
                     $funcStr = $func . '(' . implode(', ', $args) . ')';
347 347
 
348 348
                     if (isset($err['class'])) {
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $formatted = ['message' => $error];
413 413
 
414
-        if (! empty($locations)) {
414
+        if (!empty($locations)) {
415 415
             $formatted['locations'] = array_map(
416
-                static function ($loc) {
416
+                static function($loc) {
417 417
                     return $loc->toArray();
418 418
                 },
419 419
                 $locations
Please login to merge, or discard this patch.
src/Error/Error.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         // Compute list of blame nodes.
107 107
         if ($nodes instanceof Traversable) {
108 108
             $nodes = iterator_to_array($nodes);
109
-        } elseif ($nodes && ! is_array($nodes)) {
109
+        } elseif ($nodes && !is_array($nodes)) {
110 110
             $nodes = [$nodes];
111 111
         }
112 112
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     public function getSource()
213 213
     {
214 214
         if ($this->source === null) {
215
-            if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) {
215
+            if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) {
216 216
                 $this->source = $this->nodes[0]->loc->source;
217 217
             }
218 218
         }
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function getPositions()
227 227
     {
228
-        if ($this->positions === null && ! empty($this->nodes)) {
228
+        if ($this->positions === null && !empty($this->nodes)) {
229 229
             $positions = array_map(
230
-                static function ($node) {
230
+                static function($node) {
231 231
                     return isset($node->loc) ? $node->loc->start : null;
232 232
                 },
233 233
                 $this->nodes
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
             $positions = array_filter(
237 237
                 $positions,
238
-                static function ($p) {
238
+                static function($p) {
239 239
                     return $p !== null;
240 240
                 }
241 241
             );
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
 
271 271
             if ($positions && $source) {
272 272
                 $this->locations = array_map(
273
-                    static function ($pos) use ($source) {
273
+                    static function($pos) use ($source) {
274 274
                         return $source->getLocation($pos);
275 275
                     },
276 276
                     $positions
277 277
                 );
278 278
             } elseif ($nodes) {
279
-                $locations       = array_filter(
279
+                $locations = array_filter(
280 280
                     array_map(
281
-                        static function ($node) {
281
+                        static function($node) {
282 282
                             if ($node->loc && $node->loc->source) {
283 283
                                 return $node->loc->source->getLocation($node->loc->start);
284 284
                             }
@@ -341,18 +341,18 @@  discard block
 block discarded – undo
341 341
 
342 342
         $locations = Utils::map(
343 343
             $this->getLocations(),
344
-            static function (SourceLocation $loc) {
344
+            static function(SourceLocation $loc) {
345 345
                 return $loc->toSerializableArray();
346 346
             }
347 347
         );
348 348
 
349
-        if (! empty($locations)) {
349
+        if (!empty($locations)) {
350 350
             $arr['locations'] = $locations;
351 351
         }
352
-        if (! empty($this->path)) {
352
+        if (!empty($this->path)) {
353 353
             $arr['path'] = $this->path;
354 354
         }
355
-        if (! empty($this->extensions)) {
355
+        if (!empty($this->extensions)) {
356 356
             $arr['extensions'] = $this->extensions;
357 357
         }
358 358
 
Please login to merge, or discard this patch.
src/Language/Visitor.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $isEdited  = $isLeaving && count($edits) !== 0;
209 209
 
210 210
             if ($isLeaving) {
211
-                $key    = ! $ancestors ? $UNDEFINED : $path[count($path) - 1];
211
+                $key    = !$ancestors ? $UNDEFINED : $path[count($path) - 1];
212 212
                 $node   = $parent;
213 213
                 $parent = array_pop($ancestors);
214 214
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $inArray = $stack['inArray'];
252 252
                 $stack   = $stack['prev'];
253 253
             } else {
254
-                $key  = $parent !== null
254
+                $key = $parent !== null
255 255
                     ? ($inArray
256 256
                         ? $index
257 257
                         : $keys[$index]
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
             }
273 273
 
274 274
             $result = null;
275
-            if (! $node instanceof NodeList && ! is_array($node)) {
276
-                if (! ($node instanceof Node)) {
275
+            if (!$node instanceof NodeList && !is_array($node)) {
276
+                if (!($node instanceof Node)) {
277 277
                     throw new Exception('Invalid AST Node: ' . json_encode($node));
278 278
                 }
279 279
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                             if ($result->doBreak) {
289 289
                                 break;
290 290
                             }
291
-                            if (! $isLeaving && $result->doContinue) {
291
+                            if (!$isLeaving && $result->doContinue) {
292 292
                                 array_pop($path);
293 293
                                 continue;
294 294
                             }
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
                         }
301 301
 
302 302
                         $edits[] = [$key, $editValue];
303
-                        if (! $isLeaving) {
304
-                            if (! ($editValue instanceof Node)) {
303
+                        if (!$isLeaving) {
304
+                            if (!($editValue instanceof Node)) {
305 305
                                 array_pop($path);
306 306
                                 continue;
307 307
                             }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             if ($isLeaving) {
320 320
                 array_pop($path);
321 321
             } else {
322
-                $stack   = [
322
+                $stack = [
323 323
                     'inArray' => $inArray,
324 324
                     'index'   => $index,
325 325
                     'keys'    => $keys,
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
         $skipping      = new SplFixedArray($visitorsCount);
402 402
 
403 403
         return [
404
-            'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
404
+            'enter' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) {
405 405
                 for ($i = 0; $i < $visitorsCount; $i++) {
406
-                    if (! empty($skipping[$i])) {
406
+                    if (!empty($skipping[$i])) {
407 407
                         continue;
408 408
                     }
409 409
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         false
414 414
                     );
415 415
 
416
-                    if (! $fn) {
416
+                    if (!$fn) {
417 417
                         continue;
418 418
                     }
419 419
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                     }
433 433
                 }
434 434
             },
435
-            'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
435
+            'leave' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) {
436 436
                 for ($i = 0; $i < $visitorsCount; $i++) {
437 437
                     if (empty($skipping[$i])) {
438 438
                         $fn = self::getVisitFn(
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
     public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor)
469 469
     {
470 470
         return [
471
-            'enter' => static function (Node $node) use ($typeInfo, $visitor) {
471
+            'enter' => static function(Node $node) use ($typeInfo, $visitor) {
472 472
                 $typeInfo->enter($node);
473 473
                 $fn = self::getVisitFn($visitor, $node->kind, false);
474 474
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
                 return null;
488 488
             },
489
-            'leave' => static function (Node $node) use ($typeInfo, $visitor) {
489
+            'leave' => static function(Node $node) use ($typeInfo, $visitor) {
490 490
                 $fn     = self::getVisitFn($visitor, $node->kind, true);
491 491
                 $result = $fn ? call_user_func_array($fn, func_get_args()) : null;
492 492
                 $typeInfo->leave($node);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
         $kindVisitor = $visitor[$kind] ?? null;
513 513
 
514
-        if (! $isLeaving && is_callable($kindVisitor)) {
514
+        if (!$isLeaving && is_callable($kindVisitor)) {
515 515
             // { Kind() {} }
516 516
             return $kindVisitor;
517 517
         }
Please login to merge, or discard this patch.