final class FunctionParameter
    implements Clause
    uses Snapshot
Public API: explicitly declared with @visibility public.

One parameter of a routine definition or signature: mode, name, type and default value.

Mirrors PostgreSQL's FunctionParameter node. The name may be written before or after the mode; both orders declare the same parameter and the order is kept so that the statement is written back as it was. Only input parameters take part in calls; output parameters form the result row. Source: https://www.postgresql.org/docs/17/sql-createfunction.html.

Reading a named output parameterdoctest
$type = new \SqlSemantics\Platform\PostgreSql\Statement\Type\TypeName(new \SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\NamedDesignation(new \SqlSemantics\Platform\PostgreSql\Statement\Name\DottedName([new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('text')])));
    $parameter = new \SqlSemantics\Platform\PostgreSql\Statement\Routine\FunctionParameter($type, new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('label'), \SqlSemantics\Platform\PostgreSql\Statement\Routine\ParameterMode::Out);
    [$parameter->name?->value, $parameter->input()] // => ['label', false]

Properties§

public TypeName $type
public Name|null $name = null
public ParameterMode|null $mode = null
public bool $nameFirst = false
public Scalar|null $default = null
public DefaultSpelling|null $defaultSpelling = null

Methods§

public function __construct(
    public TypeName $type,
    public Name|null $name = null,
    public ParameterMode|null $mode = null,
    public bool $nameFirst = false,
    public Scalar|null $default = null,
    public DefaultSpelling|null $defaultSpelling = null,
)

Parameters

$typeTypeNameThe parameter type
$nameName|nullThe parameter name, if written
$modeParameterMode|nullThe written mode; null when no mode is written
$nameFirstboolWhether the name is written before the mode
$defaultScalar|nullThe default value, if written
$defaultSpellingDefaultSpelling|nullHow the default value is introduced; given exactly with a default value
Calls 1
public function output(): bool
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the type modifiers and the default value in the given environment.

Parameters

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

Writes the mode and the name in their written order, the type and the default value.

Parameters

$outOutput
Test cases 1
Calls 7

Test cases 15§

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

Dedicated tests 6
Other tests reaching this symbol 9

Relations§

Instantiated in 5
Method calls 3
Constant reads 4
Type declarations 3