Skip to content

GenerationExhausted

Rasuvaeff\PropertyTesting\GenerationExhausted

ClassPackage: property-testing-coreSourceVersion: v0.1.0-12-g86ead85

Extends: RuntimeException

Implements: Stringable, Throwable

Thrown when a bounded-attempt generator cannot produce a value that satisfies its constraint within its attempt budget: Arbitrary\FilteredArbitrary whose predicate rejected every draw, or a sized collection (Arbitrary\DictionaryArbitrary, Arbitrary\UniqueArrayArbitrary, Arbitrary\CommandSequenceArbitrary) that could not reach its declared minimum.

A generator NEVER yields a value outside its declared domain — it fails loudly with this exception instead, so a property never silently receives an out-of-domain input. Exhaustion can be transient (a satisfiable-but-rare predicate) or structural (a domain too small to ever meet the minimum); the message describes what happened and how to widen the domain.

Constructor

php
__construct(
    string $arbitrary,
    int $attempts,
    string $reason,
)
ParameterTypeDefaultDescription
$arbitrarystringrequiredHuman-readable label of the generator that gave up (e.g. Gen::filter()).
$attemptsintrequiredAttempt budget spent before giving up.
$reasonstringrequiredWhat could not be satisfied and how to fix it.