src/Server/Middleware/CallableMiddleware.php
public function process(
        ServerRequestInterface $request,
        RequestHandlerInterface $handler
    ): ResponseInterface {
        $response = self::execute($this->callable, [$request, $handler]);
        if (!$response instanceof ResponseInterface) {
            throw new UnexpectedValueException(
                sprintf('The middleware must return an instance of %s', ResponseInterface::class)
            );
        }
        return $response;
    }
public function process(
        ServerRequestInterface $request,
        RequestHandlerInterface $handler
    ): ResponseInterface {
        $response = self::execute($this->callable, [$request, $handler]);
        if (!$response instanceof ResponseInterface) {
            throw new UnexpectedValueException(
                sprintf('The middleware must return an instance of %s', ResponseInterface::class)
            );
        }
        return $response;
    }
Process an incoming server request and return a response, optionally delegating
response creation to an handler.

@param ServerRequestInterface $request
@param RequestHandlerInterface $handler

@return ResponseInterface