8000 Fixing some Coding Standards complaints by fabbot · symfony/symfony@36b936e · GitHub
[go: up one dir, main page]

Skip to content

Commit 36b936e

Browse files
committed
Fixing some Coding Standards complaints by fabbot
1 parent 62f60de commit 36b936e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Symfony/Component/Notifier/Bridge/Matrix/Exception/UnsupportesMsgTypeByAPIException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ class UnsupportesMsgTypeByAPIException extends LogicException
1818
{
1919
public function __construct(string $given)
2020
{
21-
parent::__construct(\sprintf('Unsupported message type: "%s". Only %s are supported by Matrix Synapse Client-Server API v3', $given, implode(', ',MatrixTransport::SUPPORTED_MSG_TYPES_BY_API)));
21+
parent::__construct(\sprintf('Unsupported message type: "%s". Only %s are supported by Matrix Synapse Client-Server API v3', $given, implode(', ', MatrixTransport::SUPPORTED_MSG_TYPES_BY_API)));
2222
}
2323
}

src/Symfony/Component/Notifier/Bridge/Matrix/MatrixTransport.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ final class MatrixTransport extends AbstractTransport
3333
{
3434
// not all Message Types are supported by Symfony API
3535
public const SUPPORTED_MSG_TYPES_BY_API = ['m.text', 'm.emote', 'm.notice', 'm.image', 'm.file', 'm.audio', 'm.video', 'm.key.verification'];
36+
3637
public function __construct(
3738
#[\SensitiveParameter] private string $accessToken,
3839
private bool $ssl,
@@ -68,7 +69,7 @@ protected function doSend(MessageInterface $message): SentMessage
6869
$options['msgtype'] = $options['msgtype'] ?? 'm.text';
6970

7071
// check if msgtype is supported by API
71-
if (!in_array($options['msgtype'], self::SUPPORTED_MSG_TYPES_BY_API, true)) {
72+
if (!\in_array($options['msgtype'], self::SUPPORTED_MSG_TYPES_BY_API, true)) {
7273
throw new UnsupportesMsgTypeByAPIException($options['msgtype']);
7374
}
7475

@@ -137,7 +138,7 @@ private function createPrivateChannel(
137138
private function getDirectMessageChannel(
138139
string $recipientId,
139140
): ?string {
140-
$response = $this->getAccountData($this->getWhoami()['user_id'],'m.direct');
141+
$response = $this->getAccountData($this->getWhoami()['user_id'], 'm.direct');
141142
if (!isset($response[$recipientId])) {
142143
$roomid = $this->createPrivateChannel($recipientId)['room_id'];
143144
$response[$recipientId] = [$roomid];
@@ -161,7 +162,7 @@ private function updateAccountData(
161162
options: [
162163
'json' => $data,
163164
]);
164-
if($response->toArray()!== []) {
165+
if ([] !== $response->toArray()) {
165166
throw new TransportException('Unable to update account data.', $response);
166167
}
167168
}
@@ -219,7 +220,7 @@ protected function connect(
219220
throw new TransportException('Could not reach the Matrix server.', $response, 0, $e);
220221
}
221222

222-
if (in_array($statusCode,[400,403,405])) {
223+
if (\in_array($statusCode, [400,403,405])) {
223224
$result = $response->toArray(false);
224225
throw new TransportException(\sprintf('Error: Matrix responded with "%s (%s)"', $result['error'], $result['errcode']), $response);
225226
}

src/Symfony/Component/Notifier/Bridge/Matrix/Tests/MatrixTransportTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,4 @@ public function testUnsupportedMsgType(){
5858
$this->expectException(UnsupportesMsgTypeByAPIException::class);
5959
$transport->send(new ChatMessage('Hello!', new MatrixOptions(['recipient_id' => '@user:matrix.io', 'msgtype' => 'm.anything'])));
6060
}
61-
6261
}

0 commit comments

Comments
 (0)
0