Documentation

Result
in package

AbstractYes
Tags
template

T

template

E

psalm-inheritors

Ok|Err

psalm-yield

T

Table of Contents

Methods

Err()  : Result<never, F>
flatMap()  : Result<U, E>
get()  : Option<string|int, T>
isErr()  : bool
isErrAnd()  : bool
isOk()  : bool
isOkAnd()  : bool
map()  : Result<U, E>
mapErr()  : Result<T, F>
mapOr()  : U
Ok()  : Result<U, never>
try()  : Result<O, Throwable>
unwrap()  : T
Returns the Ok value. In the Err case, if the error value if throwable, it is thrown.
unwrapErr()  : E
Returns the Err value, Throws otherwise.
unwrapOr()  : T
unwrapOrElse()  : T
Get the value if Ok. Returns the result of the given callback otherwise.
with()  : Result<O, F>

Methods

Err()

public final static Err(F $error) : Result<never, F>
Parameters
$error : F
Tags
template

F

Return values
Result<never, F>

flatMap()

public abstract flatMap(callable $f) : Result<U, E>
Parameters
$f : callable
Tags
template

U

Return values
Result<U, E>

isErr()

public abstract isErr() : bool
Tags
psalm-assert-if-true

Err<E> $this

Return values
bool

isErrAnd()

public abstract isErrAnd(callable $predicate) : bool
Parameters
$predicate : callable
Tags
psalm-assert-if-true

Err<E> $this

Return values
bool

isOk()

public abstract isOk() : bool
Tags
psalm-assert-if-true

Ok<T> $this

Return values
bool

isOkAnd()

public abstract isOkAnd(callable $predicate) : bool
Parameters
$predicate : callable
Tags
psalm-assert-if-true

Ok<T> $this

Return values
bool

map()

public abstract map(callable $f) : Result<U, E>
Parameters
$f : callable
Tags
template

U

Return values
Result<U, E>

mapErr()

public abstract mapErr(callable $f) : Result<T, F>
Parameters
$f : callable
Tags
template

F

Return values
Result<T, F>

mapOr()

public abstract mapOr(U $default, callable $f) : U
Parameters
$default : U
$f : callable
Tags
template

U

Return values
U

Ok()

public final static Ok(U $value) : Result<U, never>
Parameters
$value : U
Tags
template

U

Return values
Result<U, never>

try()

public final static try(callable $procedure) : Result<O, Throwable>
Parameters
$procedure : callable
Tags
template

O

Return values
Result<O, Throwable>

unwrap()

Returns the Ok value. In the Err case, if the error value if throwable, it is thrown.

public abstract unwrap() : T

Otherwise, throws RuntimeException.

Tags
throws
RuntimeException

if Err variant is not throwable.

Return values
T

unwrapErr()

Returns the Err value, Throws otherwise.

public abstract unwrapErr() : E
Tags
throws
RuntimeException

if $this is Ok variant.

Return values
E

unwrapOr()

public abstract unwrapOr(T $default) : T
Parameters
$default : T
Return values
T

unwrapOrElse()

Get the value if Ok. Returns the result of the given callback otherwise.

public abstract unwrapOrElse(callable $fallback) : T
Parameters
$fallback : callable
Return values
T

with()

public final static with(callable $expr) : Result<O, F>
Parameters
$expr : callable
Tags
template

U

template

F

template

O

psalm-suppress

InvalidArgument

Return values
Result<O, F>

        
On this page

Search results