src/Viserio/Component/Routing/Pipeline.php
private function getRequestHandlerMiddleware(callable $middleware): RequestHandlerInterface
    {
        return new class($middleware) implements RequestHandlerInterface {
            /**
             * @var callable
             */
            private $middleware;

            /**
             * Create a new delegate callable middleware instance.
             *
             * @param callable $middleware
             */
            public function __construct(callable $middleware)
            {
                $this->middleware = $middleware;
            }

            /**
             * {@inheritdoc}
             */
            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                return \call_user_func($this->middleware, $request);
            }
        };
    }
private function getRequestHandlerMiddleware(callable $middleware): RequestHandlerInterface
    {
        return new class($middleware) implements RequestHandlerInterface {
            /**
             * @var callable
             */
            private $middleware;

            /**
             * Create a new delegate callable middleware instance.
             *
             * @param callable $middleware
             */
            public function __construct(callable $middleware)
            {
                $this->middleware = $middleware;
            }

            /**
             * {@inheritdoc}
             */
            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                return \call_user_func($this->middleware, $request);
            }
        };
    }
Private delegate callable middleware for the pipe.

@param callable $middleware

@return \Psr\Http\Server\RequestHandlerInterface