final class IntegerDomain
    implements ValueDomain

Constructs bounded unsigned decimals by prefix intervals, independent of native integer width.

Methods§

public function __construct(
    private string $minimum,
    private ?string $maximum,
    private int $maximumLeadingZeroes = 16,
    private bool $digitSeparators = false,
)

Binds normalized inclusive magnitudes; leading zeroes are spelling choices, not magnitude changes.

Parameters

$minimumstring
$maximum?string
$maximumLeadingZeroesint
$digitSeparatorsbool

Throws

InvalidArgumentException When magnitudes or padding bounds are invalid
Calls 6
public function choose(Closure(positive-int): int $choose): string

Every magnitude in the interval is reachable; no sample rejection or domain enumeration is needed.

Parameters

$chooseClosure(positive-int): int

Returns

string

Throws

LogicException When a caller decision makes a decimal prefix impossible
Test cases 5
Called from 1
Calls 4
public function normalized(string $value): bool

Checks declaration bounds without interpreting them as machine integers.

Parameters

$valuestring

Returns

bool
Test cases 1
Called from 2
Calls 2
public function compare(string $left, string $right): int

Orders normalized magnitudes by width and then by digits.

Parameters

$leftstring
$rightstring

Returns

int
Test cases 1
Called from 1
Calls 2

Private surface 7§

Implementation details, listed for orientation only.

private positive-int $widthChoices
private positive-int $paddingChoices
private string $sampleMaximum
private string $minimum
private ?string $maximum
private int $maximumLeadingZeroes = 16
private bool $digitSeparators = false

Test cases 37§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 9
Other tests reaching this symbol 28

Relations§

Instantiated in 7
Method calls 3