From 6a4124c92970e62da98ae9d3efdfd7e7257b6c80 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 18 Sep 2024 22:26:39 +0200 Subject: [PATCH] chore(cs): Prepare coding-standard update Signed-off-by: Joas Schilling --- lib/Chat/CommentsManager.php | 2 +- lib/Chat/Parser/SystemMessage.php | 2 +- lib/Command/Developer/UpdateDocs.php | 10 +++++----- lib/Command/User/TransferOwnership.php | 2 +- lib/Events/BeforeTurnServersGetEvent.php | 2 +- lib/Exceptions/DialOutFailedException.php | 3 ++- lib/Manager.php | 2 +- lib/MatterbridgeManager.php | 4 ++-- lib/Middleware/Attribute/RequirePermission.php | 2 +- lib/Middleware/CanUseTalkMiddleware.php | 2 +- lib/Middleware/InjectionMiddleware.php | 2 +- lib/Migration/FixNamespaceInDatabaseTables.php | 2 +- lib/Migration/Version19000Date20240709183938.php | 4 ++-- lib/Notification/Notifier.php | 4 ++-- lib/Service/HostedSignalingServerService.php | 10 +++++----- lib/Share/RoomShareProvider.php | 2 +- .../integration/features/bootstrap/FeatureContext.php | 8 ++++---- .../php/Collaboration/Collaborators/RoomPluginTest.php | 2 +- 18 files changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/Chat/CommentsManager.php b/lib/Chat/CommentsManager.php index a573147ef77..7dcaa062cc4 100644 --- a/lib/Chat/CommentsManager.php +++ b/lib/Chat/CommentsManager.php @@ -98,7 +98,7 @@ public function searchForObjectsWithFilters(string $search, string $objectType, if ($search !== '') { $query->where($query->expr()->iLike('message', $query->createNamedParameter( - '%' . $this->dbConn->escapeLikeParameter($search). '%' + '%' . $this->dbConn->escapeLikeParameter($search) . '%' ))); } diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index de21c07d108..adf3616cff1 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -167,7 +167,7 @@ protected function parseMessage(Message $chatMessage): void { $parsedMessage = $this->l->t('You created the conversation'); } elseif ($systemIsActor) { $parsedMessage = $this->l->t('System created the conversation'); - }if ($cliIsActor) { + } elseif ($cliIsActor) { $parsedMessage = $this->l->t('An administrator created the conversation'); } } elseif ($message === 'conversation_renamed') { diff --git a/lib/Command/Developer/UpdateDocs.php b/lib/Command/Developer/UpdateDocs.php index fcd95632ce1..0becab0349a 100644 --- a/lib/Command/Developer/UpdateDocs.php +++ b/lib/Command/Developer/UpdateDocs.php @@ -75,7 +75,7 @@ protected function getDocumentation(Command $command): string { $command->getUsages() ), function ($carry, $usage) { - return $carry.'* `'.$usage.'`'."\n"; + return $carry.'* `' . $usage . '`' . "\n"; } ); $doc .= $this->describeInputDefinition($command); @@ -119,7 +119,7 @@ protected function describeInputArgument(InputArgument $argument): string { $description = $argument->getDescription(); return - '| `'.($argument->getName() ?: '') . '` | ' . + '| `' . ($argument->getName() ?: '') . '` | ' . ($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | ' . ($argument->isRequired() ? 'yes' : 'no') . ' | ' . ($argument->isArray() ? 'yes' : 'no') . ' | ' . @@ -127,15 +127,15 @@ protected function describeInputArgument(InputArgument $argument): string { } protected function describeInputOption(InputOption $option): string { - $name = '--'.$option->getName(); + $name = '--' . $option->getName(); if ($option->getShortcut()) { - $name .= '\|-'.str_replace('|', '\|-', $option->getShortcut()); + $name .= '\|-' . str_replace('|', '\|-', $option->getShortcut()); } $description = $option->getDescription(); return '| `' . $name . '` | ' . - ($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | '. + ($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | ' . ($option->acceptValue() ? 'yes' : 'no') . ' | ' . ($option->isValueRequired() ? 'yes' : 'no') . ' | ' . ($option->isArray() ? 'yes' : 'no') . ' | ' . diff --git a/lib/Command/User/TransferOwnership.php b/lib/Command/User/TransferOwnership.php index c0d2f00d62f..c5131cb1490 100644 --- a/lib/Command/User/TransferOwnership.php +++ b/lib/Command/User/TransferOwnership.php @@ -130,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($federatedRooms > 0) { - $output->writeln('Could not transfer membership in ' . $federatedRooms. ' federated rooms.'); + $output->writeln('Could not transfer membership in ' . $federatedRooms . ' federated rooms.'); } $output->writeln('Added or promoted user ' . $destinationUser->getUID() . ' in ' . $modified . ' rooms.'); diff --git a/lib/Events/BeforeTurnServersGetEvent.php b/lib/Events/BeforeTurnServersGetEvent.php index 032436f8176..392278cb56b 100644 --- a/lib/Events/BeforeTurnServersGetEvent.php +++ b/lib/Events/BeforeTurnServersGetEvent.php @@ -15,7 +15,7 @@ class BeforeTurnServersGetEvent extends Event { * @param list $servers */ public function __construct( - protected array $servers + protected array $servers, ) { parent::__construct(); } diff --git a/lib/Exceptions/DialOutFailedException.php b/lib/Exceptions/DialOutFailedException.php index 7f88ed1d14f..61f606c7096 100644 --- a/lib/Exceptions/DialOutFailedException.php +++ b/lib/Exceptions/DialOutFailedException.php @@ -12,7 +12,8 @@ class DialOutFailedException extends \RuntimeException { public function __construct( string $errorCode, - protected string $readableError) { + protected string $readableError, + ) { parent::__construct($errorCode); } diff --git a/lib/Manager.php b/lib/Manager.php index 94e67bfd0ba..14932633c03 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -478,7 +478,7 @@ public function getListedRoomsForUser(string $userId, string $term = ''): array if ($term !== '') { $query->andWhere( $query->expr()->iLike('name', $query->createNamedParameter( - '%' . $this->db->escapeLikeParameter($term). '%' + '%' . $this->db->escapeLikeParameter($term) . '%' )) ); } diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php index 26e94f1f702..6deab9d225b 100644 --- a/lib/MatterbridgeManager.php +++ b/lib/MatterbridgeManager.php @@ -342,7 +342,7 @@ private function generateConfig(array $bridge): string { $serverUrl = $part['server']; } else { $serverUrl = preg_replace('/\/+$/', '', $this->urlGenerator->getAbsoluteURL('')); - $content .= ' SeparateDisplayName = true' ."\n"; + $content .= ' SeparateDisplayName = true' . "\n"; // TODO remove that //$serverUrl = preg_replace('/https:/', 'http:', $serverUrl); } @@ -553,7 +553,7 @@ private function checkBridgeProcess(Room $room, array $bridge, bool $relaunch = // config : no PID stored // config : enabled => launch it $pid = $this->launchMatterbridge($room); - $this->logger->info('Launch process, PID is '.$pid); + $this->logger->info('Launch process, PID is ' . $pid); } } else { $this->logger->info('No PID defined in config AND bridge disabled in config : doing nothing'); diff --git a/lib/Middleware/Attribute/RequirePermission.php b/lib/Middleware/Attribute/RequirePermission.php index 073f8b02f1c..da4279fc190 100644 --- a/lib/Middleware/Attribute/RequirePermission.php +++ b/lib/Middleware/Attribute/RequirePermission.php @@ -22,7 +22,7 @@ class RequirePermission { public const START_CALL = 'call-start'; public function __construct( - protected string $permission + protected string $permission, ) { } diff --git a/lib/Middleware/CanUseTalkMiddleware.php b/lib/Middleware/CanUseTalkMiddleware.php index 351f0c719a9..fd01d305bb0 100644 --- a/lib/Middleware/CanUseTalkMiddleware.php +++ b/lib/Middleware/CanUseTalkMiddleware.php @@ -47,7 +47,7 @@ public function __construct( protected Config $talkConfig, protected IConfig $serverConfig, protected IRequest $request, - protected IURLGenerator $url + protected IURLGenerator $url, ) { } diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php index 9ff0550b226..62725f86685 100644 --- a/lib/Middleware/InjectionMiddleware.php +++ b/lib/Middleware/InjectionMiddleware.php @@ -217,7 +217,7 @@ protected function getLoggedInOrGuest( bool $moderatorRequired, bool $requireListedWhenNoParticipant = false, bool $requireFederationWhenNotLoggedIn = false, - ?string $sessionIdParameter = null + ?string $sessionIdParameter = null, ): void { if ($requireFederationWhenNotLoggedIn && $this->userId === null && !$this->federationAuthenticator->isFederationRequest()) { throw new ParticipantNotFoundException(); diff --git a/lib/Migration/FixNamespaceInDatabaseTables.php b/lib/Migration/FixNamespaceInDatabaseTables.php index 9ce926d2208..51163c42dc2 100644 --- a/lib/Migration/FixNamespaceInDatabaseTables.php +++ b/lib/Migration/FixNamespaceInDatabaseTables.php @@ -33,7 +33,7 @@ public function run(IOutput $output): void { $query->select('id', 'class') ->from('jobs') ->where($query->expr()->like('class', $query->createNamedParameter( - '%' . $this->connection->escapeLikeParameter('Spreed'). '%' + '%' . $this->connection->escapeLikeParameter('Spreed') . '%' ))); $result = $query->executeQuery(); diff --git a/lib/Migration/Version19000Date20240709183938.php b/lib/Migration/Version19000Date20240709183938.php index f2c54adf7da..b604f0d74a7 100644 --- a/lib/Migration/Version19000Date20240709183938.php +++ b/lib/Migration/Version19000Date20240709183938.php @@ -42,10 +42,10 @@ protected function addMissingProtocol(string $table, string $column): void { $query->update($table) ->set($column, $query->func()->concat($query->createNamedParameter('https://'), $column)) ->where($query->expr()->notLike($column, $query->createNamedParameter( - $this->connection->escapeLikeParameter('http://'). '%' + $this->connection->escapeLikeParameter('http://') . '%' ))) ->andWhere($query->expr()->notLike($column, $query->createNamedParameter( - $this->connection->escapeLikeParameter('https://'). '%' + $this->connection->escapeLikeParameter('https://') . '%' ))) ->andWhere($query->expr()->nonEmptyString($column)); $query->executeStatement(); diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index f904ab969b3..309dcbb8ad4 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -289,7 +289,7 @@ protected function parseStoredRecordingFail( INotification $notification, Room $room, Participant $participant, - IL10N $l + IL10N $l, ): INotification { $notification ->setRichSubject( @@ -314,7 +314,7 @@ protected function parseStoredRecording( INotification $notification, Room $room, Participant $participant, - IL10N $l + IL10N $l, ): INotification { $parameters = $notification->getSubjectParameters(); try { diff --git a/lib/Service/HostedSignalingServerService.php b/lib/Service/HostedSignalingServerService.php index ced215c1b3c..c0bbab8da49 100644 --- a/lib/Service/HostedSignalingServerService.php +++ b/lib/Service/HostedSignalingServerService.php @@ -89,7 +89,7 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou if ($body) { $parsedBody = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { - $this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); + $this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); $message = $this->l10n->t('Something unexpected happened.'); throw new HostedSignalingServerAPIException($message, $status); @@ -198,7 +198,7 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou $data = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { - $this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); + $this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); $message = $this->l10n->t('Something unexpected happened.'); throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR); @@ -262,7 +262,7 @@ public function fetchAccountInfo(AccountId $accountId) { if ($body) { $parsedBody = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { - $this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); + $this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); $message = $this->l10n->t('Something unexpected happened.'); throw new HostedSignalingServerAPIException($message, $status); @@ -334,7 +334,7 @@ public function fetchAccountInfo(AccountId $accountId) { $data = (array)json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { - $this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); + $this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); $message = $this->l10n->t('Something unexpected happened.'); throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR); @@ -416,7 +416,7 @@ public function deleteAccount(AccountId $accountId): void { if ($body) { $parsedBody = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { - $this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); + $this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body); $message = $this->l10n->t('Something unexpected happened.'); throw new HostedSignalingServerAPIException($message, $status); diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 12b26f49540..b53327e94c3 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -176,7 +176,7 @@ private function addShareToDB( string $target, int $permissions, string $token, - ?\DateTime $expirationDate + ?\DateTime $expirationDate, ): int { $insert = $this->dbConnection->getQueryBuilder(); $insert->insert('share') diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 213259bc820..4ed02f1f0fc 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -1778,7 +1778,7 @@ public function userRenamesRoom(string $user, string $identifier, string $newNam public function userSetsDescriptionForRoomTo(string $user, string $identifier, string $description, int $statusCode, string $apiVersion): void { $this->setCurrentUser($user); $this->sendRequest( - 'PUT', '/apps/spreed/api/' .$apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/description', + 'PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/description', new TableNode([['description', $description]]) ); $this->assertStatusCode($this->response, $statusCode); @@ -4239,7 +4239,7 @@ private function assertReactionList(?TableNode $formData): void { */ public function userSetTheMessageExpirationToXWithStatusCode(string $user, int $messageExpiration, string $identifier, int $statusCode, string $apiVersion = 'v4'): void { $this->setCurrentUser($user); - $this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/message-expiration', [ + $this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/message-expiration', [ 'seconds' => $messageExpiration, ]); $this->assertStatusCode($this->response, $statusCode); @@ -4250,7 +4250,7 @@ public function userSetTheMessageExpirationToXWithStatusCode(string $user, int $ */ public function userSetsTheRecordingConsentToXWithStatusCode(string $user, int $recordingConsent, string $identifier, int $statusCode, string $apiVersion = 'v4'): void { $this->setCurrentUser($user); - $this->sendRequest('PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/recording-consent', [ + $this->sendRequest('PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/recording-consent', [ 'recordingConsent' => $recordingConsent, ]); $this->assertStatusCode($this->response, $statusCode); @@ -4627,7 +4627,7 @@ public function setupOrRemoveBotViaOCSAPI(string $user, string $action, string $ $this->sendRequest( $action === 'sets up' ? 'POST' : 'DELETE', - '/apps/spreed/api/' . $apiVersion . '/bot/' . self::$identifierToToken[$identifier] . '/' .self::$botNameToId[$botName] + '/apps/spreed/api/' . $apiVersion . '/bot/' . self::$identifierToToken[$identifier] . '/' . self::$botNameToId[$botName] ); $this->assertStatusCode($this->response, $status); } diff --git a/tests/php/Collaboration/Collaborators/RoomPluginTest.php b/tests/php/Collaboration/Collaborators/RoomPluginTest.php index 919f628be6c..d1631ff04b7 100644 --- a/tests/php/Collaboration/Collaborators/RoomPluginTest.php +++ b/tests/php/Collaboration/Collaborators/RoomPluginTest.php @@ -222,7 +222,7 @@ public function testSearch( array $roomsForParticipant, array $expectedMatchesExact, array $expectedMatches, - bool $expectedHasMoreResults + bool $expectedHasMoreResults, ) { $rooms = []; foreach ($roomsForParticipant as $roomData) {