classChoiceArgument
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.
$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::Safenew \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\InvalidConstructionProperties§
public TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant $writtenpublic Choice $choiceMethods§
public function __construct(
public TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant $written,
public Choice $choice,
)Parameters
$written | TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant | The value as written |
$choice | Choice | The member the text names |
Calls 3
- static-call Check::input() line 44
- method-call ArgumentText::text() line 44
- new ArgumentText line 44
public function fits(Reading $reading): boolTells whether the reading compares the text with the set of this member.
Parameters
$reading | Reading |
Returns
boolTest cases 1
Calls 1
- method-call Reading::choices() line 52
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the modifier expressions of a value written as a type name.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
public function render(Output $out): voidWrites the value as written.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::node() line 68
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Relations§
Instantiated in 1
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Routine\AttributeChecks::value() packages/sql-semantics-postgres/src/Rules/Routine/AttributeChecks.php:120
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::collation() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:209