1 | <?php |
||
7 | class Validator |
||
8 | { |
||
9 | /** @var string|\Wandu\Validator\Contracts\RuleInterface|\Wandu\Validator\Contracts\TesterInterface */ |
||
10 | protected $rule; |
||
11 | |||
12 | /** |
||
13 | * @param string|\Wandu\Validator\Contracts\RuleInterface|\Wandu\Validator\Contracts\TesterInterface $rule |
||
14 | */ |
||
15 | 4 | public function __construct($rule) |
|
19 | |||
20 | /** |
||
21 | * @param mixed $data |
||
22 | * @return void |
||
23 | */ |
||
24 | 4 | public function assert($data) |
|
43 | |||
44 | /** |
||
45 | * @param mixed $data |
||
46 | * @return bool |
||
47 | */ |
||
48 | public function validate($data): bool |
||
56 | } |
||
57 |
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: