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
33
$rule = new Callback(/** @scrutinizer ignore-type */ $rule);
Loading history...
34
}
35
36
2
if (!$rule instanceof Rule) {
37
1
throw new \InvalidArgumentException(
38
1
'Rule should be either instance of Rule class or a callable'