Skip to content

Commit a427591

Browse files
authored
Add Path type to ResolveInfo (#1099)
1 parent 08d9db9 commit a427591

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Executor/ReferenceExecutor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
/**
5454
* @phpstan-import-type FieldResolver from Executor
55+
* @phpstan-import-type Path from ResolveInfo
5556
* @phpstan-type Fields ArrayObject<string, ArrayObject<int, FieldNode>>
5657
*/
5758
class ReferenceExecutor implements ExecutorImplementation
@@ -571,6 +572,8 @@ function ($results, $responseName) use ($path, $parentType, $rootValue, $fields)
571572
*
572573
* @param mixed $rootValue
573574
* @param array<int, string|int> $path
575+
* @phpstan-param Path $path
576+
*
574577
* @param ArrayObject<int, FieldNode> $fieldNodes
575578
*
576579
* @return array<mixed>|Throwable|mixed|null
@@ -703,6 +706,8 @@ protected function resolveFieldValueOrError(
703706
*
704707
* @param ArrayObject<int, FieldNode> $fieldNodes
705708
* @param array<string|int> $path
709+
* @phpstan-param Path $path
710+
*
706711
* @param mixed $result
707712
*
708713
* @return array<mixed>|Promise|stdClass|null

src/Type/Definition/ResolveInfo.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Passed as 4th argument to every field resolver. See [docs on field resolving (data fetching)](data-fetching.md).
1818
*
1919
* @phpstan-import-type QueryPlanOptions from QueryPlan
20+
* @phpstan-type Path array<int, string|int>
2021
*/
2122
class ResolveInfo
2223
{
@@ -63,6 +64,7 @@ class ResolveInfo
6364
* @api
6465
*
6566
* @var array<int, string|int>
67+
* @phpstan-var Path
6668
*/
6769
public array $path;
6870

@@ -115,6 +117,8 @@ class ResolveInfo
115117
/**
116118
* @param iterable<int, FieldNode> $fieldNodes
117119
* @param array<int, string|int> $path
120+
* @phpstan-param Path $path
121+
*
118122
* @param array<string, FragmentDefinitionNode> $fragments
119123
* @param mixed|null $rootValue
120124
* @param array<string, mixed> $variableValues

0 commit comments

Comments
 (0)