Update properties in README
This commit is contained in:
parent
483d7875d5
commit
9327d8fa29
10
README.md
10
README.md
|
@ -2,6 +2,8 @@
|
|||
|
||||
This project contains PHP utility classes whose functionality is inspired by their F# counterparts.
|
||||
|
||||
The v2 series requires at least PHP 8.4. A similar API exists for PHP 8.2 - 8.3 in version 1 of this project; see its README for specifics.
|
||||
|
||||
## What It Provides
|
||||
|
||||
This early-stage library currently provides two classes, both of which are designed to wrap values and indicate the state of the action that produced them. `Option<T>` represents a variable that may or may not have a value. `Result<TOK, TError>` represents the result of an action; the "ok" and "error" states both provide a value.
|
||||
|
@ -11,12 +13,12 @@ This early-stage library currently provides two classes, both of which are desig
|
|||
| **Creating** | `::Some(T)` for Some | `::OK(TOK)` for OK |
|
||||
| | `::None()` for None | `::Error(TError)` for Error |
|
||||
| | `::of($value)` _None if `null`_ | |
|
||||
| **Querying** | `->isSome(): bool` | `->isOK(): bool` |
|
||||
| | `->isNone(): bool` | `->isError(): bool` |
|
||||
| **Querying** | `->isSome: bool` | `->isOK: bool` |
|
||||
| | `->isNone: bool` | `->isError: bool` |
|
||||
| | `->contains(T, $strict = true): bool` | `->contains(TOK, $strict = true): bool` |
|
||||
| | `->exists(callable(T): bool): bool` | `->exists(callable(TOK): bool): bool` |
|
||||
| **Reading**<br> | `->get(): T` | `->getOK(): TOK` |
|
||||
| _all throw if called on missing value_ | | `->getError(): TError` |
|
||||
| **Reading**<br> | `->value: T` | `->ok: TOK` |
|
||||
| _all throw if called on missing value_ | | `->error: TError` |
|
||||
| **Transforming**<br> | `->map(callable(T): TMapped): Option<TMapped>` | `->map(callable(TOK): TMapped): Result<TMapped, TError>` |
|
||||
| _all still `Option` or `Result`_ | | `->mapError(callable(TError): TMapped): Result<TOK, TMapped>` |
|
||||
| **Iterating** | `->iter(callable(T): void): void` | `->iter(callable(TOK): void): void` |
|
||||
|
|
Loading…
Reference in New Issue
Block a user