Skip to content

ForgottenDouble ​

Rasuvaeff\Understudy\Exception\ForgottenDouble

Class — Package: rasuvaeff/understudy — Source — Version: v1.1.0-1-g6ed023f

Extends: LogicException

Implements: Throwable, Stringable, Exception\UnderstudyError

A double outlived the context that created it — almost always a double kept in a static property or a shared fixture across Understudy::reset().

Answering with null instead would violate the declared return type of any non-nullable method and surface far from the actual mistake.

Methods ​

afterReset() ​

php
static afterReset(non-empty-string $method): self

Builds the error for calling a double after its context was reset.

afterScope() ​

php
static afterScope(non-empty-string $member): self

The double was built inside Understudy::scope() and the scope has closed since. There is no reset() to look for.

  • $member — the method called on the double, or the facade verb it was handed to

onPurpose() ​

php
static onPurpose(non-empty-string $method): self

Builds the error for calling a deliberately retired double.

propertyAfterReset() ​

php
static propertyAfterReset(non-empty-string $property): self

Builds the error for reading a property after reset.

retired() ​

php
static retired(): self

Builds the error for asking a retired double through the facade.

A facade — strict(), verify(), nothingElse(), forget() itself — was asked about a double that Understudy::forget() retired.

fromDefaultFactory() ​

php
static fromDefaultFactory(class-string $contract): self

Builds the error for a default factory returning a retired double.