Skip to content

Outcome

Rasuvaeff\Understudy\Outcome

ClassPackage: rasuvaeff/understudySourceVersion: v0.4.1

How one call ended: with a value or with a throwable. Kept as its own type because null is a perfectly valid return value and cannot double as "nothing was returned".

Constructor

php
__construct(
    bool $returned,
    mixed $value,
    ?Throwable $thrown,
)
ParameterTypeDefaultDescription
$returnedboolrequired
$valuemixedrequired
$thrown?Throwablerequired

Methods

returnedValue()

php
static returnedValue(mixed $value): self

thrownError()

php
static thrownError(Throwable $thrown): self

didReturn()

php
didReturn(): bool

didThrow()

php
didThrow(): bool

returned()

php
returned(non-empty-string $method): mixed
  • $method — used only to render a helpful message

thrown()

php
thrown(): ?Throwable