Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Roles
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Schema;
6
7use Attribute;
8
9/**
10 * The roles a user type can be given. Without the attribute every role the
11 * app defines is assignable; `#[Roles]` without arguments allows none.
12 */
13#[Attribute(Attribute::TARGET_CLASS)]
14final readonly class Roles
15{
16    /** @var list<string> */
17    public array $roles;
18
19    public function __construct(string ...$roles)
20    {
21        $this->roles = array_values($roles);
22    }
23}