| 1 | <?php |
||
| 11 | class Voucher implements Rule |
||
| 12 | { |
||
| 13 | protected $isInvalid = false; |
||
| 14 | protected $isExpired = false; |
||
| 15 | protected $wasRedeemed = false; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Determine if the validation rule passes. |
||
| 19 | * |
||
| 20 | * @param string $attribute |
||
| 21 | * @param mixed $value |
||
| 22 | * @return bool |
||
| 23 | */ |
||
| 24 | public function passes($attribute, $value) |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Get the validation error message. |
||
| 49 | * |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function message() |
||
| 62 | } |
||
| 63 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: