IsType
class IsType extends Comparator (View source)
Check if the value is of a given type. Supports all scalar types, objects, arrays, callables, classes, interfaces and traits.
Supports the following types:
int
float
bool
string
scalar
numeric
null
array
object
resource
callable
iterable
class
(e.g.MyClass::class
)interface
(e.g.MyInterface::class
)trait
(e.g.MyTrait::class
)
Methods
__construct(string $type)
No description
bool
check(mixed $value)
Compare the input value against the comparator.
Details
__construct(string $type)
No description
final bool
__invoke(mixed $value)
Compare the input value against the comparator.
static IsType
array()
No description
static IsType
bool()
No description
static IsType
callable()
No description
bool
check(mixed $value)
Compare the input value against the comparator.
static IsType
class(string $class)
No description
static IsType
float()
No description
static IsType
int()
No description
static IsType
interface(string $interface)
No description
static IsType
iterable()
No description
static IsType
make(string $type)
No description
static IsType
null()
No description
static IsType
numeric()
No description
static IsType
object()
No description
static IsType
resource()
No description
static IsType
scalar()
No description
static IsType
string()
No description
static IsType
trait(string $trait)
No description