Accessing router on the interface Illuminate\Contracts\Foundation\Application suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
44
->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($router) {
SwooleTW\Http\Middleware\AccessLog::class of type string is incompatible with the type Closure|array expected by parameter $middleware of Laravel\Lumen\Application::middleware().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation