1 | <?php |
||
11 | class Enum implements Rule |
||
12 | { |
||
13 | protected $rule = 'enum'; |
||
14 | |||
15 | /** @var Enumerable */ |
||
16 | protected $enum; |
||
17 | |||
18 | /** @var string */ |
||
19 | protected $attribute; |
||
20 | |||
21 | /** @var mixed */ |
||
22 | protected $value; |
||
23 | |||
24 | 88 | public function __construct(string $enum) |
|
25 | { |
||
26 | 88 | if (! class_exists($enum) || ! isset(class_implements($enum)[Enumerable::class])) { |
|
27 | 8 | throw new InvalidArgumentException("The given class {$enum} does not implement the Enumerable interface."); |
|
28 | } |
||
29 | |||
30 | 80 | $this->enum = $enum; |
|
|
|||
31 | 80 | } |
|
32 | |||
33 | 32 | public function passes($attribute, $value): bool |
|
46 | |||
47 | 32 | public function message(): string |
|
56 | |||
57 | 20 | protected function getOtherValues(): array |
|
61 | } |
||
62 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..