Document BC and fix types in ResolveInfo

This commit is contained in:
Simon Podlipsky 2018-11-27 13:39:41 +01:00
parent b2cea8b538
commit 376e927505
2 changed files with 23 additions and 12 deletions

View File

@ -78,6 +78,9 @@ Parser::parse($source, [ 'allowLegacySDLImplementsInterfaces' => true])
- `AbstractQuerySecurity` renamed to `QuerySecurityRule` (NS `GraphQL\Validator\Rules`) - `AbstractQuerySecurity` renamed to `QuerySecurityRule` (NS `GraphQL\Validator\Rules`)
- `FindBreakingChanges` renamed to `BreakingChangesFinder` (NS `GraphQL\Utils`) - `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 ## Upgrade v0.11.x > v0.12.x

View File

@ -23,7 +23,7 @@ class ResolveInfo
* The name of the field being resolved * The name of the field being resolved
* *
* @api * @api
* @var string|null * @var string
*/ */
public $fieldName; public $fieldName;
@ -31,9 +31,9 @@ class ResolveInfo
* AST of all nodes referencing this field in the query. * AST of all nodes referencing this field in the query.
* *
* @api * @api
* @var FieldNode[]|null * @var FieldNode[]
*/ */
public $fieldNodes; public $fieldNodes = [];
/** /**
* Expected return type of the field being resolved * Expected return type of the field being resolved
@ -47,7 +47,7 @@ class ResolveInfo
* Parent type of the field being resolved * Parent type of the field being resolved
* *
* @api * @api
* @var ObjectType|null * @var ObjectType
*/ */
public $parentType; public $parentType;
@ -55,7 +55,7 @@ class ResolveInfo
* Path to this field from the very root value * Path to this field from the very root value
* *
* @api * @api
* @var string[] * @var string[][]
*/ */
public $path; public $path;
@ -71,9 +71,9 @@ class ResolveInfo
* AST of all fragments defined in query * AST of all fragments defined in query
* *
* @api * @api
* @var FragmentDefinitionNode[]|null * @var FragmentDefinitionNode[]
*/ */
public $fragments; public $fragments = [];
/** /**
* Root value passed to query execution * Root value passed to query execution
@ -95,21 +95,29 @@ class ResolveInfo
* Array of variables passed to query execution * Array of variables passed to query execution
* *
* @api * @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( public function __construct(
string $fieldName, string $fieldName,
$fieldNodes, $fieldNodes,
$returnType, $returnType,
ObjectType $parentType, ObjectType $parentType,
$path, array $path,
Schema $schema, Schema $schema,
$fragments, array $fragments,
$rootValue, $rootValue,
?OperationDefinitionNode $operation, ?OperationDefinitionNode $operation,
$variableValues array $variableValues
) { ) {
$this->fieldName = $fieldName; $this->fieldName = $fieldName;
$this->fieldNodes = $fieldNodes; $this->fieldNodes = $fieldNodes;