classSemantics
final class Semantics
Public API: explicitly declared with
@visibility public.Structures every statement of a selected SQL language into independent values.
This entry point needs no schema or database connection. Use Binder separately when schema-dependent name, type, and nullability facts are needed.
$semantics = new \SqlSemantics\Facade\Semantics(\SqlSemantics\Platform\Sqlite\Dialect::Sqlite);
$semantics->analyze('DROP TABLE example')->toString() // => 'DROP TABLE example'Methods§
public function __construct(Dialect $dialect, ?string $grammarVersion = null)public function analyze(string $sql): StatementBuilds an immutable statement from SQL without keeping its original syntax.
Parameters
$sql | string |
Returns
Throws
AnalysisException When SQL is not in the selected languageTest cases 14
StatementBench::benchRoundTripcallsRoundTripTarget::verifycallsSemanticsTest::testAnalyzeAcceptsTheDialectContractcallsPlatformTest::testAnalyzeFakerRegressionscallsPlatformTest::testAnalyzePreservesKeywordNamesBeforeDotscallsPlatformTest::testAnalyzeRoundTripsCompleteStatementscallsPlatformTest::testAnalyzeWithEveryGrammarReleasecallsStatementTest::testToStringAttachesVariableMarkersToTheirNamescallsStatementTest::testToStringKeepsAnOptimizerHintAfterTheStatementKeywordcallsStatementTest::testToStringKeepsExecutableCommentDelimitersAroundTheSqlTheyEnclosecallsStatementTest::testToStringSeparatesAPrefixOperatorFromANegatedOperandcallsStatementTest::testWithCommandKeepsTheCommentsAroundTheCommandcallsStatementTest::testWithCommandReplacesWhereUsingStructuredValuescallsWriterTest::testRenderWritesTheCommentsOfEveryValuecalls
Calls 1
- method-call Analyzer::analyze() line 41
Private surface 1§
Implementation details, listed for orientation only.
private Analyzer $analyzerTest cases 18§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Other tests reaching this symbol 17
StatementBench::benchRoundTripcallsRoundTripTarget::verifycallsAnalyzerTestcallsValueReaderTestcallsAnalysisExceptionTestcallsPlatformTest::testAnalyzeFakerRegressionscallsPlatformTest::testAnalyzePreservesKeywordNamesBeforeDotscallsPlatformTest::testAnalyzeRoundTripsCompleteStatementscallsPlatformTest::testAnalyzeWithEveryGrammarReleasecallsElementTestcallsStatementTest::testToStringAttachesVariableMarkersToTheirNamescallsStatementTest::testToStringKeepsAnOptimizerHintAfterTheStatementKeywordcallsStatementTest::testToStringKeepsExecutableCommentDelimitersAroundTheSqlTheyEnclosecallsStatementTest::testToStringSeparatesAPrefixOperatorFromANegatedOperandcallsStatementTest::testWithCommandKeepsTheCommentsAroundTheCommandcallsStatementTest::testWithCommandReplacesWhereUsingStructuredValuescallsWriterTest::testRenderWritesTheCommentsOfEveryValuecalls