GraphQL\Validator\Rules\PossibleFragmentSpreads::__invoke PHP Метод

__invoke() публичный Метод

public __invoke ( ValidationContext $context )
$context GraphQL\Validator\ValidationContext
    public function __invoke(ValidationContext $context)
    {
        return [NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) use($context) {
            $fragType = $context->getType();
            $parentType = $context->getParentType();
            if ($fragType && $parentType && !TypeInfo::doTypesOverlap($context->getSchema(), $fragType, $parentType)) {
                $context->reportError(new Error(self::typeIncompatibleAnonSpreadMessage($parentType, $fragType), [$node]));
            }
        }, NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) use($context) {
            $fragName = $node->name->value;
            $fragType = $this->getFragmentType($context, $fragName);
            $parentType = $context->getParentType();
            if ($fragType && $parentType && !TypeInfo::doTypesOverlap($context->getSchema(), $fragType, $parentType)) {
                $context->reportError(new Error(self::typeIncompatibleSpreadMessage($fragName, $parentType, $fragType), [$node]));
            }
        }];
    }