classNamedArgument
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.
$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 $parameterpublic Scalar $valuepublic ArgumentSpelling $spelling = ArgumentSpelling::ArrowMethods§
public function __construct(
public Name $parameter,
public Scalar $value,
public ArgumentSpelling $spelling = ArgumentSpelling::Arrow,
)Parameters
$parameter | Name | The parameter name |
$value | Scalar | The value passed |
$spelling | ArgumentSpelling | How the name joins the value |
Calls 1
- class-const ArgumentSpelling::Arrow() line 39
public function value(): ScalarAnswers the value passed.
Returns
Test cases 1
public function name(): NameAnswers the parameter name.
Returns
Test cases 1
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the value.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Calls 1
- method-call Derivation::scalar() line 64
public function render(Output $out): voidWrites the name, the joining symbol and the value.
Parameters
$out | Output |
Test cases 2
Calls 2
- method-call Output::name() line 72
- class-const NameUse::Routine() line 72
Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
NamedArgumentTest::testDeriveClauseDerivesTheValuecallsNamedArgumentTest::testNameAnswersTheParameterNamecallsNamedArgumentTest::testRenderWritesTheArrowSpellingcallsNamedArgumentTest::testRenderWritesTheAssignmentSpellingAndQuotesAColumnNameKeywordcallsNamedArgumentTest::testValueAnswersTheValuePassedcalls
Other tests reaching this symbol 4
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::argument() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:195
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::argument() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:196
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Invocation\CallTyping::call() packages/sql-semantics-postgres/src/Rules/Invocation/CallTyping.php:66
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Invocation\Syntax\KeywordCall::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Syntax/KeywordCall.php:76