classGrammarCoverageInventory
final class GrammarCoverageInventory
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Enumerates the effective grammar before any per-generation restrictions.
Type Aliases§
Entry = array{rule: string, ordinal: int, origin: string|null, rhs: list<string>, rootReachable: bool}Properties§
public string $fingerprintIdentity of the grammar, adapter and lexical profile.
public string $digestDigest of the full reconstructed production inventory.
public array<string, Entry> $entriespublic list<string> $denominatorpublic list<array{origin: string, status: string}> $adaptationspublic Grammar $grammarpublic string $rootMethods§
public function __construct(
public Grammar $grammar,
public string $root,
string $profile,
?Grammar $original = null,
)Includes inaccessible alternatives and records source grammar changes separately.
Test cases 6
GrammarCoverageInventoryTest::testDifferencesRecordsBothRemovedAndTransformedOriginalProductionscoversGrammarCoverageInventoryTest::testIdKeepsOriginalOrdinalAfterFilteringAndChangesForRewrittenRhscoversGrammarCoverageInventoryTest::testInventoryEntriesRetainOriginalIdentityAndExcludeUnreachableRulesFromTheDenominatorcoversGrammarCoverageInventoryTest::testProductionIdsDistinguishRulesOrdinalsAndGrammarProfilescoversGrammarCoverageInventoryTest::testReachableRulesCanInspectAPlanRootWithoutChangingTheInventorycoversGrammarCoverageInventoryTest::testReachableRulesIncludesRecursionAndEmptyAlternativesButSeparatesUnrelatedRulescovers
Calls 8
- function-call
hashline 50 - function-call
serializeline 50 - method-call GrammarCoverageInventory::reachableRules() line 51
- method-call GrammarCoverageInventory::id() line 55
- static-call GrammarCoverageInventory::rhs() line 57
- function-call
array_keysline 63 - function-call
array_filterline 63 - method-call GrammarCoverageInventory::differences() line 65
public function id(string $rule, Production $production, int $fallbackOrdinal): stringKeeps original ordinals and distinguishes rewritten right-hand sides.
Parameters
$rule | string | |
$production | Production | |
$fallbackOrdinal | int |
Returns
stringTest cases 6
GrammarCoverageInventoryTest::testDifferencesRecordsBothRemovedAndTransformedOriginalProductionscoversGrammarCoverageInventoryTest::testIdKeepsOriginalOrdinalAfterFilteringAndChangesForRewrittenRhscovers and callsGrammarCoverageInventoryTest::testInventoryEntriesRetainOriginalIdentityAndExcludeUnreachableRulesFromTheDenominatorcoversGrammarCoverageInventoryTest::testProductionIdsDistinguishRulesOrdinalsAndGrammarProfilescovers and callsGrammarCoverageInventoryTest::testReachableRulesCanInspectAPlanRootWithoutChangingTheInventorycoversGrammarCoverageInventoryTest::testReachableRulesIncludesRecursionAndEmptyAlternativesButSeparatesUnrelatedRulescovers
Called from 1
Calls 3
- function-call
hashline 74 - function-call
serializeline 74 - static-call GrammarCoverageInventory::rhs() line 74
public static function rhs(Production $production): list<string>Describes symbols with their terminal/non-terminal distinction intact.
Parameters
$production | Production |
Returns
list<string>Test cases 7
GrammarCoverageInventoryTest::testDifferencesRecordsBothRemovedAndTransformedOriginalProductionscoversGrammarCoverageInventoryTest::testIdKeepsOriginalOrdinalAfterFilteringAndChangesForRewrittenRhscoversGrammarCoverageInventoryTest::testInventoryEntriesRetainOriginalIdentityAndExcludeUnreachableRulesFromTheDenominatorcoversGrammarCoverageInventoryTest::testProductionIdsDistinguishRulesOrdinalsAndGrammarProfilescoversGrammarCoverageInventoryTest::testReachableRulesCanInspectAPlanRootWithoutChangingTheInventorycoversGrammarCoverageInventoryTest::testReachableRulesIncludesRecursionAndEmptyAlternativesButSeparatesUnrelatedRulescoversGrammarCoverageInventoryTest::testRhsDistinguishesTheSymbolKindAndIncludesEmptyProductioncovers and calls
Called from 3
- static-call SqlFaker\Generation\Coverage\GrammarCoverageInventory::__construct() packages/sql-faker/src/Generation/Coverage/GrammarCoverageInventory.php:57
- static-call SqlFaker\Generation\Coverage\GrammarCoverageInventory::id() packages/sql-faker/src/Generation/Coverage/GrammarCoverageInventory.php:74
- static-call SqlFaker\Generation\Coverage\GrammarCoverageInventory::differences() packages/sql-faker/src/Generation/Coverage/GrammarCoverageInventory.php:122
Calls 2
- function-call
array_mapline 84 - method-call Symbol::value() line 85
public function reachableRules(?string $root = null): array<string, true>Visits every alternative, including empty and lexically unsupported ones.
Parameters
$root | ?string |
Returns
array<string, true>Test cases 6
GrammarCoverageInventoryTest::testDifferencesRecordsBothRemovedAndTransformedOriginalProductionscoversGrammarCoverageInventoryTest::testIdKeepsOriginalOrdinalAfterFilteringAndChangesForRewrittenRhscoversGrammarCoverageInventoryTest::testInventoryEntriesRetainOriginalIdentityAndExcludeUnreachableRulesFromTheDenominatorcoversGrammarCoverageInventoryTest::testProductionIdsDistinguishRulesOrdinalsAndGrammarProfilescoversGrammarCoverageInventoryTest::testReachableRulesCanInspectAPlanRootWithoutChangingTheInventorycovers and callsGrammarCoverageInventoryTest::testReachableRulesIncludesRecursionAndEmptyAlternativesButSeparatesUnrelatedRulescovers and calls
Called from 1
public function differences(?Grammar $original): list<array{origin: string, status: string}>Lists original alternatives removed or transformed by a fixed adapter.
Parameters
$original | ?Grammar |
Returns
list<array{origin: string, status: string}>Test cases 6
GrammarCoverageInventoryTest::testDifferencesRecordsBothRemovedAndTransformedOriginalProductionscoversGrammarCoverageInventoryTest::testIdKeepsOriginalOrdinalAfterFilteringAndChangesForRewrittenRhscoversGrammarCoverageInventoryTest::testInventoryEntriesRetainOriginalIdentityAndExcludeUnreachableRulesFromTheDenominatorcovers and callsGrammarCoverageInventoryTest::testProductionIdsDistinguishRulesOrdinalsAndGrammarProfilescoversGrammarCoverageInventoryTest::testReachableRulesCanInspectAPlanRootWithoutChangingTheInventorycoversGrammarCoverageInventoryTest::testReachableRulesIncludesRecursionAndEmptyAlternativesButSeparatesUnrelatedRulescovers
Called from 1
Calls 2
- function-call
array_filterline 120 - static-call GrammarCoverageInventory::rhs() line 122
Test cases 39§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
GrammarCoverageInventoryTest::testDifferencesRecordsBothRemovedAndTransformedOriginalProductionscovers and callsGrammarCoverageInventoryTest::testIdKeepsOriginalOrdinalAfterFilteringAndChangesForRewrittenRhscovers and callsGrammarCoverageInventoryTest::testInventoryEntriesRetainOriginalIdentityAndExcludeUnreachableRulesFromTheDenominatorcovers and callsGrammarCoverageInventoryTest::testProductionIdsDistinguishRulesOrdinalsAndGrammarProfilescovers and callsGrammarCoverageInventoryTest::testReachableRulesCanInspectAPlanRootWithoutChangingTheInventorycovers and callsGrammarCoverageInventoryTest::testReachableRulesIncludesRecursionAndEmptyAlternativesButSeparatesUnrelatedRulescovers and callsGrammarCoverageInventoryTest::testRhsDistinguishesTheSymbolKindAndIncludesEmptyProductioncovers and calls
Other tests reaching this symbol 32
ByteChoicesTestcallsCoverageSnapshotStoreTestcallsGrammarCoverageTest::testBeginAttemptRetainsAnEmptyAttemptBeforeAnyProductionIsSelectedcallsGrammarCoverageTest::testBeginGenerationReplacesThePreviousSuccessfulTracecallsGrammarCoverageTest::testCommitAttemptAndEndGenerationCommitOnlySuccessfulPathscallsGrammarCoverageTest::testDiscardAttemptPreservesFailedReachabilitycallsGrammarCoverageTest::testEndGenerationPreservesFailureBeforeAnyAttemptWasOpenedcallsGrammarCoverageTest::testEndGenerationSavesUnsavedDiscoveriesEveryHundredGenerationscallsGrammarCoverageTest::testFailedReachabilityAndLaterEmissionAreSavedAsSeparateDiscoveriescallsGrammarCoverageTest::testFlushRestoresOnlyCumulativeHistoryAndPreservesCurrentObservationscallsGrammarCoverageTest::testHooksWithoutAGenerationKeepTheTraceEmptycallsGrammarCoverageTest::testLastGenerationStartsEmptyWithoutStoragecallsGrammarCoverageTest::testMergeIsIdempotentAndDoesNotCopyHistoricalCounterscallsGrammarCoverageTest::testMergePreservesDisjointHistoryAndDoesNotResaveIdenticalHistorycallsGrammarCoverageTest::testMergeRejectsChangedImplementationRevisionscallsGrammarCoverageTest::testReadingAMemorySnapshotDoesNotSaveUnflushedObservationscallsGrammarCoverageTest::testRecordIncludesOccurrenceParentsAndOriginalPositionscallsGrammarCoverageTest::testRecordOutputExposesCandidateAndBoundaryDecisionscallsGrammarCoverageTest::testRecordSequenceKeepsTransformedSelectionsOutOfPreservedOutputCoveragecallsGrammarCoverageTest::testRegisterLeavesOldHistoryWhenTheImplementationChangescallsGrammarCoverageTest::testResetKeepsFlushedHistoryAndClearsTraceAndCurrentCounterscallsGrammarCoverageTest::testRestoreRejectsCorruptHistoryOnEveryRegistrationAttemptWithoutOverwritingItcallsGrammarCoverageTest::testSnapshotPublishesTheRegisteredInventoryAndCurrentRunIdentitycallsGrammarCoverageTest::testSnapshotSeparatesReachedFromEmittedAndKeepsTheFullDenominatorcallsSnapshotValidationTest::providerMalformedHistoriescallsSnapshotValidationTest::testCompatibleRejectsAnUntrustedInventoryDigestcallsSnapshotValidationTest::testCompatibleRejectsEmittedProductionsThatWereNeverReachedcallsSnapshotValidationTest::testCompatibleRejectsUnknownProductionIdscallsSnapshotValidationTest::testCompatibleRequiresEveryIdentityComponentcallsSnapshotValidationTest::testDecodeRestoresOnlyWellFormedSnapshotDatacallsDerivationNodeTestcallsSqlGeneratorTestcalls
Relations§
Instantiated in 1
Type declarations 4
- type SqlFaker\Generation\Coverage\GrammarCoverage packages/sql-faker/src/Generation/Coverage/GrammarCoverage.php:28
- type SqlFaker\Generation\Coverage\GrammarCoverage packages/sql-faker/src/Generation/Coverage/GrammarCoverage.php:74
- type SqlFaker\Generation\Coverage\GrammarCoverage packages/sql-faker/src/Generation/Coverage/GrammarCoverage.php:123
- type SqlFaker\Generation\Coverage\SnapshotValidation packages/sql-faker/src/Generation/Coverage/SnapshotValidation.php:76