Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function passes(string $attribute, mixed $value): bool |
||
|
|||
16 | { |
||
17 | if (! enum_exists($this->enum)) { |
||
18 | return false; |
||
19 | } |
||
20 | |||
21 | if ($value instanceof $this->enum) { |
||
22 | return true; |
||
23 | } |
||
24 | |||
25 | if (! method_exists($this->enum, 'tryFrom')) { |
||
26 | return false; |
||
27 | } |
||
28 | |||
29 | return ! is_null($this->enum::tryFrom($value)); |
||
30 | } |
||
39 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.