From cb8f67ad9b372c305ec4cfe0d7d3a74934b8f688 Mon Sep 17 00:00:00 2001 From: zhouyangyang Date: Fri, 8 Apr 2022 21:02:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A9=E5=B1=95=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 +++-- src/Drivers/TwilioDriver.php | 10 ++-------- src/Exceptions/RequestException.php | 4 +++- .../StrategicallySendMessageException.php | 14 ++++---------- src/Listeners/ValidatorFactoryResolvedListener.php | 3 ++- src/Rules/MobileNumber.php | 2 +- src/Sms.php | 6 +++--- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index 7e8ae11..5834444 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ } }, "require": { - "php": ">=7.3", + "php": ">=7.4", "ext-json": "*", "ext-simplexml": "*", "ext-swoole": ">=4.5", @@ -39,7 +39,8 @@ "hyperf/event": "~2.2.0", "hyperf/framework": "~2.2.0", "hyperf/guzzle": "~2.2.0", - "hyperf/logger": "~2.2.0" + "hyperf/logger": "~2.2.0", + "hyperf/validation": "^2.2" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", diff --git a/src/Drivers/TwilioDriver.php b/src/Drivers/TwilioDriver.php index a7f82e7..a64ab15 100644 --- a/src/Drivers/TwilioDriver.php +++ b/src/Drivers/TwilioDriver.php @@ -1,13 +1,7 @@ stack; } diff --git a/src/Listeners/ValidatorFactoryResolvedListener.php b/src/Listeners/ValidatorFactoryResolvedListener.php index 38d866a..1cde0dd 100644 --- a/src/Listeners/ValidatorFactoryResolvedListener.php +++ b/src/Listeners/ValidatorFactoryResolvedListener.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Zyimm\Sms\Listeners; use Hyperf\Event\Contract\ListenerInterface; +use Hyperf\Validation\Contract\ValidatorFactoryInterface; use Hyperf\Validation\Event\ValidatorFactoryResolved; use Zyimm\Sms\MobileNumber; use LogicException; @@ -21,7 +22,7 @@ class ValidatorFactoryResolvedListener implements ListenerInterface public function process(object $event) { - /** @var \Hyperf\Validation\Contract\ValidatorFactoryInterface $validatorFactory */ + /** @var ValidatorFactoryInterface $validatorFactory */ $validatorFactory = $event->validatorFactory; $validatorFactory->extend('mobile_number', function ($attribute, $value, $parameters, $validator) { diff --git a/src/Rules/MobileNumber.php b/src/Rules/MobileNumber.php index 1c98373..abbe5ef 100644 --- a/src/Rules/MobileNumber.php +++ b/src/Rules/MobileNumber.php @@ -9,7 +9,7 @@ class MobileNumber /** * @var string[] */ - protected $regionCodes; + protected array $regionCodes; /** * Create a new in rule instance. diff --git a/src/Sms.php b/src/Sms.php index 6e6a73d..964322f 100644 --- a/src/Sms.php +++ b/src/Sms.php @@ -11,11 +11,11 @@ declare(strict_types=1); namespace Zyimm\Sms; use Hyperf\Utils\ApplicationContext; -use Zyimm\Sms\Contract\HasMailAddress; +use HyperfExt\Contract\HasMailAddress; use Zyimm\Sms\Contracts\SmsManagerInterface; /** - * @method static \Zyimm\Sms\PendingSms to(HasMailAddress|string $number, null|int|string $defaultRegion = null) + * @method static PendingSms to(HasMailAddress|string $number, null|int|string $defaultRegion = null) */ class Sms { @@ -26,7 +26,7 @@ class Sms return $instance->{$method}(...$args); } - public static function sender(string $name) + public static function sender(string $name): PendingSms { return (new PendingSms(static::getManager()))->sender($name); }