Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | trait RestrictedResourceTrait |
||
10 | { |
||
11 | /** |
||
12 | * @ORM\Column(type="json_array", nullable=true) |
||
13 | * @var array|null |
||
14 | */ |
||
15 | protected $securityRoles; |
||
16 | |||
17 | public function getSecurityRoles(): ?array |
||
18 | { |
||
19 | return $this->securityRoles; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @param string $securityRole |
||
24 | * @return static |
||
25 | */ |
||
26 | public function addSecurityRole(string $securityRole) |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param array|null $securityRoles |
||
34 | * @return static |
||
35 | */ |
||
36 | public function setSecurityRoles(?array $securityRoles) |
||
47 | } |
||
48 | } |
||
49 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.