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

The indirection step [ lower : upper ]: a slice of an array; an omitted bound is the array's own bound.

Mirrors an A_Indices item with is_slice true. Source: https://www.postgresql.org/docs/17/arrays.html#ARRAYS-ACCESSING.

Reading a slice without a lower bounddoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT $1[:2]');
    [$query->field(0)->expression->steps[0]->lower, $query->toString()] // => [null, 'SELECT $1 [: 2]']

Properties§

public Scalar|null $lower
public Scalar|null $upper

Methods§

public function __construct(public Scalar|null $lower, public Scalar|null $upper)

Parameters

$lowerScalar|nullThe lower bound, or null when omitted
$upperScalar|nullThe upper bound, or null when omitted
public function field(): ?Name

Answers null: a slice selects no field.

Returns

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

Derives the written bounds.

Parameters

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

Writes the bounds around a colon in brackets.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 5§

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 2

Relations§

Instantiated in 1
Type checks 2