static public typeIncompatibleAnonSpreadMessage ( $parentType, $fragType ) |
public function __invoke(ValidationContext $context) { return [Node::INLINE_FRAGMENT => function (InlineFragment $node) use($context) { $fragType = Type::getUnmodifiedType($context->getType()); $parentType = $context->getParentType(); if ($fragType && $parentType && !$this->doTypesOverlap($fragType, $parentType)) { return new Error(Messages::typeIncompatibleAnonSpreadMessage($parentType, $fragType), [$node]); } }, Node::FRAGMENT_SPREAD => function (FragmentSpread $node) use($context) { $fragName = $node->name->value; $fragType = Type::getUnmodifiedType($this->getFragmentType($context, $fragName)); $parentType = $context->getParentType(); if ($fragType && $parentType && !$this->doTypesOverlap($fragType, $parentType)) { return new Error(Messages::typeIncompatibleSpreadMessage($fragName, $parentType, $fragType), [$node]); } }]; }
private function errorAnon($parentType, $fragType, $line, $column) { return new FormattedError(Messages::typeIncompatibleAnonSpreadMessage($parentType, $fragType), [new SourceLocation($line, $column)]); }