packages/sql-semantics-mysql/src/Model/Statement/Fact/Diagnostic.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\MySql\Model\Statement\Fact;
6
7/**
8 * A semantic problem established while analyzing grammatical SQL.
9 *
10 * Analysis errors carry their diagnostics in a SemanticException.
11 *
12 * @visibility public
13 * @example Reading the problems of a statement
14 * $semantics = new \SqlSemantics\Platform\MySql\Semantics();
15 * $table = $semantics->analyze('CREATE TABLE t (a INTEGER)');
16 * $semantics->analyze('SELECT b FROM t', [$table])->facts->diagnostics[0]->message() // => 'Column b does not exist.'
17 */
18interface Diagnostic
19{
20 /**
21 * Describes the problem for a person; the concrete class is the machine-readable kind.
22 */
23 public function message(): string;
24}
25