CastToEnum
in package
implements
TypeCasting
Tags
Table of Contents
Interfaces
Properties
- $class : string
- $default : UnitEnum|null
- $info : TypeCastingInfo
- $isNullable : bool
- $type : Type
Methods
- __construct() : mixed
- info() : TypeCastingInfo
- setOptions() : void
- Accepts additional parameters to configure the class Parameters should be scalar value, null or array containing only scalar value and null.
- toVariable() : TValue
- cast() : BackedEnum|UnitEnum
- init() : array<string|int, mixed>
Properties
$class
private
string
$class
$default
private
UnitEnum|null
$default
= null
$info read-only
private
TypeCastingInfo
$info
$isNullable read-only
private
bool
$isNullable
$type read-only
private
Type
$type
Methods
__construct()
public
__construct(ReflectionProperty|ReflectionParameter $reflectionProperty) : mixed
Parameters
- $reflectionProperty : ReflectionProperty|ReflectionParameter
Tags
info()
public
info() : TypeCastingInfo
Return values
TypeCastingInfosetOptions()
Accepts additional parameters to configure the class Parameters should be scalar value, null or array containing only scalar value and null.
public
setOptions([string|null $default = null ][, string|null $className = null ][, bool $emptyStringAsNull = false ]) : void
Parameters
- $default : string|null = null
- $className : string|null = null
- $emptyStringAsNull : bool = false
Tags
toVariable()
public
toVariable(mixed $value) : TValue
Parameters
- $value : mixed
Tags
Return values
TValuecast()
private
cast(mixed $value) : BackedEnum|UnitEnum
Parameters
- $value : mixed
Tags
Return values
BackedEnum|UnitEnuminit()
private
init(ReflectionProperty|ReflectionParameter $reflectionProperty) : array<string|int, mixed>
Parameters
- $reflectionProperty : ReflectionProperty|ReflectionParameter