@@ -74,12 +74,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $breakingChanges = []; |
| 122 | 122 | foreach ($schemaATypeMap as $typeName => $schemaAType) { |
| 123 | - if (! isset($schemaBTypeMap[$typeName])) { |
|
| 123 | + if (!isset($schemaBTypeMap[$typeName])) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | $schemaBType = $schemaBTypeMap[$typeName]; |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | $breakingChanges = []; |
| 191 | 191 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 192 | 192 | $newType = $newTypeMap[$typeName] ?? null; |
| 193 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 194 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 195 | - ! ($newType instanceof $oldType) |
|
| 193 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 194 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 195 | + !($newType instanceof $oldType) |
|
| 196 | 196 | ) { |
| 197 | 197 | continue; |
| 198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $newTypeFieldsDef = $newType->getFields(); |
| 202 | 202 | foreach ($oldTypeFieldsDef as $fieldName => $fieldDefinition) { |
| 203 | 203 | // Check if the field is missing on the type in the new schema. |
| 204 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
| 204 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
| 205 | 205 | $breakingChanges[] = [ |
| 206 | 206 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
| 207 | 207 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $oldFieldType, |
| 214 | 214 | $newFieldType |
| 215 | 215 | ); |
| 216 | - if (! $isSafe) { |
|
| 216 | + if (!$isSafe) { |
|
| 217 | 217 | $oldFieldTypeString = $oldFieldType instanceof NamedType && $oldFieldType instanceof Type |
| 218 | 218 | ? $oldFieldType->name |
| 219 | 219 | : $oldFieldType; |
@@ -283,14 +283,14 @@ discard block |
||
| 283 | 283 | $dangerousChanges = []; |
| 284 | 284 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 285 | 285 | $newType = $newTypeMap[$typeName] ?? null; |
| 286 | - if (! ($oldType instanceof InputObjectType) || ! ($newType instanceof InputObjectType)) { |
|
| 286 | + if (!($oldType instanceof InputObjectType) || !($newType instanceof InputObjectType)) { |
|
| 287 | 287 | continue; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $oldTypeFieldsDef = $oldType->getFields(); |
| 291 | 291 | $newTypeFieldsDef = $newType->getFields(); |
| 292 | 292 | foreach (array_keys($oldTypeFieldsDef) as $fieldName) { |
| 293 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
| 293 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
| 294 | 294 | $breakingChanges[] = [ |
| 295 | 295 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
| 296 | 296 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $oldFieldType, |
| 304 | 304 | $newFieldType |
| 305 | 305 | ); |
| 306 | - if (! $isSafe) { |
|
| 306 | + if (!$isSafe) { |
|
| 307 | 307 | if ($oldFieldType instanceof NamedType) { |
| 308 | 308 | $oldFieldTypeString = $oldFieldType->name; |
| 309 | 309 | } else { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | Type $newType |
| 357 | 357 | ) { |
| 358 | 358 | if ($oldType instanceof NamedType) { |
| 359 | - if (! $newType instanceof NamedType) { |
|
| 359 | + if (!$newType instanceof NamedType) { |
|
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $newType->getWrappedType() |
| 383 | 383 | )) || |
| 384 | 384 | // moving from non-null to nullable of the same underlying type is safe |
| 385 | - ! ($newType instanceof NonNull) && |
|
| 385 | + !($newType instanceof NonNull) && |
|
| 386 | 386 | self::isChangeSafeForInputObjectFieldOrFieldArg($oldType->getWrappedType(), $newType); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $typesRemovedFromUnion = []; |
| 406 | 406 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 407 | 407 | $newType = $newTypeMap[$typeName] ?? null; |
| 408 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
| 408 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
| 409 | 409 | continue; |
| 410 | 410 | } |
| 411 | 411 | $typeNamesInNewUnion = []; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | $valuesRemovedFromEnums = []; |
| 444 | 444 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 445 | 445 | $newType = $newTypeMap[$typeName] ?? null; |
| 446 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
| 446 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
| 447 | 447 | continue; |
| 448 | 448 | } |
| 449 | 449 | $valuesInNewEnum = []; |
@@ -485,9 +485,9 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 487 | 487 | $newType = $newTypeMap[$typeName] ?? null; |
| 488 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 489 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 490 | - ! ($newType instanceof $oldType) |
|
| 488 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 489 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 490 | + !($newType instanceof $oldType) |
|
| 491 | 491 | ) { |
| 492 | 492 | continue; |
| 493 | 493 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | $newTypeFields = $newType->getFields(); |
| 497 | 497 | |
| 498 | 498 | foreach ($oldTypeFields as $fieldName => $oldField) { |
| 499 | - if (! isset($newTypeFields[$fieldName])) { |
|
| 499 | + if (!isset($newTypeFields[$fieldName])) { |
|
| 500 | 500 | continue; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $newArgs = $newTypeFields[$fieldName]->args; |
| 505 | 505 | $newArgDef = Utils::find( |
| 506 | 506 | $newArgs, |
| 507 | - static function ($arg) use ($oldArgDef) { |
|
| 507 | + static function($arg) use ($oldArgDef) { |
|
| 508 | 508 | return $arg->name === $oldArgDef->name; |
| 509 | 509 | } |
| 510 | 510 | ); |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $oldArgType */ |
| 517 | 517 | $oldArgType = $oldArgDef->getType(); |
| 518 | 518 | $oldArgName = $oldArgDef->name; |
| 519 | - if (! $isSafe) { |
|
| 519 | + if (!$isSafe) { |
|
| 520 | 520 | $newArgType = $newArgDef->getType(); |
| 521 | 521 | $breakingChanges[] = [ |
| 522 | 522 | 'type' => self::BREAKING_CHANGE_ARG_CHANGED_KIND, |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $oldArgs = $oldTypeFields[$fieldName]->args; |
| 545 | 545 | $oldArgDef = Utils::find( |
| 546 | 546 | $oldArgs, |
| 547 | - static function ($arg) use ($newTypeFieldArgDef) { |
|
| 547 | + static function($arg) use ($newTypeFieldArgDef) { |
|
| 548 | 548 | return $arg->name === $newTypeFieldArgDef->name; |
| 549 | 549 | } |
| 550 | 550 | ); |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 592 | 592 | $newType = $newTypeMap[$typeName] ?? null; |
| 593 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
| 593 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
| 594 | 594 | continue; |
| 595 | 595 | } |
| 596 | 596 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | foreach ($oldInterfaces as $oldInterface) { |
| 600 | 600 | $interface = Utils::find( |
| 601 | 601 | $newInterfaces, |
| 602 | - static function (InterfaceType $interface) use ($oldInterface) : bool { |
|
| 602 | + static function(InterfaceType $interface) use ($oldInterface) : bool { |
|
| 603 | 603 | return $interface->name === $oldInterface->name; |
| 604 | 604 | } |
| 605 | 605 | ); |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | { |
| 644 | 644 | return Utils::keyMap( |
| 645 | 645 | $schema->getDirectives(), |
| 646 | - static function ($dir) { |
|
| 646 | + static function($dir) { |
|
| 647 | 647 | return $dir->name; |
| 648 | 648 | } |
| 649 | 649 | ); |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 656 | 656 | |
| 657 | 657 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 658 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 658 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 659 | 659 | continue; |
| 660 | 660 | } |
| 661 | 661 | |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | { |
| 693 | 693 | return Utils::keyMap( |
| 694 | 694 | $directive->args ?: [], |
| 695 | - static function ($arg) { |
|
| 695 | + static function($arg) { |
|
| 696 | 696 | return $arg->name; |
| 697 | 697 | } |
| 698 | 698 | ); |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 705 | 705 | |
| 706 | 706 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 707 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 707 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 708 | 708 | continue; |
| 709 | 709 | } |
| 710 | 710 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | $oldSchemaDirectiveMap[$newDirective->name], |
| 713 | 713 | $newDirective |
| 714 | 714 | ) as $arg) { |
| 715 | - if (! $arg->getType() instanceof NonNull) { |
|
| 715 | + if (!$arg->getType() instanceof NonNull) { |
|
| 716 | 716 | continue; |
| 717 | 717 | } |
| 718 | 718 | $addedNonNullableArgs[] = [ |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 757 | 757 | |
| 758 | 758 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 759 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 759 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 760 | 760 | continue; |
| 761 | 761 | } |
| 762 | 762 | |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | $valuesAddedToEnums = []; |
| 823 | 823 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 824 | 824 | $newType = $newTypeMap[$typeName] ?? null; |
| 825 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
| 825 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
| 826 | 826 | continue; |
| 827 | 827 | } |
| 828 | 828 | $valuesInOldEnum = []; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | foreach ($newTypeMap as $typeName => $newType) { |
| 859 | 859 | $oldType = $oldTypeMap[$typeName] ?? null; |
| 860 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
| 860 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
| 861 | 861 | continue; |
| 862 | 862 | } |
| 863 | 863 | |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | foreach ($newInterfaces as $newInterface) { |
| 867 | 867 | $interface = Utils::find( |
| 868 | 868 | $oldInterfaces, |
| 869 | - static function (InterfaceType $interface) use ($newInterface) : bool { |
|
| 869 | + static function(InterfaceType $interface) use ($newInterface) : bool { |
|
| 870 | 870 | return $interface->name === $newInterface->name; |
| 871 | 871 | } |
| 872 | 872 | ); |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | $typesAddedToUnion = []; |
| 906 | 906 | foreach ($newTypeMap as $typeName => $newType) { |
| 907 | 907 | $oldType = $oldTypeMap[$typeName] ?? null; |
| 908 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
| 908 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
| 909 | 909 | continue; |
| 910 | 910 | } |
| 911 | 911 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | return self::printFilteredSchema( |
| 53 | 53 | $schema, |
| 54 | - static function ($type) { |
|
| 55 | - return ! Directive::isSpecifiedDirective($type); |
|
| 54 | + static function($type) { |
|
| 55 | + return !Directive::isSpecifiedDirective($type); |
|
| 56 | 56 | }, |
| 57 | - static function ($type) { |
|
| 58 | - return ! Type::isBuiltInType($type); |
|
| 57 | + static function($type) { |
|
| 58 | + return !Type::isBuiltInType($type); |
|
| 59 | 59 | }, |
| 60 | 60 | $options |
| 61 | 61 | ); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $directives = array_filter( |
| 70 | 70 | $schema->getDirectives(), |
| 71 | - static function ($directive) use ($directiveFilter) { |
|
| 71 | + static function($directive) use ($directiveFilter) { |
|
| 72 | 72 | return $directiveFilter($directive); |
| 73 | 73 | } |
| 74 | 74 | ); |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | array_merge( |
| 86 | 86 | [self::printSchemaDefinition($schema)], |
| 87 | 87 | array_map( |
| 88 | - static function ($directive) use ($options) { |
|
| 88 | + static function($directive) use ($options) { |
|
| 89 | 89 | return self::printDirective($directive, $options); |
| 90 | 90 | }, |
| 91 | 91 | $directives |
| 92 | 92 | ), |
| 93 | 93 | array_map( |
| 94 | - static function ($type) use ($options) { |
|
| 94 | + static function($type) use ($options) { |
|
| 95 | 95 | return self::printType($type, $options); |
| 96 | 96 | }, |
| 97 | 97 | $types |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $subscriptionType = $schema->getSubscriptionType(); |
| 156 | 156 | |
| 157 | - return ! $subscriptionType || $subscriptionType->name === 'Subscription'; |
|
| 157 | + return !$subscriptionType || $subscriptionType->name === 'Subscription'; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | private static function printDirective($directive, $options) : string |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | private static function printDescription($options, $def, $indentation = '', $firstInBlock = true) : string |
| 168 | 168 | { |
| 169 | - if (! $def->description) { |
|
| 169 | + if (!$def->description) { |
|
| 170 | 170 | return ''; |
| 171 | 171 | } |
| 172 | 172 | $lines = self::descriptionLines($def->description, 120 - strlen($indentation)); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | return self::printDescriptionWithComments($lines, $indentation, $firstInBlock); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $description = $indentation && ! $firstInBlock |
|
| 177 | + $description = $indentation && !$firstInBlock |
|
| 178 | 178 | ? "\n" . $indentation . '"""' |
| 179 | 179 | : $indentation . '"""'; |
| 180 | 180 | |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | substr($lines[0], 0, 1) === ' ' || |
| 193 | 193 | substr($lines[0], 0, 1) === '\t' |
| 194 | 194 | ); |
| 195 | - if (! $hasLeadingSpace) { |
|
| 195 | + if (!$hasLeadingSpace) { |
|
| 196 | 196 | $description .= "\n"; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | $lineLength = count($lines); |
| 200 | 200 | for ($i = 0; $i < $lineLength; $i++) { |
| 201 | - if ($i !== 0 || ! $hasLeadingSpace) { |
|
| 201 | + if ($i !== 0 || !$hasLeadingSpace) { |
|
| 202 | 202 | $description .= $indentation; |
| 203 | 203 | } |
| 204 | 204 | $description .= self::escapeQuote($lines[$i]) . "\n"; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | private static function printDescriptionWithComments($lines, $indentation, $firstInBlock) : string |
| 249 | 249 | { |
| 250 | - $description = $indentation && ! $firstInBlock ? "\n" : ''; |
|
| 250 | + $description = $indentation && !$firstInBlock ? "\n" : ''; |
|
| 251 | 251 | foreach ($lines as $line) { |
| 252 | 252 | if ($line === '') { |
| 253 | 253 | $description .= $indentation . "#\n"; |
@@ -266,14 +266,14 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | private static function printArgs($options, $args, $indentation = '') : string |
| 268 | 268 | { |
| 269 | - if (! $args) { |
|
| 269 | + if (!$args) { |
|
| 270 | 270 | return ''; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // If every arg does not have a description, print them on one line. |
| 274 | 274 | if (Utils::every( |
| 275 | 275 | $args, |
| 276 | - static function ($arg) { |
|
| 276 | + static function($arg) { |
|
| 277 | 277 | return empty($arg->description); |
| 278 | 278 | } |
| 279 | 279 | )) { |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | implode( |
| 286 | 286 | "\n", |
| 287 | 287 | array_map( |
| 288 | - static function ($arg, $i) use ($indentation, $options) { |
|
| 289 | - return self::printDescription($options, $arg, ' ' . $indentation, ! $i) . ' ' . $indentation . |
|
| 288 | + static function($arg, $i) use ($indentation, $options) { |
|
| 289 | + return self::printDescription($options, $arg, ' ' . $indentation, !$i) . ' ' . $indentation . |
|
| 290 | 290 | self::printInputValue($arg); |
| 291 | 291 | }, |
| 292 | 292 | $args, |
@@ -353,11 +353,11 @@ discard block |
||
| 353 | 353 | private static function printObject(ObjectType $type, array $options) : string |
| 354 | 354 | { |
| 355 | 355 | $interfaces = $type->getInterfaces(); |
| 356 | - $implementedInterfaces = ! empty($interfaces) |
|
| 356 | + $implementedInterfaces = !empty($interfaces) |
|
| 357 | 357 | ? ' implements ' . implode( |
| 358 | 358 | ' & ', |
| 359 | 359 | array_map( |
| 360 | - static function ($i) { |
|
| 360 | + static function($i) { |
|
| 361 | 361 | return $i->name; |
| 362 | 362 | }, |
| 363 | 363 | $interfaces |
@@ -379,8 +379,8 @@ discard block |
||
| 379 | 379 | return implode( |
| 380 | 380 | "\n", |
| 381 | 381 | array_map( |
| 382 | - static function ($f, $i) use ($options) { |
|
| 383 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . |
|
| 382 | + static function($f, $i) use ($options) { |
|
| 383 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . |
|
| 384 | 384 | $f->name . self::printArgs($options, $f->args, ' ') . ': ' . |
| 385 | 385 | (string) $f->getType() . self::printDeprecated($f); |
| 386 | 386 | }, |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | return implode( |
| 440 | 440 | "\n", |
| 441 | 441 | array_map( |
| 442 | - static function ($value, $i) use ($options) { |
|
| 443 | - return self::printDescription($options, $value, ' ', ! $i) . ' ' . |
|
| 442 | + static function($value, $i) use ($options) { |
|
| 443 | + return self::printDescription($options, $value, ' ', !$i) . ' ' . |
|
| 444 | 444 | $value->name . self::printDeprecated($value); |
| 445 | 445 | }, |
| 446 | 446 | $values, |
@@ -463,8 +463,8 @@ discard block |
||
| 463 | 463 | implode( |
| 464 | 464 | "\n", |
| 465 | 465 | array_map( |
| 466 | - static function ($f, $i) use ($options) { |
|
| 467 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . self::printInputValue($f); |
|
| 466 | + static function($f, $i) use ($options) { |
|
| 467 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . self::printInputValue($f); |
|
| 468 | 468 | }, |
| 469 | 469 | $fields, |
| 470 | 470 | array_keys($fields) |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public static function fromArray(array $node) : Node |
| 90 | 90 | { |
| 91 | - if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) { |
|
| 91 | + if (!isset($node['kind']) || !isset(NodeKind::$classMap[$node['kind']])) { |
|
| 92 | 92 | throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node)); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $valuesNodes = []; |
| 177 | 177 | foreach ($value as $item) { |
| 178 | 178 | $itemNode = self::astFromValue($item, $itemType); |
| 179 | - if (! $itemNode) { |
|
| 179 | + if (!$itemNode) { |
|
| 180 | 180 | continue; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | if ($type instanceof InputObjectType) { |
| 195 | 195 | $isArray = is_array($value); |
| 196 | 196 | $isArrayLike = $isArray || $value instanceof ArrayAccess; |
| 197 | - if ($value === null || (! $isArrayLike && ! is_object($value))) { |
|
| 197 | + if ($value === null || (!$isArrayLike && !is_object($value))) { |
|
| 198 | 198 | return null; |
| 199 | 199 | } |
| 200 | 200 | $fields = $type->getFields(); |
@@ -218,13 +218,13 @@ discard block |
||
| 218 | 218 | $fieldExists = property_exists($value, $fieldName); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if (! $fieldExists) { |
|
| 221 | + if (!$fieldExists) { |
|
| 222 | 222 | continue; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $fieldNode = self::astFromValue($fieldValue, $field->getType()); |
| 226 | 226 | |
| 227 | - if (! $fieldNode) { |
|
| 227 | + if (!$fieldNode) { |
|
| 228 | 228 | continue; |
| 229 | 229 | } |
| 230 | 230 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | if ($valueNode instanceof VariableNode) { |
| 344 | 344 | $variableName = $valueNode->name->value; |
| 345 | 345 | |
| 346 | - if (! $variables || ! array_key_exists($variableName, $variables)) { |
|
| 346 | + if (!$variables || !array_key_exists($variableName, $variables)) { |
|
| 347 | 347 | // No valid return value. |
| 348 | 348 | return $undefined; |
| 349 | 349 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | if ($type instanceof InputObjectType) { |
| 399 | - if (! $valueNode instanceof ObjectValueNode) { |
|
| 399 | + if (!$valueNode instanceof ObjectValueNode) { |
|
| 400 | 400 | // Invalid: intentionally return no value. |
| 401 | 401 | return $undefined; |
| 402 | 402 | } |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $fields = $type->getFields(); |
| 406 | 406 | $fieldNodes = Utils::keyMap( |
| 407 | 407 | $valueNode->fields, |
| 408 | - static function ($field) { |
|
| 408 | + static function($field) { |
|
| 409 | 409 | return $field->name->value; |
| 410 | 410 | } |
| 411 | 411 | ); |
@@ -441,11 +441,11 @@ discard block |
||
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | if ($type instanceof EnumType) { |
| 444 | - if (! $valueNode instanceof EnumValueNode) { |
|
| 444 | + if (!$valueNode instanceof EnumValueNode) { |
|
| 445 | 445 | return $undefined; |
| 446 | 446 | } |
| 447 | 447 | $enumValue = $type->getValue($valueNode->value); |
| 448 | - if (! $enumValue) { |
|
| 448 | + if (!$enumValue) { |
|
| 449 | 449 | return $undefined; |
| 450 | 450 | } |
| 451 | 451 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | private static function isMissingVariable(ValueNode $valueNode, $variables) |
| 479 | 479 | { |
| 480 | 480 | return $valueNode instanceof VariableNode && |
| 481 | - (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables)); |
|
| 481 | + (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables)); |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | return $valueNode->value; |
| 522 | 522 | case $valueNode instanceof ListValueNode: |
| 523 | 523 | return array_map( |
| 524 | - static function ($node) use ($variables) { |
|
| 524 | + static function($node) use ($variables) { |
|
| 525 | 525 | return self::valueFromASTUntyped($node, $variables); |
| 526 | 526 | }, |
| 527 | 527 | iterator_to_array($valueNode->values) |
@@ -529,13 +529,13 @@ discard block |
||
| 529 | 529 | case $valueNode instanceof ObjectValueNode: |
| 530 | 530 | return array_combine( |
| 531 | 531 | array_map( |
| 532 | - static function ($field) { |
|
| 532 | + static function($field) { |
|
| 533 | 533 | return $field->name->value; |
| 534 | 534 | }, |
| 535 | 535 | iterator_to_array($valueNode->fields) |
| 536 | 536 | ), |
| 537 | 537 | array_map( |
| 538 | - static function ($field) use ($variables) { |
|
| 538 | + static function($field) use ($variables) { |
|
| 539 | 539 | return self::valueFromASTUntyped($field->value, $variables); |
| 540 | 540 | }, |
| 541 | 541 | iterator_to_array($valueNode->fields) |
@@ -595,11 +595,11 @@ discard block |
||
| 595 | 595 | { |
| 596 | 596 | if ($document->definitions) { |
| 597 | 597 | foreach ($document->definitions as $def) { |
| 598 | - if (! ($def instanceof OperationDefinitionNode)) { |
|
| 598 | + if (!($def instanceof OperationDefinitionNode)) { |
|
| 599 | 599 | continue; |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | - if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
| 602 | + if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
| 603 | 603 | return $def->operation; |
| 604 | 604 | } |
| 605 | 605 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | 'description' => $this->getDescription($directiveNode), |
| 82 | 82 | 'locations' => Utils::map( |
| 83 | 83 | $directiveNode->locations, |
| 84 | - static function ($node) { |
|
| 84 | + static function($node) { |
|
| 85 | 85 | return $node->value; |
| 86 | 86 | } |
| 87 | 87 | ), |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | private function getLeadingCommentBlock($node) |
| 112 | 112 | { |
| 113 | 113 | $loc = $node->loc; |
| 114 | - if (! $loc || ! $loc->startToken) { |
|
| 114 | + if (!$loc || !$loc->startToken) { |
|
| 115 | 115 | return null; |
| 116 | 116 | } |
| 117 | 117 | $comments = []; |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | return Utils::keyValMap( |
| 136 | 136 | $values, |
| 137 | - static function ($value) { |
|
| 137 | + static function($value) { |
|
| 138 | 138 | return $value->name->value; |
| 139 | 139 | }, |
| 140 | - function ($value) { |
|
| 140 | + function($value) { |
|
| 141 | 141 | // Note: While this could make assertions to get the correctly typed |
| 142 | 142 | // value, that would throw immediately while type system validation |
| 143 | 143 | // with validateSchema() will produce more actionable results. |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | private function internalBuildType($typeName, $typeNode = null) |
| 203 | 203 | { |
| 204 | - if (! isset($this->cache[$typeName])) { |
|
| 204 | + if (!isset($this->cache[$typeName])) { |
|
| 205 | 205 | if (isset($this->typeDefinitionsMap[$typeName])) { |
| 206 | 206 | $type = $this->makeSchemaDef($this->typeDefinitionsMap[$typeName]); |
| 207 | 207 | if ($this->typeConfigDecorator) { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $e |
| 220 | 220 | ); |
| 221 | 221 | } |
| 222 | - if (! is_array($config) || isset($config[0])) { |
|
| 222 | + if (!is_array($config) || isset($config[0])) { |
|
| 223 | 223 | throw new Error( |
| 224 | 224 | sprintf( |
| 225 | 225 | 'Type config decorator passed to %s is expected to return an array, but got %s', |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | return new ObjectType([ |
| 275 | 275 | 'name' => $typeName, |
| 276 | 276 | 'description' => $this->getDescription($def), |
| 277 | - 'fields' => function () use ($def) { |
|
| 277 | + 'fields' => function() use ($def) { |
|
| 278 | 278 | return $this->makeFieldDefMap($def); |
| 279 | 279 | }, |
| 280 | - 'interfaces' => function () use ($def) { |
|
| 280 | + 'interfaces' => function() use ($def) { |
|
| 281 | 281 | return $this->makeImplementedInterfaces($def); |
| 282 | 282 | }, |
| 283 | 283 | 'astNode' => $def, |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | return $def->fields |
| 290 | 290 | ? Utils::keyValMap( |
| 291 | 291 | $def->fields, |
| 292 | - static function ($field) { |
|
| 292 | + static function($field) { |
|
| 293 | 293 | return $field->name->value; |
| 294 | 294 | }, |
| 295 | - function ($field) { |
|
| 295 | + function($field) { |
|
| 296 | 296 | return $this->buildField($field); |
| 297 | 297 | } |
| 298 | 298 | ) |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | // validation with validateSchema() will produce more actionable results. |
| 337 | 337 | return Utils::map( |
| 338 | 338 | $def->interfaces, |
| 339 | - function ($iface) { |
|
| 339 | + function($iface) { |
|
| 340 | 340 | return $this->buildType($iface); |
| 341 | 341 | } |
| 342 | 342 | ); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return new InterfaceType([ |
| 353 | 353 | 'name' => $typeName, |
| 354 | 354 | 'description' => $this->getDescription($def), |
| 355 | - 'fields' => function () use ($def) { |
|
| 355 | + 'fields' => function() use ($def) { |
|
| 356 | 356 | return $this->makeFieldDefMap($def); |
| 357 | 357 | }, |
| 358 | 358 | 'astNode' => $def, |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | 'values' => $def->values |
| 368 | 368 | ? Utils::keyValMap( |
| 369 | 369 | $def->values, |
| 370 | - static function ($enumValue) { |
|
| 370 | + static function($enumValue) { |
|
| 371 | 371 | return $enumValue->name->value; |
| 372 | 372 | }, |
| 373 | - function ($enumValue) { |
|
| 373 | + function($enumValue) { |
|
| 374 | 374 | return [ |
| 375 | 375 | 'description' => $this->getDescription($enumValue), |
| 376 | 376 | 'deprecationReason' => $this->getDeprecationReason($enumValue), |
@@ -392,10 +392,10 @@ discard block |
||
| 392 | 392 | // values below, that would throw immediately while type system |
| 393 | 393 | // validation with validateSchema() will produce more actionable results. |
| 394 | 394 | 'types' => $def->types |
| 395 | - ? function () use ($def) { |
|
| 395 | + ? function() use ($def) { |
|
| 396 | 396 | return Utils::map( |
| 397 | 397 | $def->types, |
| 398 | - function ($typeNode) { |
|
| 398 | + function($typeNode) { |
|
| 399 | 399 | return $this->buildType($typeNode); |
| 400 | 400 | } |
| 401 | 401 | ); |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | 'name' => $def->name->value, |
| 412 | 412 | 'description' => $this->getDescription($def), |
| 413 | 413 | 'astNode' => $def, |
| 414 | - 'serialize' => static function ($value) { |
|
| 414 | + 'serialize' => static function($value) { |
|
| 415 | 415 | return $value; |
| 416 | 416 | }, |
| 417 | 417 | ]); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | return new InputObjectType([ |
| 423 | 423 | 'name' => $def->name->value, |
| 424 | 424 | 'description' => $this->getDescription($def), |
| 425 | - 'fields' => function () use ($def) { |
|
| 425 | + 'fields' => function() use ($def) { |
|
| 426 | 426 | return $def->fields |
| 427 | 427 | ? $this->makeInputValues($def->fields) |
| 428 | 428 | : []; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | case $definition instanceof UnionTypeDefinitionNode: |
| 123 | 123 | case $definition instanceof InputObjectTypeDefinitionNode: |
| 124 | 124 | $typeName = $definition->name->value; |
| 125 | - if (! empty($this->nodeMap[$typeName])) { |
|
| 125 | + if (!empty($this->nodeMap[$typeName])) { |
|
| 126 | 126 | throw new Error(sprintf('Type "%s" was defined more than once.', $typeName)); |
| 127 | 127 | } |
| 128 | 128 | $typeDefs[] = $definition; |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | $DefinitionBuilder = new ASTDefinitionBuilder( |
| 146 | 146 | $this->nodeMap, |
| 147 | 147 | $this->options, |
| 148 | - static function ($typeName) { |
|
| 148 | + static function($typeName) { |
|
| 149 | 149 | throw new Error('Type "' . $typeName . '" not found in document.'); |
| 150 | 150 | }, |
| 151 | 151 | $this->typeConfigDecorator |
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | $directives = array_map( |
| 155 | - static function ($def) use ($DefinitionBuilder) { |
|
| 155 | + static function($def) use ($DefinitionBuilder) { |
|
| 156 | 156 | return $DefinitionBuilder->buildDirective($def); |
| 157 | 157 | }, |
| 158 | 158 | $directiveDefs |
@@ -161,17 +161,17 @@ discard block |
||
| 161 | 161 | // If specified directives were not explicitly declared, add them. |
| 162 | 162 | $directivesByName = Utils::groupBy( |
| 163 | 163 | $directives, |
| 164 | - static function (Directive $directive) : string { |
|
| 164 | + static function(Directive $directive) : string { |
|
| 165 | 165 | return $directive->name; |
| 166 | 166 | } |
| 167 | 167 | ); |
| 168 | - if (! isset($directivesByName['skip'])) { |
|
| 168 | + if (!isset($directivesByName['skip'])) { |
|
| 169 | 169 | $directives[] = Directive::skipDirective(); |
| 170 | 170 | } |
| 171 | - if (! isset($directivesByName['include'])) { |
|
| 171 | + if (!isset($directivesByName['include'])) { |
|
| 172 | 172 | $directives[] = Directive::includeDirective(); |
| 173 | 173 | } |
| 174 | - if (! isset($directivesByName['deprecated'])) { |
|
| 174 | + if (!isset($directivesByName['deprecated'])) { |
|
| 175 | 175 | $directives[] = Directive::deprecatedDirective(); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | 'subscription' => isset($operationTypes['subscription']) |
| 190 | 190 | ? $DefinitionBuilder->buildType($operationTypes['subscription']) |
| 191 | 191 | : null, |
| 192 | - 'typeLoader' => static function ($name) use ($DefinitionBuilder) { |
|
| 192 | + 'typeLoader' => static function($name) use ($DefinitionBuilder) { |
|
| 193 | 193 | return $DefinitionBuilder->buildType($name); |
| 194 | 194 | }, |
| 195 | 195 | 'directives' => $directives, |
| 196 | 196 | 'astNode' => $schemaDef, |
| 197 | - 'types' => function () use ($DefinitionBuilder) { |
|
| 197 | + 'types' => function() use ($DefinitionBuilder) { |
|
| 198 | 198 | $types = []; |
| 199 | 199 | /** @var ScalarTypeDefinitionNode|ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|UnionTypeDefinitionNode|EnumTypeDefinitionNode|InputObjectTypeDefinitionNode $def */ |
| 200 | 200 | foreach ($this->nodeMap as $name => $def) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | throw new Error(sprintf('Must provide only one %s type in schema.', $operation)); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if (! isset($this->nodeMap[$typeName])) { |
|
| 228 | + if (!isset($this->nodeMap[$typeName])) { |
|
| 229 | 229 | throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName)); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected static function getExtensionASTNodes(NamedType $type) : ?array |
| 60 | 60 | { |
| 61 | - if (! $type instanceof Type) { |
|
| 61 | + if (!$type instanceof Type) { |
|
| 62 | 62 | return null; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | switch (true) { |
| 83 | 83 | case $node instanceof ObjectTypeExtensionNode: |
| 84 | - if (! ($type instanceof ObjectType)) { |
|
| 84 | + if (!($type instanceof ObjectType)) { |
|
| 85 | 85 | throw new Error( |
| 86 | 86 | 'Cannot extend non-object type "' . $type->name . '".', |
| 87 | 87 | [$node] |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | break; |
| 91 | 91 | case $node instanceof InterfaceTypeExtensionNode: |
| 92 | - if (! ($type instanceof InterfaceType)) { |
|
| 92 | + if (!($type instanceof InterfaceType)) { |
|
| 93 | 93 | throw new Error( |
| 94 | 94 | 'Cannot extend non-interface type "' . $type->name . '".', |
| 95 | 95 | [$node] |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | break; |
| 99 | 99 | case $node instanceof EnumTypeExtensionNode: |
| 100 | - if (! ($type instanceof EnumType)) { |
|
| 100 | + if (!($type instanceof EnumType)) { |
|
| 101 | 101 | throw new Error( |
| 102 | 102 | 'Cannot extend non-enum type "' . $type->name . '".', |
| 103 | 103 | [$node] |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | break; |
| 107 | 107 | case $node instanceof UnionTypeExtensionNode: |
| 108 | - if (! ($type instanceof UnionType)) { |
|
| 108 | + if (!($type instanceof UnionType)) { |
|
| 109 | 109 | throw new Error( |
| 110 | 110 | 'Cannot extend non-union type "' . $type->name . '".', |
| 111 | 111 | [$node] |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | break; |
| 115 | 115 | case $node instanceof InputObjectTypeExtensionNode: |
| 116 | - if (! ($type instanceof InputObjectType)) { |
|
| 116 | + if (!($type instanceof InputObjectType)) { |
|
| 117 | 117 | throw new Error( |
| 118 | 118 | 'Cannot extend non-input object type "' . $type->name . '".', |
| 119 | 119 | [$node] |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return new UnionType([ |
| 142 | 142 | 'name' => $type->name, |
| 143 | 143 | 'description' => $type->description, |
| 144 | - 'types' => static function () use ($type) { |
|
| 144 | + 'types' => static function() use ($type) { |
|
| 145 | 145 | return static::extendPossibleTypes($type); |
| 146 | 146 | }, |
| 147 | 147 | 'astNode' => $type->astNode, |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | return new InputObjectType([ |
| 167 | 167 | 'name' => $type->name, |
| 168 | 168 | 'description' => $type->description, |
| 169 | - 'fields' => static function () use ($type) { |
|
| 169 | + 'fields' => static function() use ($type) { |
|
| 170 | 170 | return static::extendInputFieldMap($type); |
| 171 | 171 | }, |
| 172 | 172 | 'astNode' => $type->astNode, |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | 'astNode' => $field->astNode, |
| 189 | 189 | ]; |
| 190 | 190 | |
| 191 | - if (! $field->defaultValueExists()) { |
|
| 191 | + if (!$field->defaultValueExists()) { |
|
| 192 | 192 | continue; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | protected static function extendPossibleTypes(UnionType $type) : array |
| 257 | 257 | { |
| 258 | - $possibleTypes = array_map(static function ($type) { |
|
| 258 | + $possibleTypes = array_map(static function($type) { |
|
| 259 | 259 | return static::extendNamedType($type); |
| 260 | 260 | }, $type->getTypes()); |
| 261 | 261 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | protected static function extendImplementedInterfaces(ObjectType $type) : array |
| 278 | 278 | { |
| 279 | - $interfaces = array_map(static function (InterfaceType $interfaceType) { |
|
| 279 | + $interfaces = array_map(static function(InterfaceType $interfaceType) { |
|
| 280 | 280 | return static::extendNamedType($interfaceType); |
| 281 | 281 | }, $type->getInterfaces()); |
| 282 | 282 | |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | return Utils::keyValMap( |
| 317 | 317 | $args, |
| 318 | - static function (FieldArgument $arg) { |
|
| 318 | + static function(FieldArgument $arg) { |
|
| 319 | 319 | return $arg->name; |
| 320 | 320 | }, |
| 321 | - static function (FieldArgument $arg) { |
|
| 321 | + static function(FieldArgument $arg) { |
|
| 322 | 322 | $def = [ |
| 323 | 323 | 'type' => static::extendType($arg->getType()), |
| 324 | 324 | 'description' => $arg->description, |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | return new ObjectType([ |
| 383 | 383 | 'name' => $type->name, |
| 384 | 384 | 'description' => $type->description, |
| 385 | - 'interfaces' => static function () use ($type) { |
|
| 385 | + 'interfaces' => static function() use ($type) { |
|
| 386 | 386 | return static::extendImplementedInterfaces($type); |
| 387 | 387 | }, |
| 388 | - 'fields' => static function () use ($type) { |
|
| 388 | + 'fields' => static function() use ($type) { |
|
| 389 | 389 | return static::extendFieldMap($type); |
| 390 | 390 | }, |
| 391 | 391 | 'astNode' => $type->astNode, |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | return new InterfaceType([ |
| 400 | 400 | 'name' => $type->name, |
| 401 | 401 | 'description' => $type->description, |
| 402 | - 'fields' => static function () use ($type) { |
|
| 402 | + 'fields' => static function() use ($type) { |
|
| 403 | 403 | return static::extendFieldMap($type); |
| 404 | 404 | }, |
| 405 | 405 | 'astNode' => $type->astNode, |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | $name = $type->name; |
| 430 | - if (! isset(static::$extendTypeCache[$name])) { |
|
| 430 | + if (!isset(static::$extendTypeCache[$name])) { |
|
| 431 | 431 | if ($type instanceof ScalarType) { |
| 432 | 432 | static::$extendTypeCache[$name] = static::extendScalarType($type); |
| 433 | 433 | } elseif ($type instanceof ObjectType) { |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | protected static function getMergedDirectives(Schema $schema, array $directiveDefinitions) : array |
| 467 | 467 | { |
| 468 | - $existingDirectives = array_map(static function (Directive $directive) { |
|
| 468 | + $existingDirectives = array_map(static function(Directive $directive) { |
|
| 469 | 469 | return static::extendDirective($directive); |
| 470 | 470 | }, $schema->getDirectives()); |
| 471 | 471 | |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | return array_merge( |
| 475 | 475 | $existingDirectives, |
| 476 | - array_map(static function (DirectiveDefinitionNode $directive) { |
|
| 476 | + array_map(static function(DirectiveDefinitionNode $directive) { |
|
| 477 | 477 | return static::$astBuilder->buildDirective($directive); |
| 478 | 478 | }, $directiveDefinitions) |
| 479 | 479 | ); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | public static function extend(Schema $schema, DocumentNode $documentAST, ?array $options = null) : Schema |
| 497 | 497 | { |
| 498 | - if ($options === null || ! (isset($options['assumeValid']) || isset($options['assumeValidSDL']))) { |
|
| 498 | + if ($options === null || !(isset($options['assumeValid']) || isset($options['assumeValidSDL']))) { |
|
| 499 | 499 | DocumentValidator::assertValidSDLExtension($documentAST, $schema); |
| 500 | 500 | } |
| 501 | 501 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | static::$astBuilder = new ASTDefinitionBuilder( |
| 564 | 564 | $typeDefinitionMap, |
| 565 | 565 | $options, |
| 566 | - static function (string $typeName) use ($schema) { |
|
| 566 | + static function(string $typeName) use ($schema) { |
|
| 567 | 567 | /** @var ScalarType|ObjectType|InterfaceType|UnionType|EnumType|InputObjectType $existingType */ |
| 568 | 568 | $existingType = $schema->getType($typeName); |
| 569 | 569 | if ($existingType !== null) { |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | foreach ($schemaExtensions as $schemaExtension) { |
| 599 | - if (! $schemaExtension->operationTypes) { |
|
| 599 | + if (!$schemaExtension->operationTypes) { |
|
| 600 | 600 | continue; |
| 601 | 601 | } |
| 602 | 602 | |
@@ -618,11 +618,11 @@ discard block |
||
| 618 | 618 | $types = array_merge( |
| 619 | 619 | // Iterate through all types, getting the type definition for each, ensuring |
| 620 | 620 | // that any type not directly referenced by a field will get created. |
| 621 | - array_map(static function ($type) { |
|
| 621 | + array_map(static function($type) { |
|
| 622 | 622 | return static::extendNamedType($type); |
| 623 | 623 | }, array_values($schema->getTypeMap())), |
| 624 | 624 | // Do the same with new types. |
| 625 | - array_map(static function ($type) { |
|
| 625 | + array_map(static function($type) { |
|
| 626 | 626 | return static::$astBuilder->buildType($type); |
| 627 | 627 | }, array_values($typeDefinitionMap)) |
| 628 | 628 | ); |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | $ast, |
| 100 | 100 | [ |
| 101 | 101 | 'leave' => [ |
| 102 | - NodeKind::NAME => static function (NameNode $node) { |
|
| 102 | + NodeKind::NAME => static function(NameNode $node) { |
|
| 103 | 103 | return '' . $node->value; |
| 104 | 104 | }, |
| 105 | 105 | |
| 106 | - NodeKind::VARIABLE => static function (VariableNode $node) { |
|
| 106 | + NodeKind::VARIABLE => static function(VariableNode $node) { |
|
| 107 | 107 | return '$' . $node->name; |
| 108 | 108 | }, |
| 109 | 109 | |
| 110 | - NodeKind::DOCUMENT => function (DocumentNode $node) { |
|
| 110 | + NodeKind::DOCUMENT => function(DocumentNode $node) { |
|
| 111 | 111 | return $this->join($node->definitions, "\n\n") . "\n"; |
| 112 | 112 | }, |
| 113 | 113 | |
| 114 | - NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) { |
|
| 114 | + NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) { |
|
| 115 | 115 | $op = $node->operation; |
| 116 | 116 | $name = $node->name; |
| 117 | 117 | $varDefs = $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')'); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | // Anonymous queries with no directives or variable definitions can use |
| 122 | 122 | // the query short form. |
| 123 | - return ! $name && ! $directives && ! $varDefs && $op === 'query' |
|
| 123 | + return !$name && !$directives && !$varDefs && $op === 'query' |
|
| 124 | 124 | ? $selectionSet |
| 125 | 125 | : $this->join([$op, $this->join([$name, $varDefs]), $directives, $selectionSet], ' '); |
| 126 | 126 | }, |
| 127 | 127 | |
| 128 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) { |
|
| 128 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) { |
|
| 129 | 129 | return $node->variable |
| 130 | 130 | . ': ' |
| 131 | 131 | . $node->type |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | . $this->wrap(' ', $this->join($node->directives, ' ')); |
| 134 | 134 | }, |
| 135 | 135 | |
| 136 | - NodeKind::SELECTION_SET => function (SelectionSetNode $node) { |
|
| 136 | + NodeKind::SELECTION_SET => function(SelectionSetNode $node) { |
|
| 137 | 137 | return $this->block($node->selections); |
| 138 | 138 | }, |
| 139 | 139 | |
| 140 | - NodeKind::FIELD => function (FieldNode $node) { |
|
| 140 | + NodeKind::FIELD => function(FieldNode $node) { |
|
| 141 | 141 | return $this->join( |
| 142 | 142 | [ |
| 143 | 143 | $this->wrap('', $node->alias, ': ') . $node->name . $this->wrap( |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | ); |
| 153 | 153 | }, |
| 154 | 154 | |
| 155 | - NodeKind::ARGUMENT => static function (ArgumentNode $node) { |
|
| 155 | + NodeKind::ARGUMENT => static function(ArgumentNode $node) { |
|
| 156 | 156 | return $node->name . ': ' . $node->value; |
| 157 | 157 | }, |
| 158 | 158 | |
| 159 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) { |
|
| 159 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) { |
|
| 160 | 160 | return '...' . $node->name . $this->wrap(' ', $this->join($node->directives, ' ')); |
| 161 | 161 | }, |
| 162 | 162 | |
| 163 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) { |
|
| 163 | + NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) { |
|
| 164 | 164 | return $this->join( |
| 165 | 165 | [ |
| 166 | 166 | '...', |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | }, |
| 174 | 174 | |
| 175 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) { |
|
| 175 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) { |
|
| 176 | 176 | // Note: fragment variable definitions are experimental and may be changed or removed in the future. |
| 177 | 177 | return sprintf('fragment %s', $node->name) |
| 178 | 178 | . $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')') |
@@ -181,15 +181,15 @@ discard block |
||
| 181 | 181 | . $node->selectionSet; |
| 182 | 182 | }, |
| 183 | 183 | |
| 184 | - NodeKind::INT => static function (IntValueNode $node) { |
|
| 184 | + NodeKind::INT => static function(IntValueNode $node) { |
|
| 185 | 185 | return $node->value; |
| 186 | 186 | }, |
| 187 | 187 | |
| 188 | - NodeKind::FLOAT => static function (FloatValueNode $node) { |
|
| 188 | + NodeKind::FLOAT => static function(FloatValueNode $node) { |
|
| 189 | 189 | return $node->value; |
| 190 | 190 | }, |
| 191 | 191 | |
| 192 | - NodeKind::STRING => function (StringValueNode $node, $key) { |
|
| 192 | + NodeKind::STRING => function(StringValueNode $node, $key) { |
|
| 193 | 193 | if ($node->block) { |
| 194 | 194 | return $this->printBlockString($node->value, $key === 'description'); |
| 195 | 195 | } |
@@ -197,47 +197,47 @@ discard block |
||
| 197 | 197 | return json_encode($node->value); |
| 198 | 198 | }, |
| 199 | 199 | |
| 200 | - NodeKind::BOOLEAN => static function (BooleanValueNode $node) { |
|
| 200 | + NodeKind::BOOLEAN => static function(BooleanValueNode $node) { |
|
| 201 | 201 | return $node->value ? 'true' : 'false'; |
| 202 | 202 | }, |
| 203 | 203 | |
| 204 | - NodeKind::NULL => static function (NullValueNode $node) { |
|
| 204 | + NodeKind::NULL => static function(NullValueNode $node) { |
|
| 205 | 205 | return 'null'; |
| 206 | 206 | }, |
| 207 | 207 | |
| 208 | - NodeKind::ENUM => static function (EnumValueNode $node) { |
|
| 208 | + NodeKind::ENUM => static function(EnumValueNode $node) { |
|
| 209 | 209 | return $node->value; |
| 210 | 210 | }, |
| 211 | 211 | |
| 212 | - NodeKind::LST => function (ListValueNode $node) { |
|
| 212 | + NodeKind::LST => function(ListValueNode $node) { |
|
| 213 | 213 | return '[' . $this->join($node->values, ', ') . ']'; |
| 214 | 214 | }, |
| 215 | 215 | |
| 216 | - NodeKind::OBJECT => function (ObjectValueNode $node) { |
|
| 216 | + NodeKind::OBJECT => function(ObjectValueNode $node) { |
|
| 217 | 217 | return '{' . $this->join($node->fields, ', ') . '}'; |
| 218 | 218 | }, |
| 219 | 219 | |
| 220 | - NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) { |
|
| 220 | + NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) { |
|
| 221 | 221 | return $node->name . ': ' . $node->value; |
| 222 | 222 | }, |
| 223 | 223 | |
| 224 | - NodeKind::DIRECTIVE => function (DirectiveNode $node) { |
|
| 224 | + NodeKind::DIRECTIVE => function(DirectiveNode $node) { |
|
| 225 | 225 | return '@' . $node->name . $this->wrap('(', $this->join($node->arguments, ', '), ')'); |
| 226 | 226 | }, |
| 227 | 227 | |
| 228 | - NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) { |
|
| 228 | + NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) { |
|
| 229 | 229 | return $node->name; |
| 230 | 230 | }, |
| 231 | 231 | |
| 232 | - NodeKind::LIST_TYPE => static function (ListTypeNode $node) { |
|
| 232 | + NodeKind::LIST_TYPE => static function(ListTypeNode $node) { |
|
| 233 | 233 | return '[' . $node->type . ']'; |
| 234 | 234 | }, |
| 235 | 235 | |
| 236 | - NodeKind::NON_NULL_TYPE => static function (NonNullTypeNode $node) { |
|
| 236 | + NodeKind::NON_NULL_TYPE => static function(NonNullTypeNode $node) { |
|
| 237 | 237 | return $node->type . '!'; |
| 238 | 238 | }, |
| 239 | 239 | |
| 240 | - NodeKind::SCHEMA_DEFINITION => function (SchemaDefinitionNode $def) { |
|
| 240 | + NodeKind::SCHEMA_DEFINITION => function(SchemaDefinitionNode $def) { |
|
| 241 | 241 | return $this->join( |
| 242 | 242 | [ |
| 243 | 243 | 'schema', |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | ); |
| 249 | 249 | }, |
| 250 | 250 | |
| 251 | - NodeKind::OPERATION_TYPE_DEFINITION => static function (OperationTypeDefinitionNode $def) { |
|
| 251 | + NodeKind::OPERATION_TYPE_DEFINITION => static function(OperationTypeDefinitionNode $def) { |
|
| 252 | 252 | return $def->operation . ': ' . $def->type; |
| 253 | 253 | }, |
| 254 | 254 | |
| 255 | - NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function (ScalarTypeDefinitionNode $def) { |
|
| 255 | + NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function(ScalarTypeDefinitionNode $def) { |
|
| 256 | 256 | return $this->join(['scalar', $def->name, $this->join($def->directives, ' ')], ' '); |
| 257 | 257 | }), |
| 258 | 258 | |
| 259 | - NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function (ObjectTypeDefinitionNode $def) { |
|
| 259 | + NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function(ObjectTypeDefinitionNode $def) { |
|
| 260 | 260 | return $this->join( |
| 261 | 261 | [ |
| 262 | 262 | 'type', |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | ); |
| 270 | 270 | }), |
| 271 | 271 | |
| 272 | - NodeKind::FIELD_DEFINITION => $this->addDescription(function (FieldDefinitionNode $def) { |
|
| 273 | - $noIndent = Utils::every($def->arguments, static function (string $arg) { |
|
| 272 | + NodeKind::FIELD_DEFINITION => $this->addDescription(function(FieldDefinitionNode $def) { |
|
| 273 | + $noIndent = Utils::every($def->arguments, static function(string $arg) { |
|
| 274 | 274 | return strpos($arg, "\n") === false; |
| 275 | 275 | }); |
| 276 | 276 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | . $this->wrap(' ', $this->join($def->directives, ' ')); |
| 283 | 283 | }), |
| 284 | 284 | |
| 285 | - NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function (InputValueDefinitionNode $def) { |
|
| 285 | + NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function(InputValueDefinitionNode $def) { |
|
| 286 | 286 | return $this->join( |
| 287 | 287 | [ |
| 288 | 288 | $def->name . ': ' . $def->type, |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | }), |
| 295 | 295 | |
| 296 | 296 | NodeKind::INTERFACE_TYPE_DEFINITION => $this->addDescription( |
| 297 | - function (InterfaceTypeDefinitionNode $def) { |
|
| 297 | + function(InterfaceTypeDefinitionNode $def) { |
|
| 298 | 298 | return $this->join( |
| 299 | 299 | [ |
| 300 | 300 | 'interface', |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | ), |
| 309 | 309 | |
| 310 | - NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function (UnionTypeDefinitionNode $def) { |
|
| 310 | + NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function(UnionTypeDefinitionNode $def) { |
|
| 311 | 311 | return $this->join( |
| 312 | 312 | [ |
| 313 | 313 | 'union', |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | ); |
| 322 | 322 | }), |
| 323 | 323 | |
| 324 | - NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function (EnumTypeDefinitionNode $def) { |
|
| 324 | + NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function(EnumTypeDefinitionNode $def) { |
|
| 325 | 325 | return $this->join( |
| 326 | 326 | [ |
| 327 | 327 | 'enum', |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | ); |
| 334 | 334 | }), |
| 335 | 335 | |
| 336 | - NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function (EnumValueDefinitionNode $def) { |
|
| 336 | + NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function(EnumValueDefinitionNode $def) { |
|
| 337 | 337 | return $this->join([$def->name, $this->join($def->directives, ' ')], ' '); |
| 338 | 338 | }), |
| 339 | 339 | |
| 340 | - NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function ( |
|
| 340 | + NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function( |
|
| 341 | 341 | InputObjectTypeDefinitionNode $def |
| 342 | 342 | ) { |
| 343 | 343 | return $this->join( |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | ); |
| 352 | 352 | }), |
| 353 | 353 | |
| 354 | - NodeKind::SCHEMA_EXTENSION => function (SchemaTypeExtensionNode $def) { |
|
| 354 | + NodeKind::SCHEMA_EXTENSION => function(SchemaTypeExtensionNode $def) { |
|
| 355 | 355 | return $this->join( |
| 356 | 356 | [ |
| 357 | 357 | 'extend schema', |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ); |
| 363 | 363 | }, |
| 364 | 364 | |
| 365 | - NodeKind::SCALAR_TYPE_EXTENSION => function (ScalarTypeExtensionNode $def) { |
|
| 365 | + NodeKind::SCALAR_TYPE_EXTENSION => function(ScalarTypeExtensionNode $def) { |
|
| 366 | 366 | return $this->join( |
| 367 | 367 | [ |
| 368 | 368 | 'extend scalar', |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | ); |
| 374 | 374 | }, |
| 375 | 375 | |
| 376 | - NodeKind::OBJECT_TYPE_EXTENSION => function (ObjectTypeExtensionNode $def) { |
|
| 376 | + NodeKind::OBJECT_TYPE_EXTENSION => function(ObjectTypeExtensionNode $def) { |
|
| 377 | 377 | return $this->join( |
| 378 | 378 | [ |
| 379 | 379 | 'extend type', |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | ); |
| 387 | 387 | }, |
| 388 | 388 | |
| 389 | - NodeKind::INTERFACE_TYPE_EXTENSION => function (InterfaceTypeExtensionNode $def) { |
|
| 389 | + NodeKind::INTERFACE_TYPE_EXTENSION => function(InterfaceTypeExtensionNode $def) { |
|
| 390 | 390 | return $this->join( |
| 391 | 391 | [ |
| 392 | 392 | 'extend interface', |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | ); |
| 399 | 399 | }, |
| 400 | 400 | |
| 401 | - NodeKind::UNION_TYPE_EXTENSION => function (UnionTypeExtensionNode $def) { |
|
| 401 | + NodeKind::UNION_TYPE_EXTENSION => function(UnionTypeExtensionNode $def) { |
|
| 402 | 402 | return $this->join( |
| 403 | 403 | [ |
| 404 | 404 | 'extend union', |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | ); |
| 413 | 413 | }, |
| 414 | 414 | |
| 415 | - NodeKind::ENUM_TYPE_EXTENSION => function (EnumTypeExtensionNode $def) { |
|
| 415 | + NodeKind::ENUM_TYPE_EXTENSION => function(EnumTypeExtensionNode $def) { |
|
| 416 | 416 | return $this->join( |
| 417 | 417 | [ |
| 418 | 418 | 'extend enum', |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | ); |
| 425 | 425 | }, |
| 426 | 426 | |
| 427 | - NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function (InputObjectTypeExtensionNode $def) { |
|
| 427 | + NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function(InputObjectTypeExtensionNode $def) { |
|
| 428 | 428 | return $this->join( |
| 429 | 429 | [ |
| 430 | 430 | 'extend input', |
@@ -436,8 +436,8 @@ discard block |
||
| 436 | 436 | ); |
| 437 | 437 | }, |
| 438 | 438 | |
| 439 | - NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function (DirectiveDefinitionNode $def) { |
|
| 440 | - $noIndent = Utils::every($def->arguments, static function (string $arg) { |
|
| 439 | + NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function(DirectiveDefinitionNode $def) { |
|
| 440 | + $noIndent = Utils::every($def->arguments, static function(string $arg) { |
|
| 441 | 441 | return strpos($arg, "\n") === false; |
| 442 | 442 | }); |
| 443 | 443 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | public function addDescription(callable $cb) |
| 457 | 457 | { |
| 458 | - return function ($node) use ($cb) { |
|
| 458 | + return function($node) use ($cb) { |
|
| 459 | 459 | return $this->join([$node->description, $cb($node)], "\n"); |
| 460 | 460 | }; |
| 461 | 461 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $separator, |
| 503 | 503 | Utils::filter( |
| 504 | 504 | $maybeArray, |
| 505 | - static function ($x) { |
|
| 505 | + static function($x) { |
|
| 506 | 506 | return (bool) $x; |
| 507 | 507 | } |
| 508 | 508 | ) |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | case 117: |
| 519 | 519 | $position = $this->position; |
| 520 | 520 | [$hex] = $this->readChars(4, true); |
| 521 | - if (! preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
| 521 | + if (!preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
| 522 | 522 | throw new SyntaxError( |
| 523 | 523 | $this->source, |
| 524 | 524 | $position - 1, |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | $highOrderByte = $code >> 8; |
| 533 | 533 | if (0xD8 <= $highOrderByte && $highOrderByte <= 0xDF) { |
| 534 | 534 | [$utf16Continuation] = $this->readChars(6, true); |
| 535 | - if (! preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) { |
|
| 535 | + if (!preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) { |
|
| 536 | 536 | throw new SyntaxError( |
| 537 | 537 | $this->source, |
| 538 | 538 | $this->position - 5, |