classOperatorSignature
final class OperatorSignature
implements ObjectReference
uses Snapshot
Public API: explicitly declared with
@visibility public.An operator named with its operand types, as operator_with_argtypes writes it.
Mirrors PostgreSQL's ObjectWithArgs for operators. The operator name may be schema-qualified without the OPERATOR(...) syntax. Source: https://www.postgresql.org/docs/17/sql-dropoperator.html.
$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('int4')])));
$signature = new \SqlSemantics\Platform\PostgreSql\Statement\Routine\Signature\OperatorSignature(new \SqlSemantics\Platform\PostgreSql\Statement\Name\OperatorName(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('-')), \SqlSemantics\Platform\PostgreSql\Statement\Routine\Signature\OperatorArity::Prefix, [$type]);
[$signature->left(), $signature->right() === $type] // => [null, true]Properties§
public non-empty-list<TypeName> $typespublic OperatorName $operatorpublic OperatorArity $arityMethods§
public function __construct(
public OperatorName $operator,
public OperatorArity $arity,
list<TypeName> $types,
)Parameters
$operator | OperatorName | The operator, written without the OPERATOR(...) syntax |
$arity | OperatorArity | How the operand types are written |
$types | list<TypeName> | The written operand types, as many as the arity writes |
Calls 5
- static-call Check::input() line 47
- static-call Check::listOf() line 48
- class-const TypeName::class() line 48
- function-call
countline 49 - method-call OperatorArity::types() line 49
public function left(): ?TypeNameAnswers the left operand type, or null when there is none.
Returns
Test cases 1
Calls 4
- class-const OperatorArity::Binary() line 58
- class-const OperatorArity::Postfix() line 58
- class-const OperatorArity::Prefix() line 59
- class-const OperatorArity::Incomplete() line 59
public function right(): ?TypeNameAnswers the right operand type, or null when there is none.
Returns
Test cases 1
Calls 4
- class-const OperatorArity::Binary() line 69
- class-const OperatorArity::Prefix() line 70
- class-const OperatorArity::Postfix() line 71
- class-const OperatorArity::Incomplete() line 71
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the operand types; a single type without NONE is reported as the server's parser does.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Called from 1
Calls 4
- class-const OperatorArity::Incomplete() line 83
- method-call Derivation::report() line 84
- new RoutineProblem line 84
- class-const RoutineProblemKind::MissingOperatorArgument() line 84
public function render(Output $out): voidWrites the operator and its operand types.
Parameters
$out | Output |
Test cases 1
Calls 8
- method-call Output::node() line 93
- class-const OperatorArity::Binary() line 95
- method-call Output::list() line 95
- class-const OperatorArity::Prefix() line 96
- method-call Output::keyword() line 96
- class-const OperatorArity::Postfix() line 97
- class-const OperatorArity::Incomplete() line 98
- method-call Output::symbol() line 100
Test cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
OperatorSignatureTest::testDeriveClauseReportsASingleTypecallsOperatorSignatureTest::testLeftAnswersTheLeftOperandcallsOperatorSignatureTest::testRejectsAWrongTypeCountcallsOperatorSignatureTest::testRejectsTheExplicitSyntaxcallsOperatorSignatureTest::testRenderWritesNoneForAMissingOperandcallsOperatorSignatureTest::testRightAnswersTheRightOperandcalls
Other tests reaching this symbol 4
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\SignatureRule::operator() packages/sql-semantics-postgres/src/Lowering/Routine/SignatureRule.php:239
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\SignatureRule::operator() packages/sql-semantics-postgres/src/Lowering/Routine/SignatureRule.php:240
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\SignatureRule::operator() packages/sql-semantics-postgres/src/Lowering/Routine/SignatureRule.php:241
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\SignatureRule::operator() packages/sql-semantics-postgres/src/Lowering/Routine/SignatureRule.php:242
Method calls 1
Type checks 2
Type declarations 4
- type SqlSemantics\Platform\PostgreSql\Lowering\Routine\Routines packages/sql-semantics-postgres/src/Lowering/Routine/Routines.php:100
- type SqlSemantics\Platform\PostgreSql\Lowering\Routine\SignatureRule packages/sql-semantics-postgres/src/Lowering/Routine/SignatureRule.php:228
- type SqlSemantics\Platform\PostgreSql\Statement\Operator\AlterOperator packages/sql-semantics-postgres/src/Statement/Operator/AlterOperator.php:47
- type SqlSemantics\Platform\PostgreSql\Statement\Operator\OperatorMember packages/sql-semantics-postgres/src/Statement/Operator/OperatorMember.php:37