Enumerable
Rasuvaeff\PropertyTesting\Enumerable
Interface — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2
Implements: ArbitraryInterface
Implemented by: Arbitrary\BoolArbitrary, Arbitrary\ConstantArbitrary, Arbitrary\EdgeCasedArbitrary, Arbitrary\FilteredArbitrary, Arbitrary\IntArbitrary, Arbitrary\MappedArbitrary, Arbitrary\NullableArbitrary, Arbitrary\OneOfArbitrary, Arbitrary\RecordArbitrary, Arbitrary\TupleArbitrary
Type parameters:
TValue of mixed = mixed
A generator whose whole domain can be counted and walked — the seam the exhaustive mode of Runner\PropertyConfig::$exhaustive needs: when every parameter's generator implements it and the product of their sizes fits the budget, the random phase enumerates the product instead of sampling it, and a pass is a proof over the parameters rather than a probability statement.
A generator implements it when its domain is finite in some configurations: domainSize() answers null for the others (a nullable over an unbounded inner, a tuple with one unbounded element), and the mode declines to random for that property — the way Gen::oneOf() refuses generators rather than guessing.
The built-in implementers: Gen::constant(), Gen::bool(), Gen::intBetween() (and int(), at a size no budget accepts), Gen::elements()/enum()/oneOf(), Gen::nullable(), Gen::tuple(), Gen::record(), Gen::map(), Gen::filter() and Gen::withEdgeCases() over enumerable sources.
Methods
domainSize()
domainSize(): ?intHow many distinct values enumerate() walks, or null when the domain is not finite in this configuration. Saturates at PHP_INT_MAX rather than overflowing — a budget compares against it, nothing computes with it. An upper bound is acceptable where the exact count is not known without walking (a filter over a finite source).
enumerate()
enumerate(): iterableEvery value of the domain, once each, as a shrinkable node with the same tree generate() would give it, in a fixed order that does not depend on any seed. Only meaningful when domainSize() is not null; an implementation may throw otherwise.