<U>
Transform a value into an Option
.
It will be a Some
option containing $value
if $value
is different from $noneValue
(default null
)
self::assertEq(Option\fromValue("fruits"), Option\some("fruits"));
self::assertEq(Option\fromValue(null), Option\none());
Parameters | |||
---|---|---|---|
U
|
$value |
# | |
mixed
|
$noneValue = null |
# | |
bool
|
$strict = true |
# |
Returns | |
---|---|
Option<U>
|