diff --git a/UPGRADE-8.0.md b/UPGRADE-8.0.md index 40b4769883bad..7b360f181b9da 100644 --- a/UPGRADE-8.0.md +++ b/UPGRADE-8.0.md @@ -165,6 +165,11 @@ Ldap * Remove `LdapUser::eraseCredentials()` in favor of `__serialize()` +Notifier +-------- + + * Remove the Sms77 Notifier bridge + OptionsResolver --------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index eeb1e8527e88d..02ec15f4c9f52 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -3114,7 +3114,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $ NotifierBridge\Sevenio\SevenIoTransportFactory::class => 'notifier.transport_factory.sevenio', NotifierBridge\Sinch\SinchTransportFactory::class => 'notifier.transport_factory.sinch', NotifierBridge\Slack\SlackTransportFactory::class => 'notifier.transport_factory.slack', - NotifierBridge\Sms77\Sms77TransportFactory::class => 'notifier.transport_factory.sms77', NotifierBridge\Smsapi\SmsapiTransportFactory::class => 'notifier.transport_factory.smsapi', NotifierBridge\SmsBiuras\SmsBiurasTransportFactory::class => 'notifier.transport_factory.sms-biuras', NotifierBridge\Smsbox\SmsboxTransportFactory::class => 'notifier.transport_factory.smsbox', diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php index d1adcfc370395..b7516214bf33b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php @@ -102,7 +102,6 @@ 'sms-biuras' => Bridge\SmsBiuras\SmsBiurasTransportFactory::class, 'sms-factor' => Bridge\SmsFactor\SmsFactorTransportFactory::class, 'sms-sluzba' => Bridge\SmsSluzba\SmsSluzbaTransportFactory::class, - 'sms77' => Bridge\Sms77\Sms77TransportFactory::class, 'smsapi' => Bridge\Smsapi\SmsapiTransportFactory::class, 'smsbox' => Bridge\Smsbox\SmsboxTransportFactory::class, 'smsc' => Bridge\Smsc\SmscTransportFactory::class, diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Sms77/.gitattributes deleted file mode 100644 index 14c3c35940427..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -/Tests export-ignore -/phpunit.xml.dist export-ignore -/.git* export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/.github/PULL_REQUEST_TEMPLATE.md b/src/Symfony/Component/Notifier/Bridge/Sms77/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 4689c4dad430e..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,8 +0,0 @@ -Please do not submit any Pull Requests here. They will be closed. ---- - -Please submit your PR here instead: -https://github.com/symfony/symfony - -This repository is what we call a "subtree split": a read-only subset of that main repository. -We're looking forward to your PR there! diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/.github/workflows/close-pull-request.yml b/src/Symfony/Component/Notifier/Bridge/Sms77/.github/workflows/close-pull-request.yml deleted file mode 100644 index e55b47817e69a..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/.github/workflows/close-pull-request.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Close Pull Request - -on: - pull_request_target: - types: [opened] - -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thanks for your Pull Request! We love contributions. - - However, you should instead open your PR on the main repository: - https://github.com/symfony/symfony - - This repository is what we call a "subtree split": a read-only subset of that main repository. - We're looking forward to your PR there! diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/.gitignore b/src/Symfony/Component/Notifier/Bridge/Sms77/.gitignore deleted file mode 100644 index c49a5d8df5c65..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/CHANGELOG.md b/src/Symfony/Component/Notifier/Bridge/Sms77/CHANGELOG.md deleted file mode 100644 index d78a5515f79b2..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/CHANGELOG.md +++ /dev/null @@ -1,17 +0,0 @@ -CHANGELOG -========= - -7.3 ---- - - * Deprecate the bridge - -6.2 ---- - - * Use `SmsMessage->from` when defined - -5.4 ---- - - * Add the bridge diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE b/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE deleted file mode 100644 index 99c6bdf356ee7..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2021-present Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/README.md b/src/Symfony/Component/Notifier/Bridge/Sms77/README.md deleted file mode 100644 index bcfa7d0252da0..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/README.md +++ /dev/null @@ -1,23 +0,0 @@ -sms77 Notifier -================= - -The sms77 bridge is deprecated, use the Seven.io bridge instead. - -DSN example ------------ - -``` -SMS77_DSN=sms77://API_KEY@default?from=FROM -``` - -where: - - `API_KEY` is your sms77 API key - - `FROM` is your sender (optional, default: SMS) - -Resources ---------- - - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/Sms77Transport.php b/src/Symfony/Component/Notifier/Bridge/Sms77/Sms77Transport.php deleted file mode 100644 index a71a84c3c1ba9..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/Sms77Transport.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sms77; - -use Symfony\Component\Notifier\Exception\TransportException; -use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException; -use Symfony\Component\Notifier\Message\MessageInterface; -use Symfony\Component\Notifier\Message\SentMessage; -use Symfony\Component\Notifier\Message\SmsMessage; -use Symfony\Component\Notifier\Transport\AbstractTransport; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; -use Symfony\Contracts\HttpClient\HttpClientInterface; - -/** - * @author André Matthies - * - * @deprecated since Symfony 7.3, use the Seven.io bridge instead. - */ -final class Sms77Transport extends AbstractTransport -{ - protected const HOST = 'gateway.sms77.io'; - - public function __construct( - #[\SensitiveParameter] private string $apiKey, - private ?string $from = null, - ?HttpClientInterface $client = null, - ?EventDispatcherInterface $dispatcher = null, - ) { - parent::__construct($client, $dispatcher); - } - - public function __toString(): string - { - return \sprintf('sms77://%s%s', $this->getEndpoint(), null !== $this->from ? '?from='.$this->from : ''); - } - - public function supports(MessageInterface $message): bool - { - return $message instanceof SmsMessage; - } - - protected function doSend(MessageInterface $message): SentMessage - { - if (!$message instanceof SmsMessage) { - throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message); - } - - $endpoint = \sprintf('https://%s/api/sms', $this->getEndpoint()); - $response = $this->client->request('POST', $endpoint, [ - 'headers' => [ - 'Content-Type' => 'application/json', - 'SentWith' => 'Symfony Notifier', - 'X-Api-Key' => $this->apiKey, - ], - 'json' => [ - 'from' => $message->getFrom() ?: $this->from, - 'json' => 1, - 'text' => $message->getSubject(), - 'to' => $message->getPhone(), - ], - ]); - - try { - $statusCode = $response->getStatusCode(); - } catch (TransportExceptionInterface $e) { - throw new TransportException('Could not reach the remote Sms77 server.', $response, 0, $e); - } - - if (200 !== $statusCode) { - $error = $response->toArray(false); - - throw new TransportException(\sprintf('Unable to send the SMS: "%s" (%s).', $error['description'], $error['code']), $response); - } - - $success = $response->toArray(false); - - if (false === \in_array($success['success'], [100, 101])) { - throw new TransportException(\sprintf('Unable to send the SMS: "%s".', $success['success']), $response); - } - - $sentMessage = new SentMessage($message, (string) $this); - $sentMessage->setMessageId((int) $success['messages'][0]['id']); - - return $sentMessage; - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/Sms77TransportFactory.php b/src/Symfony/Component/Notifier/Bridge/Sms77/Sms77TransportFactory.php deleted file mode 100644 index 686a7af14c664..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/Sms77TransportFactory.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sms77; - -use Symfony\Component\Notifier\Exception\UnsupportedSchemeException; -use Symfony\Component\Notifier\Transport\AbstractTransportFactory; -use Symfony\Component\Notifier\Transport\Dsn; - -/** - * @author André Matthies - * - * @deprecated since Symfony 7.3, use the Seven.io bridge instead. - */ -final class Sms77TransportFactory extends AbstractTransportFactory -{ - public function create(Dsn $dsn): Sms77Transport - { - trigger_deprecation('symfony/sms77-notifier', '7.3', 'The "symfony/sms77-notifier" package is deprecated, use "symfony/sevenio-notifier" instead.'); - - $scheme = $dsn->getScheme(); - - if ('sms77' !== $scheme) { - throw new UnsupportedSchemeException($dsn, 'sms77', $this->getSupportedSchemes()); - } - - $apiKey = $this->getUser($dsn); - $from = $dsn->getOption('from'); - $host = 'default' === $dsn->getHost() ? null : $dsn->getHost(); - $port = $dsn->getPort(); - - return (new Sms77Transport($apiKey, $from, $this->client, $this->dispatcher))->setHost($host)->setPort($port); - } - - protected function getSupportedSchemes(): array - { - return ['sms77']; - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/Tests/Sms77TransportFactoryTest.php b/src/Symfony/Component/Notifier/Bridge/Sms77/Tests/Sms77TransportFactoryTest.php deleted file mode 100644 index 6d00014af1e2a..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/Tests/Sms77TransportFactoryTest.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sms77\Tests; - -use Symfony\Component\Notifier\Bridge\Sms77\Sms77TransportFactory; -use Symfony\Component\Notifier\Test\AbstractTransportFactoryTestCase; -use Symfony\Component\Notifier\Test\IncompleteDsnTestTrait; - -/** - * @group legacy - */ -final class Sms77TransportFactoryTest extends AbstractTransportFactoryTestCase -{ - use IncompleteDsnTestTrait; - - public function createFactory(): Sms77TransportFactory - { - return new Sms77TransportFactory(); - } - - public static function createProvider(): iterable - { - yield [ - 'sms77://host.test', - 'sms77://apiKey@host.test', - ]; - - yield [ - 'sms77://host.test?from=TEST', - 'sms77://apiKey@host.test?from=TEST', - ]; - } - - public static function incompleteDsnProvider(): iterable - { - yield 'missing api key' => ['sms77://host?from=TEST']; - } - - public static function supportsProvider(): iterable - { - yield [true, 'sms77://apiKey@default?from=TEST']; - yield [false, 'somethingElse://apiKey@default?from=TEST']; - } - - public static function unsupportedSchemeProvider(): iterable - { - yield ['somethingElse://apiKey@default?from=FROM']; - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/Tests/Sms77TransportTest.php b/src/Symfony/Component/Notifier/Bridge/Sms77/Tests/Sms77TransportTest.php deleted file mode 100644 index 0d45b84d84577..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/Tests/Sms77TransportTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sms77\Tests; - -use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\Notifier\Bridge\Sms77\Sms77Transport; -use Symfony\Component\Notifier\Message\ChatMessage; -use Symfony\Component\Notifier\Message\SmsMessage; -use Symfony\Component\Notifier\Test\TransportTestCase; -use Symfony\Component\Notifier\Tests\Transport\DummyMessage; -use Symfony\Contracts\HttpClient\HttpClientInterface; - -/** - * @group legacy - */ -final class Sms77TransportTest extends TransportTestCase -{ - public static function createTransport(?HttpClientInterface $client = null, ?string $from = null): Sms77Transport - { - return new Sms77Transport('apiKey', $from, $client ?? new MockHttpClient()); - } - - public static function toStringProvider(): iterable - { - yield ['sms77://gateway.sms77.io', self::createTransport()]; - yield ['sms77://gateway.sms77.io?from=TEST', self::createTransport(null, 'TEST')]; - } - - public static function supportedMessagesProvider(): iterable - { - yield [new SmsMessage('0611223344', 'Hello!')]; - } - - public static function unsupportedMessagesProvider(): iterable - { - yield [new ChatMessage('Hello!')]; - yield [new DummyMessage()]; - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json b/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json deleted file mode 100644 index 6d60a11be0de3..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "symfony/sms77-notifier", - "type": "symfony-notifier-bridge", - "description": "Symfony sms77 Notifier Bridge", - "keywords": ["sms", "sms77", "notifier"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "André Matthies", - "email": "matthiez@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.4", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client": "^7.4|^8.0", - "symfony/notifier": "^7.4|^8.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Sms77\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/phpunit.xml.dist b/src/Symfony/Component/Notifier/Bridge/Sms77/phpunit.xml.dist deleted file mode 100644 index 911ede42fbcdf..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php index b1b6fbcf1bd36..02e5b83fe7328 100644 --- a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php +++ b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php @@ -256,10 +256,6 @@ class UnsupportedSchemeException extends LogicException 'class' => Bridge\Slack\SlackTransportFactory::class, 'package' => 'symfony/slack-notifier', ], - 'sms77' => [ - 'class' => Bridge\Sms77\Sms77TransportFactory::class, - 'package' => 'symfony/sms77-notifier', - ], 'smsapi' => [ 'class' => Bridge\Smsapi\SmsapiTransportFactory::class, 'package' => 'symfony/smsapi-notifier', diff --git a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php index 7170a3492ca9b..c07d8a7eb7a2b 100644 --- a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php +++ b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php @@ -182,7 +182,6 @@ public static function messageWhereSchemeIsPartOfSchemeToPackageMapProvider(): \ yield ['simpletextin', 'symfony/simple-textin-notifier']; yield ['sinch', 'symfony/sinch-notifier']; yield ['slack', 'symfony/slack-notifier']; - yield ['sms77', 'symfony/sms77-notifier']; yield ['smsapi', 'symfony/smsapi-notifier']; yield ['smsbiuras', 'symfony/sms-biuras-notifier']; yield ['smsc', 'symfony/smsc-notifier']; diff --git a/src/Symfony/Component/Notifier/Transport.php b/src/Symfony/Component/Notifier/Transport.php index c3c8d4a567961..6e860fb292624 100644 --- a/src/Symfony/Component/Notifier/Transport.php +++ b/src/Symfony/Component/Notifier/Transport.php @@ -87,7 +87,6 @@ final class Transport Bridge\SimpleTextin\SimpleTextinTransportFactory::class, Bridge\Sinch\SinchTransportFactory::class, Bridge\Slack\SlackTransportFactory::class, - Bridge\Sms77\Sms77TransportFactory::class, Bridge\Smsapi\SmsapiTransportFactory::class, Bridge\SmsBiuras\SmsBiurasTransportFactory::class, Bridge\Smsbox\SmsboxTransportFactory::class,