From cd36f182e0fb6eca737ffadfb1bfbfb191f75d22 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 21 Dec 2020 15:18:25 +0100 Subject: [PATCH] [Notifier] [Mattermost] [BC BREAK] Change constructor signature | Q | A | ------------- | --- | Branch? | 5.x, but BC BREAK for experimental bridge | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | --- | License | MIT | Doc PR | --- Follows #39545 --- .../Component/Notifier/Bridge/Mattermost/CHANGELOG.md | 8 ++++++++ .../Notifier/Bridge/Mattermost/MattermostTransport.php | 2 +- .../Bridge/Mattermost/MattermostTransportFactory.php | 2 +- .../Bridge/Mattermost/Tests/MattermostTransportTest.php | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/CHANGELOG.md b/src/Symfony/Component/Notifier/Bridge/Mattermost/CHANGELOG.md index 7bd5e9a57fd19..8130b2a20cf33 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mattermost/CHANGELOG.md +++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +5.3.0 +----- + +* [BC BREAK] Changed signature of `MattermostTransport::__construct()` method from: + `public function __construct(string $token, string $channel, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, string $path = null)` + to: + `public function __construct(string $token, string $channel, ?string $path = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)` + 5.1.0 ----- diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php b/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php index f1916342e7110..bdd25c150fa1c 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php @@ -31,7 +31,7 @@ final class MattermostTransport extends AbstractTransport private $channel; private $path; - public function __construct(string $token, string $channel, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, string $path = null) + public function __construct(string $token, string $channel, ?string $path = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null) { $this->token = $token; $this->channel = $channel; diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransportFactory.php b/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransportFactory.php index b75e46e8a87dc..d3942a14ab91c 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransportFactory.php +++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransportFactory.php @@ -43,7 +43,7 @@ public function create(Dsn $dsn): TransportInterface $host = $dsn->getHost(); $port = $dsn->getPort(); - return (new MattermostTransport($token, $channel, $this->client, $this->dispatcher, $path))->setHost($host)->setPort($port); + return (new MattermostTransport($token, $channel, $path, $this->client, $this->dispatcher))->setHost($host)->setPort($port); } protected function getSupportedSchemes(): array diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/Tests/MattermostTransportTest.php b/src/Symfony/Component/Notifier/Bridge/Mattermost/Tests/MattermostTransportTest.php index 606f610c4db9b..f8d1fa958a26d 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mattermost/Tests/MattermostTransportTest.php +++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/Tests/MattermostTransportTest.php @@ -49,6 +49,6 @@ public function testSendNonChatMessageThrowsLogicException() private function createTransport(): MattermostTransport { - return (new MattermostTransport('testAccessToken', 'testChannel', $this->createMock(HttpClientInterface::class)))->setHost('host.test'); + return (new MattermostTransport('testAccessToken', 'testChannel', null, $this->createMock(HttpClientInterface::class)))->setHost('host.test'); } }