ForwardingTargetMismatch
Rasuvaeff\Understudy\Exception\ForwardingTargetMismatch
Class — Package: rasuvaeff/understudy — Source — Version: v1.1.0-1-g6ed023f
Extends: InvalidArgumentException
Implements: Stringable, Throwable, Exception\UnderstudyError
The instance offered as a forwarding target does not satisfy what the double stands in for.
Methods
understudyTarget()
static understudyTarget(non-empty-string $label): selfBuilds the error for forwarding to another understudy.
missingContract()
static missingContract(
non-empty-string $label,
class-string $contract,
string $given,
): selfBuilds the error for a forwarding target missing a contract.
alreadyInline()
static alreadyInline(
non-empty-string $label,
class-string $current,
class-string $given,
): selfBuilds the error for re-pointing a double that already forwards inline.
$label— the double's own name in reports$current— the class whose bodies the double already runs$given— the class of the instance offered instead
The state of the first donor was copied onto the double, and a copy cannot be taken twice: a readonly property is initialized, and whatever the inline calls have written since would be overwritten by a second donor's reading. Re-pointing is refused rather than silently leaving the double running the first donor's state against the second one's instance.