classMembershipOption
final class MembershipOption
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One option of a role membership grant: ADMIN, INHERIT or SET with OPTION, TRUE or FALSE.
Mirrors the DefElem of grant_role_opt. The grammar accepts any label as the option name and the server recognizes admin, inherit and set; another name is reported by the statement. Source: https://www.postgresql.org/docs/17/sql-grant.html.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('GRANT staff TO joe WITH INHERIT FALSE');
[$operation->statement->options[0]->name->value, $operation->statement->options[0]->recognized(), $operation->statement->options[0]->setting->enabled()] // => ['inherit', true, false]Constants§
public const RECOGNIZED = ['admin', 'inherit', 'set']The option names the server recognizes.
Properties§
public Name $namepublic MembershipSetting $settingMethods§
public function __construct(public Name $name, public MembershipSetting $setting)Parameters
$name | Name | The option name as decoded |
$setting | MembershipSetting | The value |
public function recognized(): boolTells whether the server recognizes the option name.
Returns
boolTest cases 1
Calls 2
- function-call
in_arrayline 48 - class-const MembershipOption::RECOGNIZED() line 48
public function render(Output $out): voidWrites the name and the value.
Parameters
$out | Output |
Calls 2
- method-call Output::name() line 56
- class-const NameUse::Label() line 56
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Relations§
Instantiated in 1
Constant reads 2
- class-const SqlSemantics\Platform\PostgreSql\Statement\Catalog\Access\Privilege\GrantRole::__construct() packages/sql-semantics-postgres/src/Statement/Catalog/Access/Privilege/GrantRole.php:62
- class-const SqlSemantics\Platform\PostgreSql\Statement\Catalog\Access\Privilege\RevokeRole::deriveStatement() packages/sql-semantics-postgres/src/Statement/Catalog/Access/Privilege/RevokeRole.php:68