final class TableReader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads the tables a statement names.

The names let a catalog be grouped and filtered by table, and are what a fixture generator needs in order to build rows for the statement. A name the analyzer knows only part of — a prefix read from configuration and a suffix written in the source — is still a name to group by, and is reported with the unknown part marked. A name nothing is known of is not guessed at.

Constants§

public const GAP = '{$}'

The marker an unknown part of a name is reported with.

Methods§

public function __construct(?SqlLexer $lexer = null)

Builds a reader over the shared lexer.

Parameters

$lexer?SqlLexer
Calls 1
public function read(TextPattern $pattern): list<string>
public function readName(list<SqlToken> $tokens): ?string

The possibly qualified table name the tokens start with, or null when they name none.

Parameters

$tokenslist<SqlToken>

Returns

?string
Test cases 2
Called from 1
Calls 9
public function isName(SqlToken $token): bool

Whether the token can start a table name.

A gap on its own is not a name, quoted or not; a word with a gap in it is, since the rest of the word is known.

Parameters

$tokenSqlToken

Returns

bool
Test cases 1
Called from 1
Calls 7
public function unquote(SqlToken $token): string

The token with any identifier quoting removed.

Parameters

$tokenSqlToken

Returns

string
Test cases 1
Called from 2
Calls 4

Private surface 4§

Implementation details, listed for orientation only.

private const INTRODUCERS = ['FROM', 'JOIN', 'INTO', 'UPDATE', 'TABLE']
private const SKIPPED = ['IF', 'NOT', 'EXISTS']
private const NEVER_NAMES = ['SELECT', 'ONLY', 'LATERAL', 'WHERE', 'SET', 'VALUES', 'ON', 'STATUS', 'KEY', …
private SqlLexer $lexer

Test cases 15§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 8
Other tests reaching this symbol 7

Relations§

Instantiated in 1
Method calls 1
Type declarations 2