Conditions | 3 |
Paths | 2 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
14 | public function __construct(string $validatorClassName) |
||
15 | { |
||
16 | $interfaces = class_implements($validatorClassName); |
||
17 | if ($interfaces && !in_array(CustomValidator::class, $interfaces, true)) { |
||
|
|||
18 | throw new RuntimeException("Custom validator must implement 'CustomValidator'"); |
||
19 | } |
||
20 | |||
21 | $this->validatorClassName = $validatorClassName; |
||
22 | } |
||
29 |
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.