@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function __construct($config) |
| 43 | 43 | { |
| 44 | - if (! isset($config['name'])) { |
|
| 44 | + if (!isset($config['name'])) { |
|
| 45 | 45 | $config['name'] = $this->tryInferName(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $lookup = $this->getNameLookup(); |
| 65 | 65 | |
| 66 | - if (! is_string($name)) { |
|
| 66 | + if (!is_string($name)) { |
|
| 67 | 67 | return null; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private function getNameLookup() |
| 77 | 77 | { |
| 78 | - if (! $this->nameLookup) { |
|
| 78 | + if (!$this->nameLookup) { |
|
| 79 | 79 | $lookup = new ArrayObject(); |
| 80 | 80 | foreach ($this->getValues() as $value) { |
| 81 | 81 | $lookup[$value->name] = $value; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $config = $this->config; |
| 97 | 97 | |
| 98 | 98 | if (isset($config['values'])) { |
| 99 | - if (! is_array($config['values'])) { |
|
| 99 | + if (!is_array($config['values'])) { |
|
| 100 | 100 | throw new InvariantViolation(sprintf('%s values must be an array', $this->name)); |
| 101 | 101 | } |
| 102 | 102 | foreach ($config['values'] as $name => $value) { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $values = $this->getValues(); |
| 214 | 214 | foreach ($values as $value) { |
| 215 | 215 | Utils::invariant( |
| 216 | - ! isset($value->config['isDeprecated']), |
|
| 216 | + !isset($value->config['isDeprecated']), |
|
| 217 | 217 | sprintf( |
| 218 | 218 | '%s.%s should provide "deprecationReason" instead of "isDeprecated".', |
| 219 | 219 | $this->name, |
@@ -187,7 +187,7 @@ |
||
| 187 | 187 | $fields = []; |
| 188 | 188 | foreach ($selectionSet->selections as $selectionNode) { |
| 189 | 189 | if ($selectionNode instanceof FieldNode) { |
| 190 | - $fields[$selectionNode->name->value] = $descend > 0 && ! empty($selectionNode->selectionSet) |
|
| 190 | + $fields[$selectionNode->name->value] = $descend > 0 && !empty($selectionNode->selectionSet) |
|
| 191 | 191 | ? $this->foldSelectionSet($selectionNode->selectionSet, $descend - 1) |
| 192 | 192 | : true; |
| 193 | 193 | } elseif ($selectionNode instanceof FragmentSpreadNode) { |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | public function validateRootTypes() |
| 65 | 65 | { |
| 66 | 66 | $queryType = $this->schema->getQueryType(); |
| 67 | - if (! $queryType) { |
|
| 67 | + if (!$queryType) { |
|
| 68 | 68 | $this->reportError( |
| 69 | 69 | 'Query root type must be provided.', |
| 70 | 70 | $this->schema->getAstNode() |
| 71 | 71 | ); |
| 72 | - } elseif (! $queryType instanceof ObjectType) { |
|
| 72 | + } elseif (!$queryType instanceof ObjectType) { |
|
| 73 | 73 | $this->reportError( |
| 74 | 74 | 'Query root type must be Object type, it cannot be ' . Utils::printSafe($queryType) . '.', |
| 75 | 75 | $this->getOperationTypeNode($queryType, 'query') |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $mutationType = $this->schema->getMutationType(); |
| 80 | - if ($mutationType && ! $mutationType instanceof ObjectType) { |
|
| 80 | + if ($mutationType && !$mutationType instanceof ObjectType) { |
|
| 81 | 81 | $this->reportError( |
| 82 | 82 | 'Mutation root type must be Object type if provided, it cannot be ' . Utils::printSafe($mutationType) . '.', |
| 83 | 83 | $this->getOperationTypeNode($mutationType, 'mutation') |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $subscriptionType = $this->schema->getSubscriptionType(); |
| 88 | - if (! $subscriptionType || $subscriptionType instanceof ObjectType) { |
|
| 88 | + if (!$subscriptionType || $subscriptionType instanceof ObjectType) { |
|
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $directives = $this->schema->getDirectives(); |
| 144 | 144 | foreach ($directives as $directive) { |
| 145 | 145 | // Ensure all directives are in fact GraphQL directives. |
| 146 | - if (! $directive instanceof Directive) { |
|
| 146 | + if (!$directive instanceof Directive) { |
|
| 147 | 147 | $this->reportError( |
| 148 | 148 | 'Expected directive but got: ' . Utils::printSafe($directive) . '.', |
| 149 | 149 | is_object($directive) ? $directive->astNode : null |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | { |
| 199 | 199 | // Ensure names are valid, however introspection types opt out. |
| 200 | 200 | $error = Utils::isValidNameError($node->name, $node->astNode); |
| 201 | - if (! $error || Introspection::isIntrospectionType($node)) { |
|
| 201 | + if (!$error || Introspection::isIntrospectionType($node)) { |
|
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $typeMap = $this->schema->getTypeMap(); |
| 245 | 245 | foreach ($typeMap as $typeName => $type) { |
| 246 | 246 | // Ensure all provided types are in fact GraphQL type. |
| 247 | - if (! $type instanceof NamedType) { |
|
| 247 | + if (!$type instanceof NamedType) { |
|
| 248 | 248 | $this->reportError( |
| 249 | 249 | 'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.', |
| 250 | 250 | is_object($type) ? $type->astNode : null |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $fieldMap = $type->getFields(); |
| 288 | 288 | |
| 289 | 289 | // Objects and Interfaces both must define one or more fields. |
| 290 | - if (! $fieldMap) { |
|
| 290 | + if (!$fieldMap) { |
|
| 291 | 291 | $this->reportError( |
| 292 | 292 | sprintf('Type %s must define one or more fields.', $type->name), |
| 293 | 293 | $this->getAllObjectOrInterfaceNodes($type) |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // Ensure the type is an output type |
| 312 | - if (! Type::isOutputType($field->getType())) { |
|
| 312 | + if (!Type::isOutputType($field->getType())) { |
|
| 313 | 313 | $this->reportError( |
| 314 | 314 | sprintf( |
| 315 | 315 | 'The type of %s.%s must be Output Type but got: %s.', |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | $fieldNodes = []; |
| 387 | 387 | $astNodes = $this->getAllObjectOrInterfaceNodes($type); |
| 388 | 388 | foreach ($astNodes as $astNode) { |
| 389 | - if (! $astNode || ! $astNode->fields) { |
|
| 389 | + if (!$astNode || !$astNode->fields) { |
|
| 390 | 390 | continue; |
| 391 | 391 | } |
| 392 | 392 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | { |
| 485 | 485 | $implementedTypeNames = []; |
| 486 | 486 | foreach ($object->getInterfaces() as $iface) { |
| 487 | - if (! $iface instanceof InterfaceType) { |
|
| 487 | + if (!$iface instanceof InterfaceType) { |
|
| 488 | 488 | $this->reportError( |
| 489 | 489 | sprintf( |
| 490 | 490 | 'Type %s must only implement Interface types, it cannot implement %s.', |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $astNodes = $this->getAllObjectOrInterfaceNodes($type); |
| 548 | 548 | |
| 549 | 549 | foreach ($astNodes as $astNode) { |
| 550 | - if (! $astNode || ! $astNode->interfaces) { |
|
| 550 | + if (!$astNode || !$astNode->interfaces) { |
|
| 551 | 551 | continue; |
| 552 | 552 | } |
| 553 | 553 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | : null; |
| 579 | 579 | |
| 580 | 580 | // Assert interface field exists on object. |
| 581 | - if (! $objectField) { |
|
| 581 | + if (!$objectField) { |
|
| 582 | 582 | $this->reportError( |
| 583 | 583 | sprintf( |
| 584 | 584 | 'Interface field %s.%s expected but %s does not provide it.', |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | // Assert interface field type is satisfied by object field type, by being |
| 595 | 595 | // a valid subtype. (covariant) |
| 596 | - if (! TypeComparators::isTypeSubTypeOf( |
|
| 596 | + if (!TypeComparators::isTypeSubTypeOf( |
|
| 597 | 597 | $this->schema, |
| 598 | 598 | $objectField->getType(), |
| 599 | 599 | $ifaceField->getType() |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | // Assert interface field arg exists on object field. |
| 632 | - if (! $objectArg) { |
|
| 632 | + if (!$objectArg) { |
|
| 633 | 633 | $this->reportError( |
| 634 | 634 | sprintf( |
| 635 | 635 | 'Interface field argument %s.%s(%s:) expected but %s.%s does not provide it.', |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | // Assert interface field arg type matches object field arg type. |
| 651 | 651 | // (invariant) |
| 652 | 652 | // TODO: change to contravariant? |
| 653 | - if (! TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
| 653 | + if (!TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
| 654 | 654 | $this->reportError( |
| 655 | 655 | sprintf( |
| 656 | 656 | 'Interface field argument %s.%s(%s:) expects type %s but %s.%s(%s:) is type %s.', |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | } |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | - if ($ifaceArg || ! ($objectArg->getType() instanceof NonNull)) { |
|
| 687 | + if ($ifaceArg || !($objectArg->getType() instanceof NonNull)) { |
|
| 688 | 688 | continue; |
| 689 | 689 | } |
| 690 | 690 | |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | { |
| 712 | 712 | $memberTypes = $union->getTypes(); |
| 713 | 713 | |
| 714 | - if (! $memberTypes) { |
|
| 714 | + if (!$memberTypes) { |
|
| 715 | 715 | $this->reportError( |
| 716 | 716 | sprintf('Union type %s must define one or more member types.', $union->name), |
| 717 | 717 | $union->astNode |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | if ($union->astNode && $union->astNode->types) { |
| 755 | 755 | return array_filter( |
| 756 | 756 | $union->astNode->types, |
| 757 | - static function (NamedTypeNode $value) use ($typeName) { |
|
| 757 | + static function(NamedTypeNode $value) use ($typeName) { |
|
| 758 | 758 | return $value->name->value === $typeName; |
| 759 | 759 | } |
| 760 | 760 | ); |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | { |
| 769 | 769 | $enumValues = $enumType->getValues(); |
| 770 | 770 | |
| 771 | - if (! $enumValues) { |
|
| 771 | + if (!$enumValues) { |
|
| 772 | 772 | $this->reportError( |
| 773 | 773 | sprintf('Enum type %s must define one or more values.', $enumType->name), |
| 774 | 774 | $enumType->astNode |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | if ($enum->astNode && $enum->astNode->values) { |
| 811 | 811 | return array_filter( |
| 812 | 812 | iterator_to_array($enum->astNode->values), |
| 813 | - static function (EnumValueDefinitionNode $value) use ($valueName) { |
|
| 813 | + static function(EnumValueDefinitionNode $value) use ($valueName) { |
|
| 814 | 814 | return $value->name->value === $valueName; |
| 815 | 815 | } |
| 816 | 816 | ); |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | { |
| 825 | 825 | $fieldMap = $inputObj->getFields(); |
| 826 | 826 | |
| 827 | - if (! $fieldMap) { |
|
| 827 | + if (!$fieldMap) { |
|
| 828 | 828 | $this->reportError( |
| 829 | 829 | sprintf('Input Object type %s must define one or more fields.', $inputObj->name), |
| 830 | 830 | $inputObj->astNode |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | $totalFields = 0; |
| 35 | 35 | foreach ($schema->getTypeMap() as $type) { |
| 36 | - if (! ($type instanceof ObjectType)) { |
|
| 36 | + if (!($type instanceof ObjectType)) { |
|
| 37 | 37 | continue; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | return new Schema( |
| 68 | 68 | SchemaConfig::create() |
| 69 | 69 | ->setQuery($this->schemaBuilder->buildQueryType()) |
| 70 | - ->setTypeLoader(function ($name) { |
|
| 70 | + ->setTypeLoader(function($name) { |
|
| 71 | 71 | return $this->schemaBuilder->loadType($name); |
| 72 | 72 | }) |
| 73 | 73 | ); |