final class InList
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A membership test against a list of values: a [NOT] IN (v1, v2, …).

Mirrors PostgreSQL's A_Expr node of kind AEXPR_IN.

Rule: PG-IN-LIST-001. Facts: the conjunction of a = v over the values (PG-OPERATOR-TYPING-001), NULL when an operand can be. One value in parentheses that is a scalar subquery is read as IN (SELECT …) instead, so a list of one such value cannot be written. The value must keep its place before IN (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-comparisons.html#FUNCTIONS-COMPARISONS-IN-SCALAR. Status: Implemented.

Reading the values of a listdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 IN (1, 2, NULL)');
    [count($query->field(0)->expression->values), $query->field(0)->nullability] // => [3, \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Nullability::Nullable]

Properties§

public non-empty-list<Scalar> $values
public Scalar $operand
public bool $negated

Methods§

public function __construct(public Scalar $operand, public bool $negated, list<Scalar> $values)

Parameters

$operandScalarThe tested value
$negatedboolWhether NOT is written
$valueslist<Scalar>The values in order; at least one
Calls 7
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the value and the list, and the comparisons of the value with each item.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 8
public function render(Output $out): void

Writes the value, [NOT] IN and the list in parentheses.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 4§

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 1

Relations§

Instantiated in 1
Type checks 1