classSqlVersionRegistry
final class SqlVersionRegistry
Resolves supported releases and their generated grammar AST paths. Lexical definitions for these same releases are reviewed PHP declarations.
Methods§
public function resolve(string $dialect, string|null $version = null): SqlVersionAnswers the artifacts generated for one release, defaulting to the newest the dialect ships.
Parameters
$dialect | string | Dialect the caller generates SQL for |
$version | string|null | Release to resolve, or null for the dialect default |
Returns
SqlVersion Artifacts committed for that releaseThrows
RuntimeException When the dialect or the release is not one this package shipsTest cases 4
SqlVersionRegistryTest::testAllEnumeratesEveryReleaseOfEveryDialectcoversSqlVersionRegistryTest::testResolveAnswersTheDefaultReleaseOfADialectcovers and callsSqlVersionRegistryTest::testResolveRejectsADialectThePackageDoesNotShipcovers and callsSqlVersionRegistryTest::testResolveRejectsAReleaseThePackageDoesNotShipcovers and calls
Called from 2
Calls 4
- method-call SqlVersionRegistry::entries() line 28
- new
RuntimeExceptionline 31 - new SqlVersion line 39
- method-call SqlVersionRegistry::path() line 42
public function names(string $dialect): list<string>Answers every release one dialect ships, oldest first.
Parameters
$dialect | string | Dialect to enumerate |
Returns
list<string> Release names in the order they were registeredThrows
RuntimeException When the dialect is not one this package shipsTest cases 3
Called from 2
Calls 3
- method-call SqlVersionRegistry::entries() line 57
- new
RuntimeExceptionline 59 - function-call
array_keysline 62
public function all(): list<SqlVersion>Answers every release of every dialect, so a caller can act on all of them.
Returns
list<SqlVersion> Artifacts committed for each registered releaseThrows
RuntimeException When the record names a release it does not describeTest cases 1
SqlVersionRegistryTest::testAllEnumeratesEveryReleaseOfEveryDialectcovers and calls
Called from 1
Calls 4
- function-call
array_keysline 75 - method-call SqlVersionRegistry::entries() line 75
- method-call SqlVersionRegistry::names() line 76
- method-call SqlVersionRegistry::resolve() line 77
public function entries(): array<string, array{default: string, versions: array<string, array{ast: string}>}>Reads the record of which releases were generated.
Returns
array<string, array{default: string, versions: array<string, array{ast: string}>}> Releases by dialectTest cases 7
SqlVersionRegistryTest::testAllEnumeratesEveryReleaseOfEveryDialectcoversSqlVersionRegistryTest::testEntriesReadsTheRecordOfGeneratedReleasescovers and callsSqlVersionRegistryTest::testNamesEnumeratesTheReleasesOfOneDialectcoversSqlVersionRegistryTest::testNamesRejectsADialectThePackageDoesNotShipcoversSqlVersionRegistryTest::testResolveAnswersTheDefaultReleaseOfADialectcoversSqlVersionRegistryTest::testResolveRejectsADialectThePackageDoesNotShipcoversSqlVersionRegistryTest::testResolveRejectsAReleaseThePackageDoesNotShipcovers
Called from 3
- method-call SqlFaker\Grammar\Resource\SqlVersionRegistry::resolve() packages/sql-faker/src/Grammar/Resource/SqlVersionRegistry.php:28
- method-call SqlFaker\Grammar\Resource\SqlVersionRegistry::names() packages/sql-faker/src/Grammar/Resource/SqlVersionRegistry.php:57
- method-call SqlFaker\Grammar\Resource\SqlVersionRegistry::all() packages/sql-faker/src/Grammar/Resource/SqlVersionRegistry.php:75
Calls 1
- method-call SqlVersionRegistry::directory() line 94
public function path(string $relativePath): stringResolves an artifact path recorded in the registry against the resource directory.
The record is data the package reads at runtime, so a path that escapes the resource directory would let it load a file the package never generated. Only relative paths that stay inside are accepted.
Parameters
$relativePath | string | Path as the registry records it |
Returns
string Absolute path of the artifactThrows
RuntimeException When the path is absolute, empty, or climbs out of the resource directoryTest cases 4
SqlVersionRegistryTest::testAllEnumeratesEveryReleaseOfEveryDialectcoversSqlVersionRegistryTest::testPathRejectsAPathThatClimbsOutOfTheResourceDirectorycovers and callsSqlVersionRegistryTest::testPathResolvesARecordedPathAgainstTheResourceDirectorycovers and callsSqlVersionRegistryTest::testResolveAnswersTheDefaultReleaseOfADialectcovers
Called from 1
Calls 4
- function-call
str_starts_withline 114 - function-call
str_containsline 114 - new
RuntimeExceptionline 115 - method-call SqlVersionRegistry::directory() line 118
public function directory(): stringAnswers the directory generated artifacts are committed under.
Returns
string Absolute path of the resource directoryTest cases 9
SqlVersionRegistryTest::testAllEnumeratesEveryReleaseOfEveryDialectcoversSqlVersionRegistryTest::testDirectoryAnswersWhereGeneratedArtifactsAreCommittedcovers and callsSqlVersionRegistryTest::testEntriesReadsTheRecordOfGeneratedReleasescoversSqlVersionRegistryTest::testNamesEnumeratesTheReleasesOfOneDialectcoversSqlVersionRegistryTest::testNamesRejectsADialectThePackageDoesNotShipcoversSqlVersionRegistryTest::testPathResolvesARecordedPathAgainstTheResourceDirectorycovers and callsSqlVersionRegistryTest::testResolveAnswersTheDefaultReleaseOfADialectcoversSqlVersionRegistryTest::testResolveRejectsADialectThePackageDoesNotShipcoversSqlVersionRegistryTest::testResolveRejectsAReleaseThePackageDoesNotShipcovers
Called from 2
Calls 1
- function-call
dirnameline 128
Test cases 30§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
SqlVersionRegistryTest::testAllEnumeratesEveryReleaseOfEveryDialectcovers and callsSqlVersionRegistryTest::testDirectoryAnswersWhereGeneratedArtifactsAreCommittedcovers and callsSqlVersionRegistryTest::testEntriesReadsTheRecordOfGeneratedReleasescovers and callsSqlVersionRegistryTest::testNamesEnumeratesTheReleasesOfOneDialectcovers and callsSqlVersionRegistryTest::testNamesRejectsADialectThePackageDoesNotShipcovers and callsSqlVersionRegistryTest::testPathRejectsAPathThatClimbsOutOfTheResourceDirectorycovers and callsSqlVersionRegistryTest::testPathResolvesARecordedPathAgainstTheResourceDirectorycovers and callsSqlVersionRegistryTest::testResolveAnswersTheDefaultReleaseOfADialectcovers and callsSqlVersionRegistryTest::testResolveRejectsADialectThePackageDoesNotShipcovers and callsSqlVersionRegistryTest::testResolveRejectsAReleaseThePackageDoesNotShipcovers and calls
Other tests reaching this symbol 20
LexicalExceptionTestcallsSqlVersionTestcallsGenerationContextTestcallsCharsetValueLexemeGeneratorTestcallsDefinitionFactoryTestcallsLexicalGrammarTestcallsStartRuleResolverTestcallsMySqlGrammarTestcallsMySqlProviderTestcallsGenerationContextTestcallsDefinitionFactoryTestcallsLexicalGrammarTestcallsPgGrammarTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsGenerationContextTestcallsDefinitionFactoryTestcallsLexicalGrammarTestcallsSqliteGrammarTestcallsSqliteProviderTestcalls
Relations§
Instantiated in 3
- new SqlFaker\Grammar\Resource\SqlVersion::resolve() packages/sql-faker/src/Grammar/Resource/SqlVersion.php:39
- new SqlFaker\Grammar\Resource\SqlVersion::names() packages/sql-faker/src/Grammar/Resource/SqlVersion.php:53
- new SqlFaker\Grammar\Resource\SqlVersion::all() packages/sql-faker/src/Grammar/Resource/SqlVersion.php:65
Method calls 3
- method-call SqlFaker\Grammar\Resource\SqlVersion::resolve() packages/sql-faker/src/Grammar/Resource/SqlVersion.php:39
- method-call SqlFaker\Grammar\Resource\SqlVersion::names() packages/sql-faker/src/Grammar/Resource/SqlVersion.php:53
- method-call SqlFaker\Grammar\Resource\SqlVersion::all() packages/sql-faker/src/Grammar/Resource/SqlVersion.php:65