Add details to README

This commit is contained in:
2024-07-28 17:35:11 -04:00
parent 5a8a41a660
commit efb3a4461e
3 changed files with 67 additions and 6 deletions

View File

@@ -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'),
};
}