It seems like $rule can also be of type Yiisoft\Validator\Rule; however, parameter $callback of Yiisoft\Validator\Rule\Callback::__construct() does only seem to accept callable, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
42
$rule = new Callback(/** @scrutinizer ignore-type */ $rule);
Loading history...
43
}
44
45
3
if (!$rule instanceof Rule) {
46
1
throw new \InvalidArgumentException(
47
1
'Rule should be either instance of Rule class or a callable'