From 376e9275054f9b63a27b8fa2215553f050898602 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Tue, 27 Nov 2018 13:39:41 +0100 Subject: [PATCH] Document BC and fix types in ResolveInfo --- UPGRADE.md | 3 +++ src/Type/Definition/ResolveInfo.php | 32 ++++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 943f530..a9d7256 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -78,6 +78,9 @@ Parser::parse($source, [ 'allowLegacySDLImplementsInterfaces' => true]) - `AbstractQuerySecurity` renamed to `QuerySecurityRule` (NS `GraphQL\Validator\Rules`) - `FindBreakingChanges` renamed to `BreakingChangesFinder` (NS `GraphQL\Utils`) +### Breaking: new constructors + +`GraphQL\Type\Definition\ResolveInfo` now takes 10 arguments instead of one array. ## Upgrade v0.11.x > v0.12.x diff --git a/src/Type/Definition/ResolveInfo.php b/src/Type/Definition/ResolveInfo.php index 8a752b1..377bb49 100644 --- a/src/Type/Definition/ResolveInfo.php +++ b/src/Type/Definition/ResolveInfo.php @@ -23,7 +23,7 @@ class ResolveInfo * The name of the field being resolved * * @api - * @var string|null + * @var string */ public $fieldName; @@ -31,9 +31,9 @@ class ResolveInfo * AST of all nodes referencing this field in the query. * * @api - * @var FieldNode[]|null + * @var FieldNode[] */ - public $fieldNodes; + public $fieldNodes = []; /** * Expected return type of the field being resolved @@ -47,7 +47,7 @@ class ResolveInfo * Parent type of the field being resolved * * @api - * @var ObjectType|null + * @var ObjectType */ public $parentType; @@ -55,7 +55,7 @@ class ResolveInfo * Path to this field from the very root value * * @api - * @var string[] + * @var string[][] */ public $path; @@ -71,9 +71,9 @@ class ResolveInfo * AST of all fragments defined in query * * @api - * @var FragmentDefinitionNode[]|null + * @var FragmentDefinitionNode[] */ - public $fragments; + public $fragments = []; /** * Root value passed to query execution @@ -95,21 +95,29 @@ class ResolveInfo * Array of variables passed to query execution * * @api - * @var mixed[]|null + * @var mixed[] */ - public $variableValues; + public $variableValues = []; + /** + * @param FieldNode[] $fieldNodes + * @param ScalarType|ObjectType|InterfaceType|UnionType|EnumType|ListOfType|NonNull $returnType + * @param string[][] $path + * @param FragmentDefinitionNode[] $fragments + * @param mixed|null $rootValue + * @param mixed[] $variableValues + */ public function __construct( string $fieldName, $fieldNodes, $returnType, ObjectType $parentType, - $path, + array $path, Schema $schema, - $fragments, + array $fragments, $rootValue, ?OperationDefinitionNode $operation, - $variableValues + array $variableValues ) { $this->fieldName = $fieldName; $this->fieldNodes = $fieldNodes;