RecordArbitrary
Rasuvaeff\PropertyTesting\Arbitrary\RecordArbitrary
Class — Package: property-testing-core — Source — Version: v0.1.0-12-g86ead85
Implements: ArbitraryInterface
Fixed-shape associative array: produces a map with one value per named field, each drawn from that field's arbitrary. Useful for generating DTO-shaped payloads where every key is known up front (the property receives the record as a single string-keyed array argument).
Shrinking keeps the key set fixed and shrinks one field at a time through that field's own shrink tree, so each value shrinks within its domain.
Constructor
__construct(
array<string,\ArbitraryInterface> $shape,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$shape | array<string,\ArbitraryInterface> | required | Field name => arbitrary for that field. |
Methods
generate()
generate(Random $random): ShrinkableProduce one random value from this arbitrary's space, together with its shrink tree. Candidates must be ordered most aggressive first (typically toward a zero/empty/identity element) and every branch of the tree must be finite, so shrinking terminates.
Documentation inherited from ArbitraryInterface.