public static function convert(?NodeInterface $node, TypeInterface $type, array $variables = [])
    {
        if (null === $node) {
            throw new ConversionException('Node is not defined.');
        }

        if ($type instanceof NonNullType) {
            return self::convertNonNullType($node, $type, $variables);
        }

        if ($node instanceof NullValueNode) {
            return null;
        }

        if ($node instanceof VariableNode) {
            return self::convertVariable($node, $variables);
        }

        if ($type instanceof ListType) {
            return self::convertListType($node, $type, $variables);
        }

        if ($type instanceof InputObjectType) {
            return self::convertInputObjectType($node, $type, $variables);
        }

        if ($type instanceof EnumType) {
            return self::convertEnumType($node, $type);
        }

        if ($type instanceof ScalarType) {
            return self::convertScalarType($node, $type, $variables);
        }

        throw new InvalidTypeException(\sprintf('Unknown type: %s', (string)$type));
    }
public static function convert(?NodeInterface $node, TypeInterface $type, array $variables = [])
    {
        if (null === $node) {
            throw new ConversionException('Node is not defined.');
        }

        if ($type instanceof NonNullType) {
            return self::convertNonNullType($node, $type, $variables);
        }

        if ($node instanceof NullValueNode) {
            return null;
        }

        if ($node instanceof VariableNode) {
            return self::convertVariable($node, $variables);
        }

        if ($type instanceof ListType) {
            return self::convertListType($node, $type, $variables);
        }

        if ($type instanceof InputObjectType) {
            return self::convertInputObjectType($node, $type, $variables);
        }

        if ($type instanceof EnumType) {
            return self::convertEnumType($node, $type);
        }

        if ($type instanceof ScalarType) {
            return self::convertScalarType($node, $type, $variables);
        }

        throw new InvalidTypeException(\sprintf('Unknown type: %s', (string)$type));
    }
public static function convert ( ? NodeInterface $ node , TypeInterface $ type , array $ variables = [ ] ) { if ( null === $ node ) { throw new ConversionException ( 'Node is not defined.' ) ; } if ( $ type instanceof NonNullType ) { return self :: convertNonNullType ( $ node , $ type , $ variables ) ; } if ( $ node instanceof NullValueNode ) { return null ; } if ( $ node instanceof VariableNode ) { return self :: convertVariable ( $ node , $ variables ) ; } if ( $ type instanceof ListType ) { return self :: convertListType ( $ node , $ type , $ variables ) ; } if ( $ type instanceof InputObjectType ) { return self :: convertInputObjectType ( $ node , $ type , $ variables ) ; } if ( $ type instanceof EnumType ) { return self :: convertEnumType ( $ node , $ type ) ; } if ( $ type instanceof ScalarType ) { return self :: convertScalarType ( $ node , $ type , $ variables ) ; } throw new InvalidTypeException ( \ sprintf ( 'Unknown type: %s' , ( string ) $ type ) ) ; }
Produces a PHP value given a GraphQL Value AST.

A GraphQL type must be provided, which will be used to interpret different
GraphQL Value literals.

Throws a `ConversionException` when the value could not be validly converted according to
the provided type.

| GraphQL Value        | JSON Value    |
| -------------------- | ------------- |
| Input Object         | Object        |
| List                 | Array         |
| Boolean              | Boolean       |
| String               | String        |
| Int / Float          | Number        |
| Enum Value           | Mixed         |
| NullValue            | null          |

@param NodeInterface|ValueNodeInterface|null $node
@param TypeInterface                         $type
@param array                                 $variables
@return mixed|null
@throws InvalidTypeException
@throws InvariantException
@throws ConversionException
Produces a PHP value given a GraphQL Value AST .