classStartRuleResolver
final class StartRuleResolver
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Resolves MySQL rule names across grammar releases.
Methods§
public function __construct(private Grammar $grammar)Parameters
$grammar | Grammar | Grammar whose rule names are resolved |
Test cases 6
StartRuleResolverTest::testStartSymbolForFallsBackToTheEntryPointOfTheReleaseItWasAskedOfcoversStartRuleResolverTest::testStartSymbolForHandsBackARequestNothingMatchescoversStartRuleResolverTest::testStartSymbolForMapsModernRequestsToLegacyGrammarRulescoversStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExist#0coversStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExist#1coversStartRuleResolverTest::testStartSymbolForTakesARuleThisReleaseDeclaresAsItStandscovers
public function startSymbolFor(string|null $requested): stringAnswers which of this grammar's rules a requested start rule is grown from.
MySQL renamed its top-level rules across releases, so the name a caller asks for may not be the name this release declares. A request the grammar knows is taken as it stands; otherwise the rule that release calls the same thing is used, and a request nothing matches is handed back for the derivation to report.
Parameters
$requested | string|null | Rule the caller asked for, or null for the grammar's own entry point |
Returns
string Rule this grammar declaresTest cases 7
StartRuleResolverTest::testStartSymbolForFallsBackToTheEntryPointOfTheReleaseItWasAskedOfcovers and callsStartRuleResolverTest::testStartSymbolForHandsBackARequestNothingMatchescovers and callsStartRuleResolverTest::testStartSymbolForMapsModernRequestsToLegacyGrammarRulescovers and callsStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExistcallsStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExist#0coversStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExist#1coversStartRuleResolverTest::testStartSymbolForTakesARuleThisReleaseDeclaresAsItStandscovers and calls
Private surface 1§
Implementation details, listed for orientation only.
private Grammar $grammarTest cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
StartRuleResolverTest::testStartSymbolForFallsBackToTheEntryPointOfTheReleaseItWasAskedOfcovers and callsStartRuleResolverTest::testStartSymbolForHandsBackARequestNothingMatchescovers and callsStartRuleResolverTest::testStartSymbolForMapsModernRequestsToLegacyGrammarRulescovers and callsStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExistcallsStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExist#0coversStartRuleResolverTest::testStartSymbolForPreservesGrammarEntryEvenWhenStatementRulesExist#1coversStartRuleResolverTest::testStartSymbolForTakesARuleThisReleaseDeclaresAsItStandscovers and calls
Other tests reaching this symbol 5
GenerationContextTestcallsMySqlProviderTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsSqliteProviderTestcalls