From 0d7488b10aa4855ee7aaf82641ac27d9d4c83424 Mon Sep 17 00:00:00 2001 From: Vasilij Dusko Date: Sun, 4 Apr 2021 10:51:01 +0300 Subject: [PATCH] * type cast. On success lightsms return error code like string. On error return integer. --- .../Notifier/Bridge/LightSms/LightSmsTransport.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Notifier/Bridge/LightSms/LightSmsTransport.php b/src/Symfony/Component/Notifier/Bridge/LightSms/LightSmsTransport.php index 3dac3d25e0..3342021792 100644 --- a/src/Symfony/Component/Notifier/Bridge/LightSms/LightSmsTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/LightSms/LightSmsTransport.php @@ -121,16 +121,16 @@ final class LightSmsTransport extends AbstractTransport // it happens if the host without www if (isset($content['']['error'])) { - throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg($content['']['error']), $response); + throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg((int)$content['']['error']), $response); } if (isset($content['error'])) { - throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg($content['error']), $response); + throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg((int)$content['error']), $response); } $phone = $this->escapePhoneNumber($message->getPhone()); if (32 === $content[$phone]['error']) { - throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg($content[$phone]['error']), $response); + throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg((int)$content[$phone]['error']), $response); } if (0 == $content[$phone]['error']) { @@ -164,7 +164,7 @@ final class LightSmsTransport extends AbstractTransport return str_replace('+', '00', $phoneNumber); } - private function getErrorMsg(string $errorCode): string + private function getErrorMsg(int $errorCode): string { return isset(self::ERROR_CODES[$errorCode]) ? self::ERROR_CODES[$errorCode] : self::ERROR_CODES[999]; }