New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unaliased path to resolve info #1548
base: master
Are you sure you want to change the base?
Conversation
@@ -75,7 +86,8 @@ public function __construct( | |||
?array $positions = null, | |||
?array $path = null, | |||
?\Throwable $previous = null, | |||
?array $extensions = null | |||
?array $extensions = null, | |||
?array $unaliasedPath = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to put this at the end to break BC.
$fieldNodes = $fields[$responseName]; | ||
assert($fieldNodes instanceof \ArrayObject, 'The keys of $fields populate $responseName'); | ||
|
||
$fieldPath = $path; | ||
$fieldPath[] = $responseName; | ||
$result = $this->resolveField($parentType, $rootValue, $fieldNodes, $fieldPath, $this->maybeScopeContext($contextValue)); | ||
|
||
$fieldNode = $fieldNodes[0]; | ||
assert($fieldNode instanceof FieldNode, '$fieldNodes is non-empty'); | ||
|
||
$fieldUnaliasedPath = $unaliasedPath; | ||
$fieldUnaliasedPath[] = $fieldNode->name->value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as executeFieldsSerially
* @param mixed $rootValue | ||
* @param array<int, string|int> $path | ||
* @param array<int, string|int> $unaliasedPath | ||
* @param mixed $contextValue | ||
* | ||
* @phpstan-param Path $path | ||
* @phpstan-param Path $path | ||
* @phpstan-param Path $unaliasedPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if phpdoc_align was set to left, to not cause all these changes.
* Returns an array describing the path from the root value to the field which produced this error. | ||
* Only included for execution errors. This will never include aliases. | ||
* | ||
* @return array<int, int|string>|null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it array<int, int|string>
to be the same as path, but personally I would make this a list<int|string>
.
@spawnia This one is ready for review, when you have time. |
Fixes #1345