final class Subscript
    implements IndirectionStep
    uses Snapshot
Public API: explicitly declared with @visibility public.

The indirection step [ index ]: one element of an array, or of another subscriptable value.

Mirrors an A_Indices item with is_slice false. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-EXPRESSIONS-SUBSCRIPTS.

Reading a subscriptdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT $1[2]');
    $query->field(0)->expression->steps[0]->index->value->digits // => '2'

Properties§

public Scalar $index

Methods§

public function __construct(public Scalar $index)

Parameters

$indexScalarThe subscript
public function field(): ?Name

Answers null: a subscript selects no field.

Returns

Test cases 1
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the subscript.

Parameters

$derivationDerivation
$environmentEnvironment
Test cases 1
Calls 1
public function render(Output $out): void

Writes the subscript in brackets.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 9§

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

Dedicated tests 3
Other tests reaching this symbol 6

Relations§

Instantiated in 1
Type checks 1