classParameter
final class Parameter
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One parameter of a stored procedure or function: its optional direction, its name and its type.
Only a procedure parameter has a direction; a parameter without one is an IN parameter. Source: https://dev.mysql.com/doc/refman/8.4/en/create-procedure.html.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE PROCEDURE p(INOUT total DECIMAL(10, 2)) BEGIN END');
$parameter = $create->statement->parameters->parameters[0];
[$parameter->mode, $parameter->name->value, $parameter->type->name()] // => [\SqlSemantics\Platform\MySql\Statement\Routine\ParameterMode::InOut, 'total', 'DECIMAL']Properties§
public Name $namepublic TypeName $typepublic CollationName|null $collation = nullpublic ParameterMode|null $mode = nullMethods§
public function __construct(
public Name $name,
public TypeName $type,
public CollationName|null $collation = null,
public ParameterMode|null $mode = null,
)Parameters
$name | Name | The parameter name |
$type | TypeName | The declared type |
$collation | CollationName|null | The COLLATE clause of the type |
$mode | ParameterMode|null | The direction keyword, when written |
public function render(Output $out): voidWrites the direction, the name and the type.
Parameters
$out | Output |
Test cases 1
Calls 5
- method-call Output::keyword() line 49
- method-call Output::name() line 51
- class-const NameUse::Identifier() line 51
- method-call ProgramNames::type() line 52
- new ProgramNames line 52
Test cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 10
ParameterRuleTest::testParameterReadsTheModeNameAndTypecallsParameterRuleTest::testParametersLowersAFunctionListcallsParameterRuleTest::testParametersLowersAProcedureListInOrdercallsSequenceTest::testItemsAnswersTheMembersInSourceOrdercallsAlterEventTest::testABodyOfAnotherClassIsRejectedcallsCreateFunctionTest::testAParameterWithADirectionIsRejectedcallsCreateProcedureTest::testABodyOfAnotherClassIsRejectedcallsCreateTriggerTest::testABodyOfAnotherClassIsRejectedcallsParameterListTest::testDeriveRelationAnswersOneNullablePositionPerParametercallsParameterListTest::testRenderWritesAConstructedListcalls