private function coerceValue($value, $type, $blameNode, ?Path $path = null): CoercedValue
    {
        if ($type instanceof NonNullType) {
            return $this->coerceValueForNonNullType($value, $type, $blameNode, $path);
        }

        if (null === $value) {
            return new CoercedValue(null);
        }

        if ($type instanceof ScalarType) {
            return $this->coerceValueForScalarType($value, $type, $blameNode, $path);
        }

        if ($type instanceof EnumType) {
            return $this->coerceValueForEnumType($value, $type, $blameNode, $path);
        }

        if ($type instanceof ListType) {
            return $this->coerceValueForListType($value, $type, $blameNode, $path);
        }

        if ($type instanceof InputObjectType) {
            return $this->coerceValueForInputObjectType($value, $type, $blameNode, $path);
        }

        throw new GraphQLException('Unexpected type.');
    }
private function coerceValue($value, $type, $blameNode, ?Path $path = null): CoercedValue
    {
        if ($type instanceof NonNullType) {
            return $this->coerceValueForNonNullType($value, $type, $blameNode, $path);
        }

        if (null === $value) {
            return new CoercedValue(null);
        }

        if ($type instanceof ScalarType) {
            return $this->coerceValueForScalarType($value, $type, $blameNode, $path);
        }

        if ($type instanceof EnumType) {
            return $this->coerceValueForEnumType($value, $type, $blameNode, $path);
        }

        if ($type instanceof ListType) {
            return $this->coerceValueForListType($value, $type, $blameNode, $path);
        }

        if ($type instanceof InputObjectType) {
            return $this->coerceValueForInputObjectType($value, $type, $blameNode, $path);
        }

        throw new GraphQLException('Unexpected type.');
    }
private function coerceValue ( $ value , $ type , $ blameNode , ? Path $ path = null ) : CoercedValue { if ( $ type instanceof NonNullType ) { return $ this -> coerceValueForNonNullType ( $ value , $ type , $ blameNode , $ path ) ; } if ( null === $ value ) { return new CoercedValue ( null ) ; } if ( $ type instanceof ScalarType ) { return $ this -> coerceValueForScalarType ( $ value , $ type , $ blameNode , $ path ) ; } if ( $ type instanceof EnumType ) { return $ this -> coerceValueForEnumType ( $ value , $ type , $ blameNode , $ path ) ; } if ( $ type instanceof ListType ) { return $ this -> coerceValueForListType ( $ value , $ type , $ blameNode , $ path ) ; } if ( $ type instanceof InputObjectType ) { return $ this -> coerceValueForInputObjectType ( $ value , $ type , $ blameNode , $ path ) ; } throw new GraphQLException ( 'Unexpected type.' ) ; }
Returns either a value which is valid for the provided type or a list of
encountered coercion errors.

@param mixed|array   $value
@param mixed         $type
@param NodeInterface $blameNode
@param Path|null     $path
@return CoercedValue
@throws GraphQLException
@throws InvariantException
Returns either a value which is valid for the provided type or a list of encountered coercion errors .