classIntegerDomain
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
$minimum | string | |
$maximum | ?string | |
$maximumLeadingZeroes | int | |
$digitSeparators | bool |
Throws
InvalidArgumentException When magnitudes or padding bounds are invalidTest cases 13
IntegerDomainTest::testChooseAllowsTheLargestPaddingChoicecoversIntegerDomainTest::testChooseCompletesDigitsBeyondTheMaximumPrefixUpToNinecoversIntegerDomainTest::testChooseReachesAnInteriorValueAndCanForbidPaddingcoversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#0coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#1coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#2coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#3coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#4coversIntegerDomainTest::testChooseSamplesUpToSixtyFiveDigitsWhenNoMaximumIsDeclaredcoversIntegerDomainTest::testCompareOrdersMagnitudesWithoutMachineIntegerConversioncoversIntegerDomainTest::testMatchChecksMagnitudeWhilePreservingLeadingZeroesAndSeparatorscoversIntegerDomainTest::testMatchReadsSeparatorsOnlyWhenTheScannerAcceptsThemcoversIntegerDomainTest::testNormalizedRecognizesCanonicalDeclarationBoundscovers
public function choose(Closure(positive-int): int $choose): stringEvery magnitude in the interval is reachable; no sample rejection or domain enumeration is needed.
Parameters
$choose | Closure(positive-int): int |
Returns
stringThrows
LogicException When a caller decision makes a decimal prefix impossibleTest cases 10
IntegerDomainTest::testChooseAllowsTheLargestPaddingChoicecovers and callsIntegerDomainTest::testChooseCompletesDigitsBeyondTheMaximumPrefixUpToNinecovers and callsIntegerDomainTest::testChooseReachesAnInteriorValueAndCanForbidPaddingcovers and callsIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomaincallsIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#0coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#1coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#2coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#3coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#4coversIntegerDomainTest::testChooseSamplesUpToSixtyFiveDigitsWhenNoMaximumIsDeclaredcovers and calls
public function normalized(string $value): boolChecks declaration bounds without interpreting them as machine integers.
Parameters
$value | string |
Returns
boolTest cases 13
IntegerDomainTest::testChooseAllowsTheLargestPaddingChoicecoversIntegerDomainTest::testChooseCompletesDigitsBeyondTheMaximumPrefixUpToNinecoversIntegerDomainTest::testChooseReachesAnInteriorValueAndCanForbidPaddingcoversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#0coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#1coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#2coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#3coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#4coversIntegerDomainTest::testChooseSamplesUpToSixtyFiveDigitsWhenNoMaximumIsDeclaredcoversIntegerDomainTest::testCompareOrdersMagnitudesWithoutMachineIntegerConversioncoversIntegerDomainTest::testMatchChecksMagnitudeWhilePreservingLeadingZeroesAndSeparatorscoversIntegerDomainTest::testMatchReadsSeparatorsOnlyWhenTheScannerAcceptsThemcoversIntegerDomainTest::testNormalizedRecognizesCanonicalDeclarationBoundscovers and calls
Called from 2
public function match(string $value, int $offset = 0): list<int>Parameters
$value | string | |
$offset | int |
Returns
list<int>Test cases 2
Called from 1
Calls 3
- function-call
str_containsline 91 - function-call
ltrimline 98 - method-call IntegerDomain::compare() line 100
public function compare(string $left, string $right): intOrders normalized magnitudes by width and then by digits.
Parameters
$left | string | |
$right | string |
Returns
intTest cases 3
Called from 1
Private surface 7§
Implementation details, listed for orientation only.
private positive-int $widthChoicesprivate positive-int $paddingChoicesprivate string $sampleMaximumprivate string $minimumprivate ?string $maximumprivate int $maximumLeadingZeroes = 16private bool $digitSeparators = falseTest cases 39§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 14
IntegerDomainTest::testChooseAllowsTheLargestPaddingChoicecovers and callsIntegerDomainTest::testChooseCompletesDigitsBeyondTheMaximumPrefixUpToNinecovers and callsIntegerDomainTest::testChooseReachesAnInteriorValueAndCanForbidPaddingcovers and callsIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomaincallsIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#0coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#1coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#2coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#3coversIntegerDomainTest::testChooseReachesBothBoundsWithoutEnumeratingTheDomain#4coversIntegerDomainTest::testChooseSamplesUpToSixtyFiveDigitsWhenNoMaximumIsDeclaredcovers and callsIntegerDomainTest::testCompareOrdersMagnitudesWithoutMachineIntegerConversioncovers and callsIntegerDomainTest::testMatchChecksMagnitudeWhilePreservingLeadingZeroesAndSeparatorscovers and callsIntegerDomainTest::testMatchReadsSeparatorsOnlyWhenTheScannerAcceptsThemcovers and callsIntegerDomainTest::testNormalizedRecognizesCanonicalDeclarationBoundscovers and calls
Other tests reaching this symbol 25
IntegerLexemeGeneratorTestcallsLexicalExceptionTestcallsCharacterDomainTestcallsChoiceDomainTestcallsSequenceDomainTest::testChooseConstructsAProductWithoutEnumeratingItsMemberscallsValueChoicesTestcallsValueDomainTestcallsGenerationContextTestcallsBoundedIntegerLexemeGeneratorTestcallsCharsetLexemeGeneratorTestcallsCharsetValueLexemeGeneratorTestcallsDefinitionFactoryTestcallsPrecisionLexemeGeneratorTestcallsSizeNumberLexemeGeneratorTestcallsLexicalGrammarTestcallsMySqlProviderTestcallsGenerationContextTestcallsDefinitionFactoryTestcallsLexicalGrammarTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsGenerationContextTestcallsDefinitionFactoryTestcallsLexicalGrammarTestcallsSqliteProviderTestcalls
Relations§
Instantiated in 5
- new SqlFaker\Generation\Candidate\IntegerLexemeGenerator::generate() packages/sql-faker/src/Generation/Candidate/IntegerLexemeGenerator.php:44
- new SqlFaker\Generation\Candidate\IntegerLexemeGenerator::accepts() packages/sql-faker/src/Generation/Candidate/IntegerLexemeGenerator.php:62
- new SqlFaker\MySql\Generation\Lexeme\BoundedIntegerLexemeGenerator::generate() packages/sql-faker/src/MySql/Generation/Lexeme/BoundedIntegerLexemeGenerator.php:49
- new SqlFaker\MySql\Generation\Lexeme\SizeNumberLexemeGenerator::generate() packages/sql-faker/src/MySql/Generation/Lexeme/SizeNumberLexemeGenerator.php:32
- new SqlFaker\Sqlite\Generation\Lexeme\DefinitionFactory::create() packages/sql-faker/src/Sqlite/Generation/Lexeme/DefinitionFactory.php:330