Skip to content

NeverMethodCalled ​

Rasuvaeff\Understudy\Exception\NeverMethodCalled

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

Extends: RuntimeException

Implements: Throwable, Stringable, Exception\UnderstudyError

A method declared : never was called without an expectation that throws.

Returning from it is impossible by language rule, so the dispatcher must throw something — this says so explicitly instead of leaking a TypeError.

Methods ​

withoutExpectation() ​

php
static withoutExpectation(non-empty-string $label, non-empty-string $method): self

Builds the error for an unconfigured never method call.

withoutAnAction() ​

php
static withoutAnAction(non-empty-string $label, non-empty-string $method): self

Builds the error for a never expectation with no action.

configuredToReturn() ​

php
static configuredToReturn(non-empty-string $label, non-empty-string $method): self

Builds the error for a never method configured to return.