Add PhpOption support to Option::of
This commit is contained in:
@@ -82,8 +82,8 @@ readonly class Option
|
||||
public static function of(mixed $value): self
|
||||
{
|
||||
return match (true) {
|
||||
// TODO: can we do this check without requiring this package?
|
||||
// $value instanceof PhpOption => $value->isDefined() ? self::Some($value->get()) : self::None(),
|
||||
is_object($value) && is_a($value, 'PhpOption\Option') =>
|
||||
$value->isDefined() ? self::Some($value->get()) : self::None(),
|
||||
default => new self($value),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user