diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php b/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php index 96e6cc86581aa..f97b7c36dfe14 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php @@ -36,7 +36,7 @@ final class TelegramTransport extends AbstractTransport private string $token; private ?string $chatChannel; - public const EXCLUSIVE_OPTIONS = [ + private const EXCLUSIVE_OPTIONS = [ 'message_id', 'callback_query_id', 'photo', diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/Tests/TelegramTransportTest.php b/src/Symfony/Component/Notifier/Bridge/Telegram/Tests/TelegramTransportTest.php index 497c0c957f5cb..b5a4f887d2e01 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/Tests/TelegramTransportTest.php +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/Tests/TelegramTransportTest.php @@ -1242,6 +1242,6 @@ public function testUsingMultipleExclusiveOptionsWillProvideExceptions(TelegramO $transport = self::createTransport($client, 'testChannel'); $this->expectException(MultipleExclusiveOptionsUsedException::class); - $sentMessage = $transport->send(new ChatMessage('', $messageOptions)); + $transport->send(new ChatMessage('', $messageOptions)); } } diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json b/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json index b81a30da1fb00..c1a4499c589ab 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/composer.json @@ -17,8 +17,9 @@ ], "require": { "php": ">=8.1", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/notifier": "^6.2.7|^7.0" + "symfony/http-client": "^6.3|^7.0", + "symfony/mime": "^5.4|^6.3|^7.0", + "symfony/notifier": "^6.4|^7.0" }, "autoload": { "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Telegram\\": "" }, diff --git a/src/Symfony/Component/Notifier/Exception/MultipleExclusiveOptionsUsedException.php b/src/Symfony/Component/Notifier/Exception/MultipleExclusiveOptionsUsedException.php index 738956f229d09..418b32dabe8b3 100644 --- a/src/Symfony/Component/Notifier/Exception/MultipleExclusiveOptionsUsedException.php +++ b/src/Symfony/Component/Notifier/Exception/MultipleExclusiveOptionsUsedException.php @@ -17,15 +17,16 @@ class MultipleExclusiveOptionsUsedException extends InvalidArgumentException { /** - * @param string[] $usedExclusiveOptions - * @param string[]|null $exclusiveOptions + * @param string[] $usedExclusiveOptions + * @param string[] $exclusiveOptions */ - public function __construct(array $usedExclusiveOptions, array $exclusiveOptions = null, \Throwable $previous = null) + public function __construct(array $usedExclusiveOptions, array $exclusiveOptions, \Throwable $previous = null) { - $message = sprintf('Multiple exclusive options have been used "%s".', implode('", "', $usedExclusiveOptions)); - if (null !== $exclusiveOptions) { - $message .= sprintf(' Only one of %s can be used.', implode('", "', $exclusiveOptions)); - } + $message = sprintf( + 'Multiple exclusive options have been used "%s". Only one of "%s" can be used.', + implode('", "', $usedExclusiveOptions), + implode('", "', $exclusiveOptions) + ); parent::__construct($message, 0, $previous); } diff --git a/src/Symfony/Component/Notifier/Tests/Exception/MultipleExclusiveOptionsUsedExceptionTest.php b/src/Symfony/Component/Notifier/Tests/Exception/MultipleExclusiveOptionsUsedExceptionTest.php new file mode 100644 index 0000000000000..cef0467d65282 --- /dev/null +++ b/src/Symfony/Component/Notifier/Tests/Exception/MultipleExclusiveOptionsUsedExceptionTest.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Tests\Exception; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Notifier\Exception\MultipleExclusiveOptionsUsedException; + +class MultipleExclusiveOptionsUsedExceptionTest extends TestCase +{ + public function testMessage() + { + $exception = new MultipleExclusiveOptionsUsedException(['foo', 'bar'], ['foo', 'bar', 'baz']); + + $this->assertSame( + 'Multiple exclusive options have been used "foo", "bar". Only one of "foo", "bar", "baz" can be used.', + $exception->getMessage() + ); + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy