From 5854e3bcea1e965e7ed7eb8ad74b602342d09528 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 May 2023 17:24:39 +0200 Subject: [PATCH 1/6] [7.0] Bump to PHP 8.2 minimum --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 2b617f8..b3c7c27 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,12 @@ } ], "require": { - "php": ">=8.1", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/notifier": "^6.3|^7.0" + "php": ">=8.2", + "symfony/http-client": "^6.4|^7.0", + "symfony/notifier": "^6.4|^7.0" }, "require-dev": { - "symfony/event-dispatcher": "^5.4|^6.0|^7.0" + "symfony/event-dispatcher": "^6.4|^7.0" }, "autoload": { "psr-4": {"Symfony\\Component\\Notifier\\Bridge\\ClickSend\\": ""}, From 287686951325cabdf0b5657f6b0c6b39995f8b24 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 27 Dec 2023 11:55:25 +0100 Subject: [PATCH 2/6] [Notifier] [Bridges] Use CPP --- ClickSendTransport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClickSendTransport.php b/ClickSendTransport.php index 680050e..652f219 100644 --- a/ClickSendTransport.php +++ b/ClickSendTransport.php @@ -37,7 +37,7 @@ public function __construct( private readonly ?string $listId = null, private readonly ?string $fromEmail = null, HttpClientInterface $client = null, - EventDispatcherInterface $dispatcher = null + EventDispatcherInterface $dispatcher = null, ) { parent::__construct($client, $dispatcher); } From 070174e877d2ce05efcccfaf5cdaf409f69a6c8a Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 20 Jun 2024 17:52:34 +0200 Subject: [PATCH 3/6] Prefix all sprintf() calls --- ClickSendTransport.php | 8 ++++---- Tests/ClickSendTransportTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ClickSendTransport.php b/ClickSendTransport.php index 76abd4b..8d8987e 100644 --- a/ClickSendTransport.php +++ b/ClickSendTransport.php @@ -51,7 +51,7 @@ public function __toString(): string 'from_email' => $this->fromEmail, ]); - return sprintf('clicksend://%s%s', $this->getEndpoint(), $query ? '?'.http_build_query($query, '', '&') : ''); + return \sprintf('clicksend://%s%s', $this->getEndpoint(), $query ? '?'.http_build_query($query, '', '&') : ''); } public function supports(MessageInterface $message): bool @@ -68,7 +68,7 @@ protected function doSend(MessageInterface $message): SentMessage throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message); } - $endpoint = sprintf('https://%s/v3/sms/send', $this->getEndpoint()); + $endpoint = \sprintf('https://%s/v3/sms/send', $this->getEndpoint()); $options = $message->getOptions()?->toArray() ?? []; $options['body'] = $message->getSubject(); @@ -78,7 +78,7 @@ protected function doSend(MessageInterface $message): SentMessage $options['from_email'] ?? $this->fromEmail; if (isset($options['from']) && !preg_match('/^[a-zA-Z0-9\s]{3,11}$/', $options['from']) && !preg_match('/^\+[1-9]\d{1,14}$/', $options['from'])) { - throw new InvalidArgumentException(sprintf('The "From" number "%s" is not a valid phone number, shortcode, or alphanumeric sender ID.', $options['from'])); + throw new InvalidArgumentException(\sprintf('The "From" number "%s" is not a valid phone number, shortcode, or alphanumeric sender ID.', $options['from'])); } if ($options['list_id'] ?? false) { @@ -98,7 +98,7 @@ protected function doSend(MessageInterface $message): SentMessage if (200 !== $statusCode) { $error = $response->getContent(false); - throw new TransportException(sprintf('Unable to send the SMS - "%s".', $error ?: 'unknown failure'), $response); + throw new TransportException(\sprintf('Unable to send the SMS - "%s".', $error ?: 'unknown failure'), $response); } return new SentMessage($message, (string) $this); diff --git a/Tests/ClickSendTransportTest.php b/Tests/ClickSendTransportTest.php index 166bb10..6afae44 100644 --- a/Tests/ClickSendTransportTest.php +++ b/Tests/ClickSendTransportTest.php @@ -49,7 +49,7 @@ public function testInvalidArgumentExceptionIsThrownIfFromIsInvalid(string $from $transport = $this->createTransport(null, $from); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage(sprintf('The "From" number "%s" is not a valid phone number, shortcode, or alphanumeric sender ID.', $from)); + $this->expectExceptionMessage(\sprintf('The "From" number "%s" is not a valid phone number, shortcode, or alphanumeric sender ID.', $from)); $transport->send(new SmsMessage('+33612345678', 'Hello!')); } From c2d1ed54faa3eb02b96bc8626355c7f148b5f633 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 3 Jul 2024 16:05:29 +0200 Subject: [PATCH 4/6] [Notifier] Unify composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b3c7c27..d925ce6 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "symfony/event-dispatcher": "^6.4|^7.0" }, "autoload": { - "psr-4": {"Symfony\\Component\\Notifier\\Bridge\\ClickSend\\": ""}, + "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\ClickSend\\": "" }, "exclude-from-classmap": [ "/Tests/" ] From 06644ce3e3a5df69707275786cbc67bac11d85d1 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 22 Jul 2024 10:27:43 +0200 Subject: [PATCH 5/6] Use CPP where possible --- ClickSendOptions.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ClickSendOptions.php b/ClickSendOptions.php index ea9b71f..2995b73 100644 --- a/ClickSendOptions.php +++ b/ClickSendOptions.php @@ -18,11 +18,9 @@ */ final class ClickSendOptions implements MessageOptionsInterface { - private array $options; - - public function __construct(array $options = []) - { - $this->options = $options; + public function __construct( + private array $options = [], + ) { } public function getRecipientId(): ?string From 5d2486d96c1a4e3430a4ea163dba45737510b401 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 18 Sep 2024 13:58:19 +0200 Subject: [PATCH 6/6] deprecate the TransportFactoryTestCase --- Tests/ClickSendTransportFactoryTest.php | 7 +++++-- composer.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Tests/ClickSendTransportFactoryTest.php b/Tests/ClickSendTransportFactoryTest.php index 670447f..6640d0c 100644 --- a/Tests/ClickSendTransportFactoryTest.php +++ b/Tests/ClickSendTransportFactoryTest.php @@ -12,10 +12,13 @@ namespace Symfony\Component\Notifier\Bridge\ClickSend\Tests; use Symfony\Component\Notifier\Bridge\ClickSend\ClickSendTransportFactory; -use Symfony\Component\Notifier\Test\TransportFactoryTestCase; +use Symfony\Component\Notifier\Test\AbstractTransportFactoryTestCase; +use Symfony\Component\Notifier\Test\IncompleteDsnTestTrait; -final class ClickSendTransportFactoryTest extends TransportFactoryTestCase +final class ClickSendTransportFactoryTest extends AbstractTransportFactoryTestCase { + use IncompleteDsnTestTrait; + public function createFactory(): ClickSendTransportFactory { return new ClickSendTransportFactory(); diff --git a/composer.json b/composer.json index d925ce6..1676fea 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": ">=8.2", "symfony/http-client": "^6.4|^7.0", - "symfony/notifier": "^6.4|^7.0" + "symfony/notifier": "^7.2" }, "require-dev": { "symfony/event-dispatcher": "^6.4|^7.0"