classObjectRule
final class ObjectRule
Lowers object kinds and the object names of the generic object commands.
Rule: PG-OBJECT-LOWER-001. Scope: object_type_any_name, object_type_name, drop_type_name, object_type_name_on_any_name, and the object part of CommentStmt, SecLabelStmt, RenameStmt, AlterObjectSchemaStmt, AlterOwnerStmt and AlterObjectDependsStmt. Constructors: ObjectKind cases and the object references of PG-OBJECT-FORM-001. The object part is read from the nonterminal or keyword that starts it, so one reader serves every production of these commands; the commands claim their productions. PROCEDURAL before LANGUAGE is a noise word. Termination: a fixed number of children is read. Source: https://www.postgresql.org/docs/17/sql-comment.html, https://www.postgresql.org/docs/17/sql-drop-owned.html. Status: Implemented.
Methods§
public function kind(Node $kind): ObjectKindLowers object_type_any_name, object_type_name, drop_type_name or object_type_name_on_any_name.
Parameters
$kind | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 2
Called from 8
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:110
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:111
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:112
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::kind() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:80
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::named() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:144
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::named() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:145
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::named() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:146
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\Routines::objectKind() packages/sql-semantics-postgres/src/Lowering/Routine/Routines.php:120
Calls 5
- method-call ObjectRule::kind() line 80
- class-const ObjectKind::Language() line 85
- static-call ObjectKind::from() line 88
- class-const ObjectRule::KINDS() line 88
- static-call ImplementationGap::production() line 88
public function token(Form $form, int $position, string $terminal): boolTells whether the child at a position is the given terminal.
Parameters
$form | Form | |
$position | int | |
$terminal | string |
Returns
boolTest cases 1
Called from 6
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::keyed() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:167
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::operator() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:191
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::operator() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:192
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::altered() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:212
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\ObjectRule::altered() packages/sql-semantics-postgres/src/Lowering/Routine/ObjectRule.php:215
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::member() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:138
public function has(Form $form, string $terminal): boolTells whether the production writes the given terminal anywhere.
Parameters
$form | Form | |
$terminal | string |
Returns
boolTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:122
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::drop() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:68
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:122
public function start(Form $form): intAnswers the position of the object part of an ALTER production: the first nonterminal after ALTER other than PROCEDURAL.
Parameters
$form | Form |
Returns
intThrows
ImplementationGap When the production has no object partTest cases 2
Called from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:120
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::owner() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:135
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::depends() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:150
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:114
Calls 1
- static-call ImplementationGap::production() line 128
public function named(Form $form, int $at): array{ObjectKind, ObjectReference}Lowers the object part of a COMMENT or SECURITY LABEL production that starts at a position.
Parameters
$form | Form | |
$at | int |
Returns
array{ObjectKind, ObjectReference}Throws
ImplementationGap When the object part has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\CommentRule::comment() packages/sql-semantics-postgres/src/Lowering/Routine/CommentRule.php:86
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\CommentRule::label() packages/sql-semantics-postgres/src/Lowering/Routine/CommentRule.php:102
Calls 6
- method-call ObjectRule::kind() line 144
- method-call Form::node() line 144
- new UnqualifiedName line 145
- new MemberName line 146
- static-call ImplementationGap::production() line 147
- method-call ObjectRule::keyed() line 151
public function keyed(Form $form, int $at): array{ObjectKind, ObjectReference}Lowers an object part of COMMENT or SECURITY LABEL that starts with a keyword.
Parameters
$form | Form | |
$at | int |
Returns
array{ObjectKind, ObjectReference}Throws
ImplementationGap When the object part has no ruleTest cases 1
Called from 1
Calls 23
- new SignatureRule line 165
- method-call Form::token() line 166
- method-call ObjectRule::token() line 167
- class-const ObjectKind::Column() line 170
- method-call Form::node() line 170
- class-const ObjectKind::Type() line 171
- new TypeReference line 171
- class-const ObjectKind::Domain() line 172
- class-const ObjectKind::Aggregate() line 173
- method-call SignatureRule::aggregate() line 173
- class-const ObjectRule::ROUTINES() line 174
- method-call SignatureRule::function() line 174
- method-call ObjectRule::operator() line 175
- class-const ObjectKind::DomainConstraint() line 176
- class-const ObjectKind::Constraint() line 176
- new MemberName line 176
- class-const ObjectKind::Transform() line 177
- new TransformFor line 177
- class-const ObjectKind::LargeObject() line 178
- new LargeObjectNumber line 178
- class-const ObjectKind::Cast() line 179
- new CastPair line 179
- static-call ImplementationGap::production() line 180
public function operator(Form $form, int $at): array{ObjectKind, ObjectReference}Lowers an object part that starts with OPERATOR: an operator, an operator class or an operator family.
Parameters
$form | Form | |
$at | int |
Returns
array{ObjectKind, ObjectReference}Test cases 1
Called from 1
Calls 8
- method-call ObjectRule::token() line 191
- class-const ObjectKind::OperatorClass() line 192
- class-const ObjectKind::OperatorFamily() line 192
- new OperatorGroupName line 194
- method-call Form::node() line 194
- class-const ObjectKind::Operator() line 197
- method-call SignatureRule::operator() line 197
- new SignatureRule line 197
public function altered(Form $form, int $at): array{ObjectReference, int}Lowers the object part of an ALTER production that starts at a position, and answers the position after it.
Parameters
$form | Form | |
$at | int |
Returns
array{ObjectReference, int}Throws
ImplementationGap When the object part has no ruleTest cases 1
Called from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:120
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::owner() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:135
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::depends() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:150
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:114
Calls 13
- method-call Form::node() line 209
- new SignatureRule line 211
- method-call ObjectRule::token() line 212
- new OperatorGroupName line 213
- new MemberName line 216
- method-call SignatureRule::function() line 220
- method-call SignatureRule::aggregate() line 221
- method-call SignatureRule::operator() line 222
- new UnqualifiedName line 224
- new RelationTarget line 226
- new RelationReference line 227
- new LargeObjectNumber line 228
- static-call ImplementationGap::production() line 229
Private surface 3§
Implementation details, listed for orientation only.
private const KINDS = ['object_type_any_name: TABLE' => 'TABLE', 'object_type_any_name: SEQUENCE' => …private const ROUTINES = ['FUNCTION' => \SqlSemantics\Platform\PostgreSql\Statement\Name\ObjectKind::Fun…private Lowering $loweringTest cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
ObjectRuleTest::testAlteredLowersARelationAndTheNextPositioncallsObjectRuleTest::testHasTellsWhetherATerminalIsWrittencallsObjectRuleTest::testKeyedLowersACastcallsObjectRuleTest::testKindLowersEachKindNonterminalcallsObjectRuleTest::testKindRejectsAnotherNonterminalcallsObjectRuleTest::testNamedLowersAMemberOfATablecallsObjectRuleTest::testOperatorLowersAnOperatorFamilycallsObjectRuleTest::testStartRejectsAProductionWithoutObjectcallsObjectRuleTest::testStartSkipsProceduralcallsObjectRuleTest::testTokenTellsTheTerminalAtAPositioncalls
Relations§
Instantiated in 10
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:119
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::owner() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:134
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::depends() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:149
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\CommentRule::comment() packages/sql-semantics-postgres/src/Lowering/Routine/CommentRule.php:86
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\CommentRule::label() packages/sql-semantics-postgres/src/Lowering/Routine/CommentRule.php:102
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::drop() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:68
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:106
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:113
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::member() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:130
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\Routines::objectKind() packages/sql-semantics-postgres/src/Lowering/Routine/Routines.php:120
Method calls 18
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:120
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:120
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::schema() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:122
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::owner() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:135
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::owner() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:135
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::depends() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:150
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\AlterObjectRule::depends() packages/sql-semantics-postgres/src/Lowering/Routine/AlterObjectRule.php:150
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\CommentRule::comment() packages/sql-semantics-postgres/src/Lowering/Routine/CommentRule.php:86
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\CommentRule::label() packages/sql-semantics-postgres/src/Lowering/Routine/CommentRule.php:102
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::drop() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:68
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:110
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:111
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DropRule::generic() packages/sql-semantics-postgres/src/Lowering/Routine/DropRule.php:112
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:114
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:114
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::rename() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:122
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\RenameRule::member() packages/sql-semantics-postgres/src/Lowering/Routine/RenameRule.php:138
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\Routines::objectKind() packages/sql-semantics-postgres/src/Lowering/Routine/Routines.php:120