final class SourcePosition
Public API: explicitly declared with @visibility public.

A line and column in SQL text, both counted from one.

Locating an offsetdoctest
$position = \SqlParser\Lexer\SourcePosition::at("SELECT 1\nFROM t", 12);
    [$position->line, $position->column] // => [2, 4]

Properties§

public int $line
public int $column

Methods§

public function __construct(public int $line, public int $column)

Parameters

$lineintLine number counted from one
$columnintByte column counted from one
public static function at(string $source, int $offset): self

Locates a byte offset in a text.

Parameters

$sourcestringThe text
$offsetintByte offset, clamped to the text's length

Returns

self The position
Test cases 2
Called from 4
Calls 7

Test cases 27§

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

Dedicated tests 2
Other tests reaching this symbol 25

Relations§

Static calls 4
Type declarations 1