Conditions | 5 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
29 | public function passes($attribute, $value): bool |
||
30 | 24 | { |
|
31 | $this->attribute = $attribute; |
||
32 | 24 | ||
33 | 6 | if (! $this->required && ($value === '0' || $value === 0 || $value === null)) { |
|
34 | return true; |
||
35 | } |
||
36 | 24 | ||
37 | $countries = Arr::pluck((new ISO3166())->all(), ISO3166::KEY_ALPHA2); |
||
|
|||
38 | 24 | ||
39 | return in_array($value, $countries, true); |
||
40 | } |
||
41 | 12 | ||
49 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: