classGenerationException
final class GenerationException
extends RuntimeException
@visibility public.Reports that a grammar could not derive a statement.
A rule with no alternatives, an alternative no lexer can realize, a reference to a rule the grammar does not define, or a derivation that runs past its depth limit are all properties of the grammar being generated from, not of the generator. Callers that generate from grammars they did not author are expected to handle this.
The three dialect generators hit the same failures, so the wording lives here rather than being repeated at each throw site.
$failure = new \SqlFaker\Generation\Exception\GenerationException('SQL generation failed');
$failure instanceof \RuntimeException // => true
$failure->getMessage() // => 'SQL generation failed'Methods§
public static function derivationLimitExceeded(): selfReports a derivation that ran past the plan's depth budget.
Returns
self Exception describing the exhausted budgetTest cases 1
GenerationExceptionTest::testDerivationLimitExceededReportsTheBudgetcovers and calls
Called from 5
- static-call SqlFaker\Generation\Derivation\Derivation::of() packages/sql-faker/src/Generation/Derivation/Derivation.php:80
- static-call SqlFaker\Generation\Derivation\Derivation::affordable() packages/sql-faker/src/Generation/Derivation/Derivation.php:143
- static-call SqlFaker\Generation\Derivation\Derivation::affordable() packages/sql-faker/src/Generation/Derivation/Derivation.php:151
- static-call SqlFaker\Generation\Derivation\Derivation::completable() packages/sql-faker/src/Generation/Derivation/Derivation.php:252
- static-call SqlFaker\Generation\Derivation\Derivation::affordableCompletion() packages/sql-faker/src/Generation/Derivation/Derivation.php:270
Calls 1
- new
selfline 37
public static function unknownRule(string $rule): selfReports a reference to a rule the grammar does not define.
Parameters
$rule | string | Name the production referred to |
Returns
self Exception naming the missing ruleTest cases 1
GenerationExceptionTest::testUnknownRuleNamesTheMissingRulecovers and calls
Called from 1
Calls 1
- new
selfline 50
public static function ruleHasNoAlternatives(string $rule): selfReports a rule that declares no alternatives to choose from.
Parameters
$rule | string | Name of the empty rule |
Returns
self Exception naming the empty ruleTest cases 1
GenerationExceptionTest::testRuleHasNoAlternativesNamesTheEmptyRulecovers and calls
Called from 1
Calls 1
- new
selfline 63
public static function noRealizableAlternative(string $rule): selfReports a rule whose alternatives cannot all be turned into tokens.
Parameters
$rule | string | Name of the unrealizable rule |
Returns
self Exception naming the unrealizable ruleTest cases 1
GenerationExceptionTest::testNoRealizableAlternativeNamesTheRulecovers and calls
Called from 1
Calls 1
- new
selfline 76
public static function noAlternativeMatchingPlan(string $rule): selfReports a rule with no alternative the generation plan admits.
Parameters
$rule | string | Name of the constrained rule |
Returns
self Exception naming the constrained ruleTest cases 1
GenerationExceptionTest::testNoAlternativeMatchingPlanNamesTheRulecovers and calls
Called from 1
Calls 1
- new
selfline 89
public static function startRuleCannotProduceOutput(string $rule): selfReports a start rule that cannot satisfy the plan's non-empty requirement.
Parameters
$rule | string | Name of the start rule |
Returns
self Exception naming the start ruleTest cases 1
Calls 1
- new
selfline 102
public static function planRequiresNonEmptyOutput(string $dialect): selfReports a plan that demanded output the grammar only produced as empty.
Parameters
$dialect | string | Dialect the generator was producing for |
Returns
self Exception naming the dialectTest cases 1
Called from 1
Calls 1
- new
selfline 117
public static function lexicalRealizationFailed(string $dialect): selfReports that every derivation attempt failed to reach concrete SQL.
Parameters
$dialect | string | Dialect the generator was producing for |
Returns
self Exception naming the dialectTest cases 1
GenerationExceptionTest::testLexicalRealizationFailedNamesTheDialectcovers and calls
Calls 1
- new
selfline 130
Test cases 28§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
GenerationExceptionTest::testDerivationLimitExceededReportsTheBudgetcovers and callsGenerationExceptionTest::testLexicalRealizationFailedNamesTheDialectcovers and callsGenerationExceptionTest::testNoAlternativeMatchingPlanNamesTheRulecovers and callsGenerationExceptionTest::testNoRealizableAlternativeNamesTheRulecovers and callsGenerationExceptionTest::testPlanRequiresNonEmptyOutputNamesTheDialectcovers and callsGenerationExceptionTest::testRuleHasNoAlternativesNamesTheEmptyRulecovers and callsGenerationExceptionTest::testStartRuleCannotProduceOutputNamesTheStartRulecovers and callsGenerationExceptionTest::testUnknownRuleNamesTheMissingRulecovers and calls
Other tests reaching this symbol 20
PlanBuilderTest::testBuildReportsAnUnknownRequestedRulecallsDerivationTest::testAffordableRejectsAnAlternativeThatCannotFitAfterTheRemaindercallsDerivationTest::testAffordableRejectsARemainderThatExceedsTheWholeBudgetcallsDerivationTest::testOfReportsAPlanNoAlternativeCanSatisfycallsDerivationTest::testOfReportsASymbolTheGrammarDeclaresNoRuleForcallsDerivationTest::testOfStillRejectsAnEntirelyForcedPlanWhoseDescendantCannotSatisfyNonEmptycallsDerivationTraceTestcallsTokenGeneratorTestcallsLexemeSequenceTestcallsCandidateResolverTestcallsSqlGeneratorTest::testGenerateClosesCoverageAfterARejectedEmptyLexicalResultcallsSqlGeneratorTest::testGenerateRejectsUnexpectedEmptyOutputWithoutRetryingcallsTerminalSequenceTestcallsGenerationContextTest::testReportsAnUnknownNonterminalWithoutTreatingItAsSqlTextcallsMySqlProviderTestcallsGenerationContextTest::testReportsAnUnknownNonterminalWithoutTreatingItAsSqlTextcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsGenerationContextTest::testReportsAnUnknownNonterminalWithoutTreatingItAsSqlTextcallsSqliteProviderTestcalls
Relations§
Static calls 10
- static-call SqlFaker\Generation\Derivation\Derivation::of() packages/sql-faker/src/Generation/Derivation/Derivation.php:80
- static-call SqlFaker\Generation\Derivation\Derivation::affordable() packages/sql-faker/src/Generation/Derivation/Derivation.php:143
- static-call SqlFaker\Generation\Derivation\Derivation::affordable() packages/sql-faker/src/Generation/Derivation/Derivation.php:151
- static-call SqlFaker\Generation\Derivation\Derivation::alternatives() packages/sql-faker/src/Generation/Derivation/Derivation.php:207
- static-call SqlFaker\Generation\Derivation\Derivation::alternatives() packages/sql-faker/src/Generation/Derivation/Derivation.php:209
- static-call SqlFaker\Generation\Derivation\Derivation::alternatives() packages/sql-faker/src/Generation/Derivation/Derivation.php:213
- static-call SqlFaker\Generation\Derivation\Derivation::alternatives() packages/sql-faker/src/Generation/Derivation/Derivation.php:226
- static-call SqlFaker\Generation\Derivation\Derivation::completable() packages/sql-faker/src/Generation/Derivation/Derivation.php:252
- static-call SqlFaker\Generation\Derivation\Derivation::affordableCompletion() packages/sql-faker/src/Generation/Derivation/Derivation.php:270
- static-call SqlFaker\Generation\SqlGenerator::generate() packages/sql-faker/src/Generation/SqlGenerator.php:89