final class CaseBranch
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

One WHEN condition THEN result branch of a CASE expression.

Mirrors PostgreSQL's CaseWhen node. With a CASE operand the condition is a value compared with the operand. Source: https://www.postgresql.org/docs/17/functions-conditional.html#FUNCTIONS-CASE.

Reading a branchdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT CASE WHEN true THEN 1 END');
    $query->field(0)->expression->branches[0]->result->value->digits // => '1'

Properties§

public Scalar $condition
public Scalar $result

Methods§

public function __construct(public Scalar $condition, public Scalar $result)

Parameters

$conditionScalarThe condition, or the value compared with the CASE operand
$resultScalarThe result when the branch is taken
public function render(Output $out): void

Writes WHEN, the condition, THEN and the result.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 6§

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

Dedicated tests 1
Other tests reaching this symbol 5

Relations§

Instantiated in 1
Constant reads 1