From 28f9f9e92d475e9403b2754c5ad9230955759cfb Mon Sep 17 00:00:00 2001 From: "a.kalin" Date: Mon, 12 Sep 2022 03:24:44 +0300 Subject: [PATCH] Accept multiple return types --- src/TypedClient.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/TypedClient.php b/src/TypedClient.php index d447957..5fe3e96 100644 --- a/src/TypedClient.php +++ b/src/TypedClient.php @@ -26,10 +26,6 @@ abstract public function _apiCall(string $method, array $parameters): string; */ private function _requestWithMap(string $method, array $requestParams, array $returnType) { - if (count($returnType) > 1) { - throw new TelegramException('More than one return type is not implemented'); - } - $responseJson = $this->_apiCall($method, $this->_prepareRequest($requestParams)); if (empty($returnType)) { try { @@ -39,7 +35,7 @@ private function _requestWithMap(string $method, array $requestParams, array $re } } - return Serializer::deserialize($responseJson, $returnType[0]); + return Serializer::deserialize($responseJson, implode('|', $returnType)); } /**