PHP Class GraphQL\Utils\TypeInfo

Show file Open project: webonyx/graphql-php Class Usage Examples

Public Methods

Method Description
__construct ( Schema $schema ) TypeInfo constructor.
doTypesOverlap ( Schema $schema, GraphQL\Type\Definition\CompositeType $typeA, GraphQL\Type\Definition\CompositeType $typeB ) Provided two composite types, determine if they "overlap". Two composite types overlap when the Sets of possible concrete types for each intersect.
enter ( Node $node )
getArgument ( ) : FieldArgument | null
getDirective ( ) : Directive | null
getFieldDef ( ) : FieldDefinition
getInputType ( ) : GraphQL\Type\Definition\InputType
getParentType ( ) : Type
getType ( ) : Type
isEqualType ( Type $typeA, Type $typeB ) Provided two types, return true if the types are equal (invariant).
isTypeSubTypeOf ( Schema $schema, Type $maybeSubType, Type $superType ) Provided a type and a super type, return true if the first type is either equal or a subset of the second super type (covariant).
leave ( Node $node )
typeFromAST ( Schema $schema, $inputTypeNode ) : Type

Private Methods

Method Description
getFieldDefinition ( Schema $schema, Type $parentType, FieldNode $fieldNode ) : FieldDefinition Not exactly the same as the executor's definition of getFieldDef, in this statically evaluated environment we do not always have an Object type, and need to handle Interface and Union types.

Method Details

__construct() public method

TypeInfo constructor.
public __construct ( Schema $schema )
$schema GraphQL\Schema

doTypesOverlap() static public method

This is often used to determine if a fragment of a given type could possibly be visited in a context of another type. This function is commutative.
static public doTypesOverlap ( Schema $schema, GraphQL\Type\Definition\CompositeType $typeA, GraphQL\Type\Definition\CompositeType $typeB )
$schema GraphQL\Schema
$typeA GraphQL\Type\Definition\CompositeType
$typeB GraphQL\Type\Definition\CompositeType

enter() public method

public enter ( Node $node )
$node GraphQL\Language\AST\Node

getArgument() public method

public getArgument ( ) : FieldArgument | null
return GraphQL\Type\Definition\FieldArgument | null

getDirective() public method

public getDirective ( ) : Directive | null
return GraphQL\Type\Definition\Directive | null

getFieldDef() public method

public getFieldDef ( ) : FieldDefinition
return GraphQL\Type\Definition\FieldDefinition

getInputType() public method

public getInputType ( ) : GraphQL\Type\Definition\InputType
return GraphQL\Type\Definition\InputType

getParentType() public method

public getParentType ( ) : Type
return GraphQL\Type\Definition\Type

getType() public method

public getType ( ) : Type
return GraphQL\Type\Definition\Type

isEqualType() public static method

Provided two types, return true if the types are equal (invariant).
public static isEqualType ( Type $typeA, Type $typeB )
$typeA GraphQL\Type\Definition\Type
$typeB GraphQL\Type\Definition\Type

isTypeSubTypeOf() static public method

Provided a type and a super type, return true if the first type is either equal or a subset of the second super type (covariant).
static public isTypeSubTypeOf ( Schema $schema, Type $maybeSubType, Type $superType )
$schema GraphQL\Schema
$maybeSubType GraphQL\Type\Definition\Type
$superType GraphQL\Type\Definition\Type

leave() public method

public leave ( Node $node )
$node GraphQL\Language\AST\Node

typeFromAST() public static method

public static typeFromAST ( Schema $schema, $inputTypeNode ) : Type
$schema GraphQL\Schema
return GraphQL\Type\Definition\Type