Types
Table of Contents
Packages
Enums
- Undefined
- A unit enum representing an undefined value.
- Type
- Possible types as returned by {@see gettype()}.
Constants
- undefined = \empaphy\usephul\Type\Undefined::undefined
- Represents an undefined value.
Constants
undefined
Represents an undefined value.
public
mixed
undefined
= \empaphy\usephul\Type\Undefined::undefined
This can be used to explicitly indicate that a variable or parameter may
be undefined, differentiating it from null or other values.
You can use this as a default value to safely check that no valid value was provided:
$value = config('some_key', undefined);
This is useful in cases where null is a valid value, and you need to
distinguish between "no value provided" and "value explicitly set to null".
This constant maps to the singleton case of the Undefined enum, so
you can use the Undefined enum as a type hint:
function example(string|null|Undefined $param = undefined): void }