From c5efd1d65b8d2b43e48e09a7f58d89ba30a5c714 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Wed, 20 Sep 2017 19:06:04 +0700 Subject: [PATCH] Additional checks for possible fragment spreads --- src/Validator/Rules/PossibleFragmentSpreads.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Validator/Rules/PossibleFragmentSpreads.php b/src/Validator/Rules/PossibleFragmentSpreads.php index fec7dc7..3e7332e 100644 --- a/src/Validator/Rules/PossibleFragmentSpreads.php +++ b/src/Validator/Rules/PossibleFragmentSpreads.php @@ -5,7 +5,6 @@ namespace GraphQL\Validator\Rules; use GraphQL\Error\Error; use GraphQL\Language\AST\FragmentSpreadNode; use GraphQL\Language\AST\InlineFragmentNode; -use GraphQL\Language\AST\Node; use GraphQL\Language\AST\NodeKind; use GraphQL\Type\Schema; use GraphQL\Type\Definition\AbstractType; @@ -35,7 +34,9 @@ class PossibleFragmentSpreads extends AbstractValidationRule $fragType = $context->getType(); $parentType = $context->getParentType(); - if ($fragType && $parentType && !$this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) { + if ($fragType instanceof CompositeType && + $parentType instanceof CompositeType && + !$this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) { $context->reportError(new Error( self::typeIncompatibleAnonSpreadMessage($parentType, $fragType), [$node]