code: public function toPsrResponse($result, ResponseInterface $response, StreamInterface $writableBodyStream)
      {
          if ($result instanceof Promise) {
              return $result->then(function ($actualResult) use ($response, $writableBodyStream) {
                  return $this->doConvertToPsrResponse($actualResult, $response, $writableBodyStream);
              });
          }
  
          return $this->doConvertToPsrResponse($result, $response, $writableBodyStream);
      }
docs: Converts query execution result to PSR-7 response
  
  @param Promise|ExecutionResult|ExecutionResult[] $result
  
  @return Promise|ResponseInterface
  
  @api