Skip to content

Commit ff5bc60

Browse files
authored
Fix QueryPlan when querying __typename on a union type (#1295)
1 parent 4af8a10 commit ff5bc60

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ You can find and compare releases at the [GitHub release page](https://github.co
99

1010
## Unreleased
1111

12+
## v15.0.2
13+
14+
### Fixed
15+
16+
- Fix `QueryPlan` when querying `__typename` on a `union` type
17+
1218
## v15.0.1
1319

1420
### Fixed

src/Type/Definition/QueryPlan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ private function analyzeSelectionSet(SelectionSetNode $selectionSet, Type $paren
152152
$implementors = [];
153153
foreach ($selectionSet->selections as $selectionNode) {
154154
if ($selectionNode instanceof FieldNode) {
155-
assert($parentType instanceof HasFieldsType, 'ensured by query validation');
156-
157155
$fieldName = $selectionNode->name->value;
158156

159157
if ($fieldName === Introspection::TYPE_NAME_FIELD_NAME) {
160158
continue;
161159
}
162160

161+
assert($parentType instanceof HasFieldsType, 'ensured by query validation and the check above which excludes union types');
162+
163163
$type = $parentType->getField($fieldName);
164164
$selectionType = $type->getType();
165165

0 commit comments

Comments
 (0)