Welcome to FrostSW!

FrostMVC PHP Framework

Documentation   |   Version

Nullable

FrostMVC\Nullable

use FrostMVC\Nullable;

Sentinel type used as a typed "no argument provided" marker.

PHP does not have a built-in way to distinguish between a caller passing null and a caller omitting an optional parameter. Using new Nullable() as a default value combined with Nullable::is() / Nullable::isNot() allows methods to detect whether an argument was actually supplied.

Methods

::is()

Returns true when the given value is an instance of Nullable. Use this to detect that an optional parameter was not supplied.

::isNot()

Returns true when the given value is NOT an instance of Nullable. Use this to detect that an optional parameter was actually supplied.

::isNull()

Returns true when the value is strictly PHP null. Provided for completeness; prefer a === null check directly in most cases.

is() static

Nullable::is($object)

Returns true when the given value is an instance of Nullable. Use this to detect that an optional parameter was not supplied.

Parameters

$object mixed

Returns

bool

isNot() static

Nullable::isNot($object)

Returns true when the given value is NOT an instance of Nullable. Use this to detect that an optional parameter was actually supplied.

Parameters

$object mixed

Returns

bool

isNull() static

Nullable::isNull($value)

Returns true when the value is strictly PHP null. Provided for completeness; prefer a === null check directly in most cases.

Parameters

$value mixed

Returns

bool

Generated from core/classes/Nullable.php (FrostMVC ).