Type
abstract class Type
PHP return, property and parameter types.
Constants
| String |
|
| Int |
|
| Float |
|
| Bool |
|
| Array |
|
| Object |
|
| Callable |
|
| Iterable |
|
| Void |
|
| Never |
|
| Mixed |
|
| True |
|
| False |
|
| Null |
|
| Self |
|
| Parent |
|
| Static |
|
Methods
Creates a Type object based on reflection. Resolves self, static and parent to the actual class name.
Creates the Type object according to the text notation.
No description
No description
Returns a type that accepts both the current type and the given type.
Verifies type compatibility. For example, it checks if a value of a certain type could be passed as a parameter.
No description
No description
No description
Details
at line 45
static Type|null
fromReflection(ReflectionFunctionAbstract|ReflectionParameter|ReflectionProperty $reflection)
Creates a Type object based on reflection. Resolves self, static and parent to the actual class name.
If the subject has no type, it returns null.
at line 75
static Type
fromString(string $type)
Creates the Type object according to the text notation.
at line 84
static Type
fromValue(mixed $value)
Creates a Type object based on the actual type of value.
at line 101
static Type
fromName(string $name)
| internal |
No description
at line 112
string
toString(bool $complex = false)
No description
at line 119
final string
__toString()
No description
at line 128
Type
include(string|self $type)
Returns a type that accepts both the current type and the given type.
at line 149
bool
accepts(string|self $type)
Verifies type compatibility. For example, it checks if a value of a certain type could be passed as a parameter.
at line 159
protected bool
isAllowedBy(Type $acceptor)
Called when THIS object is the "incoming" type being checked.
at line 168
abstract protected bool
isSupertypeOfAtomic(Type $type)
Validates if the given atomic type matches THIS acceptor.
at line 174
static string
nullable(string $type, bool $nullable = true)
No description
at line 199
static string
union(string ...$types)
No description
at line 206
static string
intersection(string ...$types)
No description