src/Route.php
public function middleware()
    {
        foreach ($this->_middleware as $middleware) {
            yield $middleware;
        }

        if ($scope = $this->scope()) {
            foreach ($scope->middleware() as $middleware) {
                yield $middleware;
            }
        }

        yield function() {
            $handler = $this->handler();
            return $handler($this, $this->response);
        };
    }
public function middleware()
    {
        foreach ($this->_middleware as $middleware) {
            yield $middleware;
        }

        if ($scope = $this->scope()) {
            foreach ($scope->middleware() as $middleware) {
                yield $middleware;
            }
        }

        yield function() {
            $handler = $this->handler();
            return $handler($this, $this->response);
        };
    }
Middleware generator.

@return callable