final class NamedArgument
    implements Argument
    uses Snapshot
Public API: explicitly declared with @visibility public.

An argument passed by parameter name: name => value or name := value.

Mirrors PostgreSQL's NamedArgExpr node; which parameter the name designates is decided by the routine's declaration. Source: https://www.postgresql.org/docs/17/sql-syntax-calling-funcs.html#SQL-SYNTAX-CALLING-FUNCS-NAMED.

Reading a named argumentdoctest
$argument = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\NamedArgument(
        new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('days'),
        new \SqlSemantics\Platform\PostgreSql\Statement\Literal\Constant(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\IntegerConstant('2')),
    );
    [$argument->name()->value, $argument->spelling->value] // => ['days', '=>']

Properties§

public Name $parameter
public Scalar $value
public ArgumentSpelling $spelling = ArgumentSpelling::Arrow

Methods§

public function __construct(
    public Name $parameter,
    public Scalar $value,
    public ArgumentSpelling $spelling = ArgumentSpelling::Arrow,
)

Parameters

$parameterNameThe parameter name
$valueScalarThe value passed
$spellingArgumentSpellingHow the name joins the value
Calls 1
public function value(): Scalar

Answers the value passed.

Returns

Test cases 1
public function name(): Name

Answers the parameter name.

Returns

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

Derives the value.

Parameters

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

Writes the name, the joining symbol and the value.

Parameters

$outOutput
Test cases 2
Calls 2

Test cases 9§

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

Dedicated tests 5
Other tests reaching this symbol 4

Relations§

Instantiated in 2
Type checks 2