It seems like $middleware can also be of type Psr\Http\Server\MiddlewareInterface; however, parameter $callback of Yiisoft\Router\Middleware\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
41
$middleware = new Callback(/** @scrutinizer ignore-type */ $middleware);
Loading history...
42
}
43
44
1
if (!$middleware instanceof MiddlewareInterface) {
45
throw new InvalidArgumentException('Parameter should be either a PSR middleware or a callable.');