final class ChoiceArgument
    implements AttributeArgument
    uses Snapshot
Public API: explicitly declared with @visibility public.

An attribute value read as one of a fixed set of words, such as the parallel mode of an aggregate.

The command reads the value as text and compares it with the words of the set; the member is the word the text names. Source: https://www.postgresql.org/docs/17/sql-createaggregate.html, https://www.postgresql.org/docs/17/sql-createtype.html.

Reading the parallel mode of an aggregatedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE AGGREGATE total (int4) (sfunc = int4pl, stype = int4, parallel = SAFE)');
    $operation->statement->definition[2]->value->choice // => \SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\Parallelism::Safe
Rejecting a member the text does not namedoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\ChoiceArgument(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\StringConstant('safe'), \SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\Parallelism::Unsafe) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public Choice $choice

Methods§

public function __construct(
    public TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant $written,
    public Choice $choice,
)

Parameters

$writtenTypeName|KeywordWord|OperatorName|SignedNumber|StringConstantThe value as written
$choiceChoiceThe member the text names
Calls 3
public function fits(Reading $reading): bool

Tells whether the reading compares the text with the set of this member.

Parameters

$readingReading

Returns

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

Derives the modifier expressions of a value written as a type name.

Parameters

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

Writes the value as written.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 8§

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

Dedicated tests 4
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Type checks 2
Type declarations 1