Passed
Push — master ( 6fd55f...3cccd4 )
by Šimon
06:47 queued 03:57
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/Introspection.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             );
62 62
             $descriptions = $options;
63 63
         } else {
64
-            $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true;
64
+            $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true;
65 65
         }
66 66
         $descriptionField = $descriptions ? 'description' : '';
67 67
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
     public static function _schema()
188 188
     {
189
-        if (! isset(self::$map['__Schema'])) {
189
+        if (!isset(self::$map['__Schema'])) {
190 190
             self::$map['__Schema'] = new ObjectType([
191 191
                 'name'            => '__Schema',
192 192
                 'isIntrospection' => true,
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
                     'types'            => [
200 200
                         'description' => 'A list of all types supported by this server.',
201 201
                         'type'        => new NonNull(new ListOfType(new NonNull(self::_type()))),
202
-                        'resolve'     => static function (Schema $schema) {
202
+                        'resolve'     => static function(Schema $schema) {
203 203
                             return array_values($schema->getTypeMap());
204 204
                         },
205 205
                     ],
206 206
                     'queryType'        => [
207 207
                         'description' => 'The type that query operations will be rooted at.',
208 208
                         'type'        => new NonNull(self::_type()),
209
-                        'resolve'     => static function (Schema $schema) {
209
+                        'resolve'     => static function(Schema $schema) {
210 210
                             return $schema->getQueryType();
211 211
                         },
212 212
                     ],
@@ -215,21 +215,21 @@  discard block
 block discarded – undo
215 215
                             'If this server supports mutation, the type that ' .
216 216
                             'mutation operations will be rooted at.',
217 217
                         'type'        => self::_type(),
218
-                        'resolve'     => static function (Schema $schema) {
218
+                        'resolve'     => static function(Schema $schema) {
219 219
                             return $schema->getMutationType();
220 220
                         },
221 221
                     ],
222 222
                     'subscriptionType' => [
223 223
                         'description' => 'If this server support subscription, the type that subscription operations will be rooted at.',
224 224
                         'type'        => self::_type(),
225
-                        'resolve'     => static function (Schema $schema) {
225
+                        'resolve'     => static function(Schema $schema) {
226 226
                             return $schema->getSubscriptionType();
227 227
                         },
228 228
                     ],
229 229
                     'directives'       => [
230 230
                         'description' => 'A list of all directives supported by this server.',
231 231
                         'type'        => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))),
232
-                        'resolve'     => static function (Schema $schema) {
232
+                        'resolve'     => static function(Schema $schema) {
233 233
                             return $schema->getDirectives();
234 234
                         },
235 235
                     ],
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
     public static function _type()
244 244
     {
245
-        if (! isset(self::$map['__Type'])) {
245
+        if (!isset(self::$map['__Type'])) {
246 246
             self::$map['__Type'] = new ObjectType([
247 247
                 'name'            => '__Type',
248 248
                 'isIntrospection' => true,
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
                     'Object and Interface types provide the fields they describe. Abstract ' .
257 257
                     'types, Union and Interface, provide the Object types possible ' .
258 258
                     'at runtime. List and NonNull types compose other types.',
259
-                'fields'          => static function () {
259
+                'fields'          => static function() {
260 260
                     return [
261 261
                         'kind'          => [
262 262
                             'type'    => Type::nonNull(self::_typeKind()),
263
-                            'resolve' => static function (Type $type) {
263
+                            'resolve' => static function(Type $type) {
264 264
                                 switch (true) {
265 265
                                     case $type instanceof ListOfType:
266 266
                                         return TypeKind::LIST_KIND;
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
                         ],
286 286
                         'name'          => [
287 287
                             'type' => Type::string(),
288
-                            'resolve' => static function ($obj) {
288
+                            'resolve' => static function($obj) {
289 289
                                 return $obj->name;
290 290
                             },
291 291
                         ],
292 292
                         'description'   => [
293 293
                             'type' => Type::string(),
294
-                            'resolve' => static function ($obj) {
294
+                            'resolve' => static function($obj) {
295 295
                                 return $obj->description;
296 296
                             },
297 297
                         ],
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
                             'args'    => [
301 301
                                 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false],
302 302
                             ],
303
-                            'resolve' => static function (Type $type, $args) {
303
+                            'resolve' => static function(Type $type, $args) {
304 304
                                 if ($type instanceof ObjectType || $type instanceof InterfaceType) {
305 305
                                     $fields = $type->getFields();
306 306
 
307 307
                                     if (empty($args['includeDeprecated'])) {
308 308
                                         $fields = array_filter(
309 309
                                             $fields,
310
-                                            static function (FieldDefinition $field) {
311
-                                                return ! $field->deprecationReason;
310
+                                            static function(FieldDefinition $field) {
311
+                                                return !$field->deprecationReason;
312 312
                                             }
313 313
                                         );
314 314
                                     }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                         ],
322 322
                         'interfaces'    => [
323 323
                             'type'    => Type::listOf(Type::nonNull(self::_type())),
324
-                            'resolve' => static function ($type) {
324
+                            'resolve' => static function($type) {
325 325
                                 if ($type instanceof ObjectType) {
326 326
                                     return $type->getInterfaces();
327 327
                                 }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                         ],
332 332
                         'possibleTypes' => [
333 333
                             'type'    => Type::listOf(Type::nonNull(self::_type())),
334
-                            'resolve' => static function ($type, $args, $context, ResolveInfo $info) {
334
+                            'resolve' => static function($type, $args, $context, ResolveInfo $info) {
335 335
                                 if ($type instanceof InterfaceType || $type instanceof UnionType) {
336 336
                                     return $info->schema->getPossibleTypes($type);
337 337
                                 }
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
                             'args'    => [
345 345
                                 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false],
346 346
                             ],
347
-                            'resolve' => static function ($type, $args) {
347
+                            'resolve' => static function($type, $args) {
348 348
                                 if ($type instanceof EnumType) {
349 349
                                     $values = array_values($type->getValues());
350 350
 
351 351
                                     if (empty($args['includeDeprecated'])) {
352 352
                                         $values = array_filter(
353 353
                                             $values,
354
-                                            static function ($value) {
355
-                                                return ! $value->deprecationReason;
354
+                                            static function($value) {
355
+                                                return !$value->deprecationReason;
356 356
                                             }
357 357
                                         );
358 358
                                     }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                         ],
366 366
                         'inputFields'   => [
367 367
                             'type'    => Type::listOf(Type::nonNull(self::_inputValue())),
368
-                            'resolve' => static function ($type) {
368
+                            'resolve' => static function($type) {
369 369
                                 if ($type instanceof InputObjectType) {
370 370
                                     return array_values($type->getFields());
371 371
                                 }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                         ],
376 376
                         'ofType'        => [
377 377
                             'type'    => self::_type(),
378
-                            'resolve' => static function ($type) {
378
+                            'resolve' => static function($type) {
379 379
                                 if ($type instanceof WrappingType) {
380 380
                                     return $type->getWrappedType();
381 381
                                 }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
     public static function _typeKind()
395 395
     {
396
-        if (! isset(self::$map['__TypeKind'])) {
396
+        if (!isset(self::$map['__TypeKind'])) {
397 397
             self::$map['__TypeKind'] = new EnumType([
398 398
                 'name'            => '__TypeKind',
399 399
                 'isIntrospection' => true,
@@ -440,48 +440,48 @@  discard block
 block discarded – undo
440 440
 
441 441
     public static function _field()
442 442
     {
443
-        if (! isset(self::$map['__Field'])) {
443
+        if (!isset(self::$map['__Field'])) {
444 444
             self::$map['__Field'] = new ObjectType([
445 445
                 'name'            => '__Field',
446 446
                 'isIntrospection' => true,
447 447
                 'description'     =>
448 448
                     'Object and Interface types are described by a list of Fields, each of ' .
449 449
                     'which has a name, potentially a list of arguments, and a return type.',
450
-                'fields'          => static function () {
450
+                'fields'          => static function() {
451 451
                     return [
452 452
                         'name'              => [
453 453
                             'type' => Type::nonNull(Type::string()),
454
-                            'resolve' => static function (FieldDefinition $field) {
454
+                            'resolve' => static function(FieldDefinition $field) {
455 455
                                 return $field->name;
456 456
                             },
457 457
                         ],
458 458
                         'description'       => [
459 459
                             'type' => Type::string(),
460
-                            'resolve' => static function (FieldDefinition $field) {
460
+                            'resolve' => static function(FieldDefinition $field) {
461 461
                                 return $field->description;
462 462
                             },
463 463
                         ],
464 464
                         'args'              => [
465 465
                             'type'    => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
466
-                            'resolve' => static function (FieldDefinition $field) {
466
+                            'resolve' => static function(FieldDefinition $field) {
467 467
                                 return empty($field->args) ? [] : $field->args;
468 468
                             },
469 469
                         ],
470 470
                         'type'              => [
471 471
                             'type'    => Type::nonNull(self::_type()),
472
-                            'resolve' => static function (FieldDefinition $field) {
472
+                            'resolve' => static function(FieldDefinition $field) {
473 473
                                 return $field->getType();
474 474
                             },
475 475
                         ],
476 476
                         'isDeprecated'      => [
477 477
                             'type'    => Type::nonNull(Type::boolean()),
478
-                            'resolve' => static function (FieldDefinition $field) {
478
+                            'resolve' => static function(FieldDefinition $field) {
479 479
                                 return (bool) $field->deprecationReason;
480 480
                             },
481 481
                         ],
482 482
                         'deprecationReason' => [
483 483
                             'type'    => Type::string(),
484
-                            'resolve' => static function (FieldDefinition $field) {
484
+                            'resolve' => static function(FieldDefinition $field) {
485 485
                                 return $field->deprecationReason;
486 486
                             },
487 487
                         ],
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 
496 496
     public static function _inputValue()
497 497
     {
498
-        if (! isset(self::$map['__InputValue'])) {
498
+        if (!isset(self::$map['__InputValue'])) {
499 499
             self::$map['__InputValue'] = new ObjectType([
500 500
                 'name'            => '__InputValue',
501 501
                 'isIntrospection' => true,
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
                     'Arguments provided to Fields or Directives and the input fields of an ' .
504 504
                     'InputObject are represented as Input Values which describe their type ' .
505 505
                     'and optionally a default value.',
506
-                'fields'          => static function () {
506
+                'fields'          => static function() {
507 507
                     return [
508 508
                         'name'         => [
509 509
                             'type' => Type::nonNull(Type::string()),
510
-                            'resolve' => static function ($inputValue) {
510
+                            'resolve' => static function($inputValue) {
511 511
                                 /** @var FieldArgument|InputObjectField $inputValue */
512 512
                                 $inputValue = $inputValue;
513 513
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                         ],
517 517
                         'description'  => [
518 518
                             'type' => Type::string(),
519
-                            'resolve' => static function ($inputValue) {
519
+                            'resolve' => static function($inputValue) {
520 520
                                 /** @var FieldArgument|InputObjectField $inputValue */
521 521
                                 $inputValue = $inputValue;
522 522
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                         ],
526 526
                         'type'         => [
527 527
                             'type'    => Type::nonNull(self::_type()),
528
-                            'resolve' => static function ($value) {
528
+                            'resolve' => static function($value) {
529 529
                                 return method_exists($value, 'getType')
530 530
                                     ? $value->getType()
531 531
                                     : $value->type;
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
                             'type'        => Type::string(),
536 536
                             'description' =>
537 537
                                 'A GraphQL-formatted string representing the default value for this input value.',
538
-                            'resolve'     => static function ($inputValue) {
538
+                            'resolve'     => static function($inputValue) {
539 539
                                 /** @var FieldArgument|InputObjectField $inputValue */
540 540
                                 $inputValue = $inputValue;
541 541
 
542
-                                return ! $inputValue->defaultValueExists()
542
+                                return !$inputValue->defaultValueExists()
543 543
                                     ? null
544 544
                                     : Printer::doPrint(AST::astFromValue(
545 545
                                         $inputValue->defaultValue,
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
     public static function _enumValue()
559 559
     {
560
-        if (! isset(self::$map['__EnumValue'])) {
560
+        if (!isset(self::$map['__EnumValue'])) {
561 561
             self::$map['__EnumValue'] = new ObjectType([
562 562
                 'name'            => '__EnumValue',
563 563
                 'isIntrospection' => true,
@@ -568,25 +568,25 @@  discard block
 block discarded – undo
568 568
                 'fields'          => [
569 569
                     'name'              => [
570 570
                         'type' => Type::nonNull(Type::string()),
571
-                        'resolve' => static function ($enumValue) {
571
+                        'resolve' => static function($enumValue) {
572 572
                             return $enumValue->name;
573 573
                         },
574 574
                     ],
575 575
                     'description'       => [
576 576
                         'type' => Type::string(),
577
-                        'resolve' => static function ($enumValue) {
577
+                        'resolve' => static function($enumValue) {
578 578
                             return $enumValue->description;
579 579
                         },
580 580
                     ],
581 581
                     'isDeprecated'      => [
582 582
                         'type'    => Type::nonNull(Type::boolean()),
583
-                        'resolve' => static function ($enumValue) {
583
+                        'resolve' => static function($enumValue) {
584 584
                             return (bool) $enumValue->deprecationReason;
585 585
                         },
586 586
                     ],
587 587
                     'deprecationReason' => [
588 588
                         'type' => Type::string(),
589
-                        'resolve' => static function ($enumValue) {
589
+                        'resolve' => static function($enumValue) {
590 590
                             return $enumValue->deprecationReason;
591 591
                         },
592 592
                     ],
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
     public static function _directive()
601 601
     {
602
-        if (! isset(self::$map['__Directive'])) {
602
+        if (!isset(self::$map['__Directive'])) {
603 603
             self::$map['__Directive'] = new ObjectType([
604 604
                 'name'            => '__Directive',
605 605
                 'isIntrospection' => true,
@@ -612,13 +612,13 @@  discard block
 block discarded – undo
612 612
                 'fields'          => [
613 613
                     'name'        => [
614 614
                         'type'    => Type::nonNull(Type::string()),
615
-                        'resolve' => static function ($obj) {
615
+                        'resolve' => static function($obj) {
616 616
                             return $obj->name;
617 617
                         },
618 618
                     ],
619 619
                     'description' => [
620 620
                         'type' => Type::string(),
621
-                        'resolve' => static function ($obj) {
621
+                        'resolve' => static function($obj) {
622 622
                             return $obj->description;
623 623
                         },
624 624
                     ],
@@ -626,13 +626,13 @@  discard block
 block discarded – undo
626 626
                         'type' => Type::nonNull(Type::listOf(Type::nonNull(
627 627
                             self::_directiveLocation()
628 628
                         ))),
629
-                        'resolve' => static function ($obj) {
629
+                        'resolve' => static function($obj) {
630 630
                             return $obj->locations;
631 631
                         },
632 632
                     ],
633 633
                     'args'        => [
634 634
                         'type'    => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
635
-                        'resolve' => static function (Directive $directive) {
635
+                        'resolve' => static function(Directive $directive) {
636 636
                             return $directive->args ?: [];
637 637
                         },
638 638
                     ],
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
     public static function _directiveLocation()
647 647
     {
648
-        if (! isset(self::$map['__DirectiveLocation'])) {
648
+        if (!isset(self::$map['__DirectiveLocation'])) {
649 649
             self::$map['__DirectiveLocation'] = new EnumType([
650 650
                 'name'            => '__DirectiveLocation',
651 651
                 'isIntrospection' => true,
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
 
740 740
     public static function schemaMetaFieldDef() : FieldDefinition
741 741
     {
742
-        if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) {
742
+        if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) {
743 743
             self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([
744 744
                 'name'        => self::SCHEMA_FIELD_NAME,
745 745
                 'type'        => Type::nonNull(self::_schema()),
746 746
                 'description' => 'Access the current type schema of this server.',
747 747
                 'args'        => [],
748
-                'resolve'     => static function (
748
+                'resolve'     => static function(
749 749
                     $source,
750 750
                     $args,
751 751
                     $context,
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 
762 762
     public static function typeMetaFieldDef() : FieldDefinition
763 763
     {
764
-        if (! isset(self::$map[self::TYPE_FIELD_NAME])) {
764
+        if (!isset(self::$map[self::TYPE_FIELD_NAME])) {
765 765
             self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([
766 766
                 'name'        => self::TYPE_FIELD_NAME,
767 767
                 'type'        => self::_type(),
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
                 'args'        => [
770 770
                     ['name' => 'name', 'type' => Type::nonNull(Type::string())],
771 771
                 ],
772
-                'resolve'     => static function ($source, $args, $context, ResolveInfo $info) {
772
+                'resolve'     => static function($source, $args, $context, ResolveInfo $info) {
773 773
                     return $info->schema->getType($args['name']);
774 774
                 },
775 775
             ]);
@@ -780,13 +780,13 @@  discard block
 block discarded – undo
780 780
 
781 781
     public static function typeNameMetaFieldDef() : FieldDefinition
782 782
     {
783
-        if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) {
783
+        if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) {
784 784
             self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([
785 785
                 'name'        => self::TYPE_NAME_FIELD_NAME,
786 786
                 'type'        => Type::nonNull(Type::string()),
787 787
                 'description' => 'The name of the current Object type at runtime.',
788 788
                 'args'        => [],
789
-                'resolve'     => static function (
789
+                'resolve'     => static function(
790 790
                     $source,
791 791
                     $args,
792 792
                     $context,
Please login to merge, or discard this patch.
src/Type/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.