Add details to README
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -19,8 +20,7 @@ use InvalidArgumentException;
|
||||
* `map` and `iter` become de facto conditional operators).
|
||||
*
|
||||
* `Option::Some(T)` and `Option::None()` create instances. `get()` is available on options, but will throw an exception
|
||||
* if called on a `None` option. The remaining functions are statically available, and should be provided an `Option`
|
||||
* instance as their final parameter.
|
||||
* if called on a `None` option.
|
||||
*
|
||||
* @template T The type of value represented by this option
|
||||
*/
|
||||
@@ -45,8 +45,8 @@ readonly class Option
|
||||
public function get(): mixed
|
||||
{
|
||||
return match (true) {
|
||||
self::isSome($this) => $this->value,
|
||||
default => throw new InvalidArgumentException('Cannot get the value of a None option'),
|
||||
$this->isSome() => $this->value,
|
||||
default => throw new InvalidArgumentException('Cannot get the value of a None option'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user