BooleanType
extends ScalarType
in package
Scalar Type Definition
The leaf values of any request and input values to arguments are Scalars (or Enums) and are defined with a name and a series of coercion functions used to ensure validity.
Example:
class OddType extends ScalarType { public $name = 'Odd', public function serialize($value) { return $value % 2 === 1 ? $value : null; } }
Table of Contents
- BOOLEAN = 'Boolean'
- FLOAT = 'Float'
- ID = 'ID'
- INT = 'Int'
- STRING = 'String'
- $astNode : TypeDefinitionNode|null
- $config : array<string|int, mixed>
- $description : string
- $extensionASTNodes : array<string|int, TypeExtensionNode>
- $name : string
- $standardTypes : array<string, ScalarType>
- $builtInTypes : array<string|int, Type>
- __construct() : mixed
- __toString() : string
- assertType() : Type
- assertValid() : mixed
- boolean() : ScalarType
- float() : ScalarType
- getAllBuiltInTypes() : array<string|int, Type>
- Returns all builtin in types including base scalar and introspection types
- getInternalTypes() : array<string|int, Type>
- getNamedType() : Type|null
- getNullableType() : Type
- getStandardTypes() : array<string|int, ScalarType>
- Returns all builtin scalar types
- id() : ScalarType
- int() : ScalarType
- isAbstractType() : bool
- isBuiltInType() : bool
- Checks if the type is a builtin type
- isCompositeType() : bool
- isInputType() : bool
- isLeafType() : bool
- isOutputType() : bool
- jsonSerialize() : string
- listOf() : ListOfType
- nonNull() : NonNull
- overrideStandardTypes() : mixed
- parseLiteral() : mixed
- parseValue() : bool
- serialize() : bool
- Serialize the given value to a boolean.
- string() : ScalarType
- toString() : string
- tryInferName() : string|null
Constants
BOOLEAN
public
mixed
BOOLEAN
= 'Boolean'
FLOAT
public
mixed
FLOAT
= 'Float'
ID
public
mixed
ID
= 'ID'
INT
public
mixed
INT
= 'Int'
STRING
public
mixed
STRING
= 'String'
Properties
$astNode
public
TypeDefinitionNode|null
$astNode
$config
public
array<string|int, mixed>
$config
$description
public
string
$description
= 'The `Boolean` scalar type represents `true` or `false`.'
$extensionASTNodes
public
array<string|int, TypeExtensionNode>
$extensionASTNodes
$name
public
string
$name
= \GraphQL\Type\Definition\Type::BOOLEAN
$standardTypes
protected
static array<string, ScalarType>
$standardTypes
$builtInTypes
private
static array<string|int, Type>
$builtInTypes
Methods
__construct()
public
__construct([array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $config : array<string|int, mixed> = []
Return values
mixed —__toString()
public
__toString() : string
Return values
string —assertType()
public
static assertType(mixed $type) : Type
Parameters
- $type : mixed
Return values
Type —assertValid()
public
assertValid() : mixed
Tags
Return values
mixed —boolean()
public
static boolean() : ScalarType
Return values
ScalarType —float()
public
static float() : ScalarType
Return values
ScalarType —getAllBuiltInTypes()
Returns all builtin in types including base scalar and introspection types
public
static getAllBuiltInTypes() : array<string|int, Type>
Return values
array<string|int, Type> —getInternalTypes()
public
static getInternalTypes() : array<string|int, Type>
Tags
Return values
array<string|int, Type> —getNamedType()
public
static getNamedType(Type $type) : Type|null
Parameters
- $type : Type
Return values
Type|null —getNullableType()
public
static getNullableType(Type $type) : Type
Parameters
- $type : Type
Return values
Type —getStandardTypes()
Returns all builtin scalar types
public
static getStandardTypes() : array<string|int, ScalarType>
Return values
array<string|int, ScalarType> —id()
public
static id() : ScalarType
Return values
ScalarType —int()
public
static int() : ScalarType
Return values
ScalarType —isAbstractType()
public
static isAbstractType(Type $type) : bool
Parameters
- $type : Type
Return values
bool —isBuiltInType()
Checks if the type is a builtin type
public
static isBuiltInType(Type $type) : bool
Parameters
- $type : Type
Return values
bool —isCompositeType()
public
static isCompositeType(Type $type) : bool
Parameters
- $type : Type
Return values
bool —isInputType()
public
static isInputType(Type $type) : bool
Parameters
- $type : Type
Return values
bool —isLeafType()
public
static isLeafType(Type $type) : bool
Parameters
- $type : Type
Return values
bool —isOutputType()
public
static isOutputType(Type $type) : bool
Parameters
- $type : Type
Return values
bool —jsonSerialize()
public
jsonSerialize() : string
Return values
string —listOf()
public
static listOf(Type $wrappedType) : ListOfType
Parameters
- $wrappedType : Type
Return values
ListOfType —nonNull()
public
static nonNull(callable|NullableType $wrappedType) : NonNull
Parameters
- $wrappedType : callable|NullableType
Return values
NonNull —overrideStandardTypes()
public
static overrideStandardTypes(array<string, ScalarType> $types) : mixed
Parameters
- $types : array<string, ScalarType>
Return values
mixed —parseLiteral()
public
parseLiteral(Node $valueNode[, array<string|int, mixed>|null $variables = null ]) : mixed
Parameters
- $valueNode : Node
- $variables : array<string|int, mixed>|null = null
Tags
Return values
mixed —parseValue()
public
parseValue(mixed $value) : bool
Parameters
- $value : mixed
Tags
Return values
bool —serialize()
Serialize the given value to a boolean.
public
serialize(mixed $value) : bool
The GraphQL spec leaves this up to the implementations, so we just do what PHP does natively to make this intuitive for developers.
Parameters
- $value : mixed
Return values
bool —string()
public
static string() : ScalarType
Return values
ScalarType —toString()
public
toString() : string
Return values
string —tryInferName()
protected
tryInferName() : string|null