Flow PHP

IntersectionType implements Type

Read onlyYes
FinalYes
Tags
template
template
implements

Interfaces

Type

Methods

__construct()  : mixed
assert()  : TLeft|TRight
Checks if the value is of the type of given type.
cast()  : T
Takes a value and when necessary casts it to the type of this object.
fromArray()  : type<string|int, TLeft|TRight>
isValid()  : bool
Checks if the value is of the type of this object.
normalize()  : array{type: "intersection", left: array, right: array}
toString()  : string
Returns a string representation of the type.
types()  : Types

Methods

__construct()

public __construct(Type<string|int, TLeft$left, Type<string|int, TRight$right) : mixed
Parameters
$left : Type<string|int, TLeft>
$right : Type<string|int, TRight>

assert()

Checks if the value is of the type of given type.

public assert(mixed $value) : TLeft|TRight
Parameters
$value : mixed
Return values
TLeft|TRight

cast()

Takes a value and when necessary casts it to the type of this object.

public cast(mixed $value) : T

When value is already of the type of this object, it is returned as is. When cast method is used, it will additionally narrow the type of the returned value for static analysis tools.

Parameters
$value : mixed
Return values
T

fromArray()

public static fromArray(array{type: "intersection", left: array, right: array} $data) : type<string|int, TLeft|TRight>
Parameters
$data : array{type: "intersection", left: array, right: array}
Return values
type<string|int, TLeft|TRight>

isValid()

Checks if the value is of the type of this object.

public isValid(mixed $value) : bool

When isValid method is used, it will not narrow the type of the value for static analysis tools.

Parameters
$value : mixed
Return values
bool

normalize()

public normalize() : array{type: "intersection", left: array, right: array}
Return values
array{type: "intersection", left: array, right: array}

toString()

Returns a string representation of the type.

public toString() : string
  • string - for type_string()
  • int - for type_int()
  • ?float - for type_optional(type_float())
Return values
string

        
On this page

Search results