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

The negation of a condition: NOT a.

Mirrors PostgreSQL's BoolExpr node of kind NOT_EXPR.

Rule: PG-NEGATION-001. Facts: boolean; a non-boolean operand is reported; NULL when the operand is NULL. The operand must keep its place without parentheses (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-logical.html. Status: Implemented.

Negating a comparisondoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT NOT 1 = 2')->field(0)->type->descriptor->name() // => 'boolean'

Properties§

public Scalar $operand

Methods§

public function __construct(public Scalar $operand)

Parameters

$operandScalarThe negated condition
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the condition and checks that it is boolean.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes NOT and the condition.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 17§

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 14

Relations§

Instantiated in 1
Type checks 1