Total Complexity | 6 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait Attributable |
||
6 | { |
||
7 | private array $attributes; |
||
8 | |||
9 | public function __get(string $key): mixed |
||
10 | { |
||
11 | return $this->attributes[$key] ?? null; |
||
12 | } |
||
13 | |||
14 | public function __set(string $key, mixed $value): void |
||
15 | { |
||
16 | $this->attributes[$key] = $value; |
||
17 | } |
||
18 | |||
19 | public function fill(array $attributes): void |
||
22 | } |
||
23 | |||
24 | public function toArray(array $keys = []): array |
||
31 | } |
||
32 | |||
33 | public function __toString(): string |
||
36 | } |
||
37 | } |
||
38 |
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.