Skip to content

Commit c5efd1d

Browse files
committed
Additional checks for possible fragment spreads
1 parent 1e34982 commit c5efd1d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Validator/Rules/PossibleFragmentSpreads.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use GraphQL\Error\Error;
66
use GraphQL\Language\AST\FragmentSpreadNode;
77
use GraphQL\Language\AST\InlineFragmentNode;
8-
use GraphQL\Language\AST\Node;
98
use GraphQL\Language\AST\NodeKind;
109
use GraphQL\Type\Schema;
1110
use GraphQL\Type\Definition\AbstractType;
@@ -35,7 +34,9 @@ public function getVisitor(ValidationContext $context)
3534
$fragType = $context->getType();
3635
$parentType = $context->getParentType();
3736

38-
if ($fragType && $parentType && !$this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) {
37+
if ($fragType instanceof CompositeType &&
38+
$parentType instanceof CompositeType &&
39+
!$this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) {
3940
$context->reportError(new Error(
4041
self::typeIncompatibleAnonSpreadMessage($parentType, $fragType),
4142
[$node]

0 commit comments

Comments
 (0)