classRoleRule
final class RoleRule
Lowers the role statements and role lists (8.0+).
Rule: MYSQL-ACCOUNT-ROLE-001. Scope: create_role_stmt, drop_role_stmt, set_role_stmt, role_list, opt_except_role_list, opt_with_roles. A role name has the two parts of an account name. Constructs: CreateRole, DropRole, SetRole, SetDefaultRole, RoleSelection. Terminates: the role list is flattened iteratively; every other child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/roles.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers CREATE ROLE, DROP ROLE, SET ROLE and SET DEFAULT ROLE.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 13
- new CreateRole line 51
- method-call Form::node() line 51
- method-call RoleRule::roles() line 51
- new DropRole line 52
- new SetRole line 53
- new RoleSelection line 53
- class-const RoleSet::Named() line 53
- class-const RoleSet::None() line 54
- class-const RoleSet::Default() line 55
- class-const RoleSet::All() line 56
- method-call RoleRule::except() line 56
- new SetDefaultRole line 57
- static-call ImplementationGap::production() line 60
public function roles(Node $list): non-empty-list<AccountName>Lowers a role_list.
Parameters
$list | Node |
Returns
non-empty-list<AccountName>Throws
ImplementationGap When a production has no ruleCalled from 10
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:51
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:52
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:53
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:57
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:58
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:59
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::except() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:99
- method-call SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::withRoles() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:115
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:156
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::defaultRoles() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:232
Calls 5
- method-call Lowering::form() line 72
- static-call ImplementationGap::production() line 74
- method-call Lists::items() line 77
- new Lists line 77
- static-call Check::invariant() line 79
public function except(Node $except): list<AccountName>Lowers an opt_except_role_list; an absent list is empty.
Parameters
$except | Node |
Returns
list<AccountName>Throws
ImplementationGap When the production has no ruleCalled from 2
Calls 3
- method-call Lowering::form() line 95
- method-call RoleRule::roles() line 99
- static-call ImplementationGap::production() line 100
public function withRoles(Node $clause): ?RoleSelectionLowers the opt_with_roles of GRANT … AS; an absent clause is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 9
- method-call Lowering::form() line 111
- new RoleSelection line 115
- class-const RoleSet::Named() line 115
- method-call RoleRule::roles() line 115
- class-const RoleSet::All() line 116
- method-call RoleRule::except() line 116
- class-const RoleSet::None() line 117
- class-const RoleSet::Default() line 118
- static-call ImplementationGap::production() line 119
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
RoleRuleTestcalls
Relations§
Instantiated in 4
- new SqlSemantics\Platform\MySql\Lowering\Account\AccountRules::statement() packages/sql-semantics-mysql/src/Lowering/Account/AccountRules.php:63
- new SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grantAs() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:224
- new SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:156
- new SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::defaultRoles() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:232
Method calls 4
- method-call SqlSemantics\Platform\MySql\Lowering\Account\AccountRules::statement() packages/sql-semantics-mysql/src/Lowering/Account/AccountRules.php:63
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grantAs() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:224
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:156
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::defaultRoles() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:232