Skip to content

GenerationExhaustedException ​

Rasuvaeff\PropertyTesting\GenerationExhaustedException

Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2

Extends: RuntimeException

Implements: Throwable, Stringable, PropertyTestingException

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.