From 66afa6e2f685cf8468212548d5dfd47abafced0c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2024 14:07:29 +0200 Subject: [PATCH 1/5] chore: Update coding-standard Signed-off-by: Joas Schilling --- vendor-bin/csfixer/composer.json | 4 ++-- vendor-bin/csfixer/composer.lock | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/vendor-bin/csfixer/composer.json b/vendor-bin/csfixer/composer.json index 7ffc496b411..e6306c1cabc 100644 --- a/vendor-bin/csfixer/composer.json +++ b/vendor-bin/csfixer/composer.json @@ -6,7 +6,7 @@ "sort-packages": true }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.16", - "nextcloud/coding-standard": "^1.1" + "friendsofphp/php-cs-fixer": "^3.62.0", + "nextcloud/coding-standard": "^1.2.3" } } diff --git a/vendor-bin/csfixer/composer.lock b/vendor-bin/csfixer/composer.lock index 566d581191b..43265d0e4a2 100644 --- a/vendor-bin/csfixer/composer.lock +++ b/vendor-bin/csfixer/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "110b22818a58987d5b1d00e2283302a9", + "content-hash": "9a57fd35912e7c5840b35d324996fd6d", "packages": [], "packages-dev": [ { "name": "nextcloud/coding-standard", - "version": "v1.2.1", + "version": "v1.2.3", "source": { "type": "git", "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e" + "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", - "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/bc9c53a5306114b60c4363057aff9c2ed10a54da", + "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da", "shasum": "" }, "require": { @@ -44,22 +44,22 @@ "description": "Nextcloud coding standards for the php cs fixer", "support": { "issues": "https://github.com/nextcloud/coding-standard/issues", - "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.3" }, - "time": "2024-02-01T14:54:37+00:00" + "time": "2024-08-23T14:32:32+00:00" }, { "name": "php-cs-fixer/shim", - "version": "v3.59.3", + "version": "v3.62.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/shim.git", - "reference": "c855876e64de3431bc9279f27af7be40d11d7613" + "reference": "7a91d5ce45c486f5b445d95901228507a02f60ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/c855876e64de3431bc9279f27af7be40d11d7613", - "reference": "c855876e64de3431bc9279f27af7be40d11d7613", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/7a91d5ce45c486f5b445d95901228507a02f60ae", + "reference": "7a91d5ce45c486f5b445d95901228507a02f60ae", "shasum": "" }, "require": { @@ -96,9 +96,9 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/PHP-CS-Fixer/shim/issues", - "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.62.0" }, - "time": "2024-06-16T14:17:34+00:00" + "time": "2024-08-07T17:03:46+00:00" } ], "aliases": [], From 610aa0f42442a552f106d2fa1ce98086565eb4c7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2024 15:27:33 +0200 Subject: [PATCH 2/5] fix: Add new line before status code for better formatting Signed-off-by: Joas Schilling --- lib/Controller/PublicShareAuthController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php index baa5de1dd0e..f40882b1915 100644 --- a/lib/Controller/PublicShareAuthController.php +++ b/lib/Controller/PublicShareAuthController.php @@ -50,6 +50,7 @@ public function __construct( * * @param string $shareToken Token of the file share * @return DataResponse|DataResponse, array{}> + * * 201: Room created successfully * 404: Share not found */ From 956a1ab00ffb25d87c0f5192333c9b66e56a63fe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2024 14:09:23 +0200 Subject: [PATCH 3/5] chore(php): Auto-fixes of coding standards Signed-off-by: Joas Schilling --- lib/Activity/Provider/Call.php | 4 +- lib/Activity/Provider/Invitation.php | 4 +- lib/BackgroundJob/CheckCertificates.php | 4 +- lib/BackgroundJob/RemoveEmptyRooms.php | 2 +- lib/Capabilities.php | 2 +- lib/Chat/AutoComplete/SearchPlugin.php | 4 +- lib/Chat/Changelog/Manager.php | 4 +- lib/Chat/ChatManager.php | 66 ++++++------- lib/Chat/CommentsManager.php | 6 +- lib/Chat/Notifier.php | 2 +- lib/Chat/Parser/SystemMessage.php | 28 +++--- lib/Chat/ReactionManager.php | 12 +-- lib/Chat/SystemMessage/Listener.php | 6 +- .../Reference/TalkReferenceProvider.php | 6 +- lib/Command/Bot/Remove.php | 2 +- lib/Command/Bot/Setup.php | 2 +- lib/Command/Bot/Uninstall.php | 2 +- lib/Command/Developer/AgeChatMessages.php | 2 +- lib/Command/Monitor/Calls.php | 4 +- lib/Command/Monitor/HasActiveCalls.php | 4 +- lib/Command/Monitor/Room.php | 8 +- lib/Command/Room/Create.php | 2 +- lib/Command/Room/TRoomCommand.php | 18 ++-- lib/Command/Room/Update.php | 2 +- lib/Config.php | 16 ++-- lib/Controller/BotController.php | 6 +- lib/Controller/CallController.php | 8 +- lib/Controller/ChatController.php | 46 +++++----- lib/Controller/FilesIntegrationController.php | 10 +- lib/Controller/PageController.php | 4 +- lib/Controller/ReactionController.php | 8 +- lib/Controller/RecordingController.php | 2 +- lib/Controller/RoomController.php | 10 +- lib/Controller/SettingsController.php | 6 +- lib/Controller/SignalingController.php | 4 +- lib/Federation/Authenticator.php | 2 +- lib/Federation/BackendNotifier.php | 28 +++--- .../CloudFederationProviderTalk.php | 24 ++--- lib/Federation/FederationManager.php | 2 +- .../TalkV1/Controller/AvatarController.php | 4 +- .../TalkV1/Controller/CallController.php | 6 +- .../TalkV1/Controller/ChatController.php | 28 +++--- .../TalkV1/Controller/RoomController.php | 4 +- .../Notifier/CancelRetryOCMListener.php | 2 +- .../TalkV1/Notifier/MessageSentListener.php | 4 +- lib/Files/Util.php | 6 +- lib/Listener/DisplayNameListener.php | 4 +- lib/Manager.php | 58 ++++++------ lib/MatterbridgeManager.php | 20 ++-- lib/Middleware/CanUseTalkMiddleware.php | 2 +- lib/Middleware/InjectionMiddleware.php | 2 +- lib/Migration/ClearResourceAccessCache.php | 4 +- .../Version10000Date20201015134000.php | 12 +-- .../Version14000Date20220330141647.php | 8 +- .../Version2000Date20171026140256.php | 2 +- .../Version2000Date20171026140257.php | 4 +- .../Version2001Date20170707115443.php | 6 +- .../Version2001Date20171026134605.php | 40 ++++---- .../Version7000Date20190724121136.php | 4 +- .../Version7000Date20190724121137.php | 4 +- lib/Model/AttachmentMapper.php | 14 +-- lib/Model/Attendee.php | 2 +- lib/Model/AttendeeMapper.php | 38 ++++---- lib/Model/InvitationMapper.php | 4 +- lib/Model/Message.php | 6 +- lib/Model/SessionMapper.php | 8 +- lib/Notification/Notifier.php | 10 +- lib/Participant.php | 2 +- lib/Recording/BackendNotifier.php | 2 +- lib/Room.php | 12 +-- lib/Search/MessageSearch.php | 6 +- lib/Service/AttachmentService.php | 2 +- lib/Service/BotService.php | 2 +- lib/Service/BreakoutRoomService.php | 6 +- lib/Service/HostedSignalingServerService.php | 2 +- lib/Service/NoteToSelfService.php | 4 +- lib/Service/ParticipantService.php | 28 +++--- lib/Service/RoomFormatter.php | 2 +- lib/Service/RoomService.php | 32 +++---- lib/Service/SIPDialOutService.php | 8 +- lib/Settings/Admin/AdminSettings.php | 14 +-- lib/Settings/Admin/Section.php | 4 +- lib/Settings/Personal.php | 4 +- lib/Share/RoomShareProvider.php | 8 +- lib/Signaling/BackendNotifier.php | 2 +- lib/TInitialState.php | 2 +- templates/authenticate.php | 4 +- .../features/bootstrap/FeatureContext.php | 92 +++++++++---------- .../features/bootstrap/RecordingTrait.php | 2 +- .../features/bootstrap/SharingContext.php | 4 +- .../lib/Controller/ApiController.php | 2 +- tests/php/CapabilitiesTest.php | 4 +- tests/php/Chat/ChatManagerTest.php | 6 +- tests/php/Chat/NotifierTest.php | 2 +- tests/php/Chat/Parser/SystemMessageTest.php | 2 +- tests/php/ConfigTest.php | 2 +- tests/stubs/oc_comments_manager.php | 2 +- 97 files changed, 471 insertions(+), 471 deletions(-) diff --git a/lib/Activity/Provider/Call.php b/lib/Activity/Provider/Call.php index 6dbf121046a..e46b6322645 100644 --- a/lib/Activity/Provider/Call.php +++ b/lib/Activity/Provider/Call.php @@ -31,13 +31,13 @@ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): $parameters = $event->getSubjectParameters(); try { - $room = $this->manager->getRoomForUser((int) $parameters['room'], $this->activityManager->getCurrentUserId()); + $room = $this->manager->getRoomForUser((int)$parameters['room'], $this->activityManager->getCurrentUserId()); } catch (RoomNotFoundException) { $room = null; } $result = $this->parseCall($room, $event, $l); - $result['subject'] .= ' ' . $this->getDuration($l, (int) $parameters['duration']); + $result['subject'] .= ' ' . $this->getDuration($l, (int)$parameters['duration']); // $result['params']['call'] = $roomParameter; $this->setSubjects($event, $result['subject'], $result['params']); } else { diff --git a/lib/Activity/Provider/Invitation.php b/lib/Activity/Provider/Invitation.php index 585f4fdb016..9a22e38d66f 100644 --- a/lib/Activity/Provider/Invitation.php +++ b/lib/Activity/Provider/Invitation.php @@ -28,9 +28,9 @@ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): $l = $this->languageFactory->get('spreed', $language); $parameters = $event->getSubjectParameters(); - $roomParameter = $this->getFormerRoom($l, (int) $parameters['room']); + $roomParameter = $this->getFormerRoom($l, (int)$parameters['room']); try { - $room = $this->manager->getRoomById((int) $parameters['room']); + $room = $this->manager->getRoomById((int)$parameters['room']); $roomParameter = $this->getRoom($room, $event->getAffectedUser()); } catch (RoomNotFoundException $e) { } diff --git a/lib/BackgroundJob/CheckCertificates.php b/lib/BackgroundJob/CheckCertificates.php index cf657b55b58..e56728029ae 100644 --- a/lib/BackgroundJob/CheckCertificates.php +++ b/lib/BackgroundJob/CheckCertificates.php @@ -118,7 +118,7 @@ protected function run($argument): void { $signalingServers = $this->talkConfig->getSignalingServers(); foreach ($signalingServers as $signalingServer) { - if ((bool) $signalingServer['verify']) { + if ((bool)$signalingServer['verify']) { $this->checkServerCertificate($signalingServer['server']); } } @@ -126,7 +126,7 @@ protected function run($argument): void { $recordingServers = $this->talkConfig->getRecordingServers(); foreach ($recordingServers as $recordingServer) { - if ((bool) $recordingServer['verify']) { + if ((bool)$recordingServer['verify']) { $this->checkServerCertificate($recordingServer['server']); } } diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php index d985da9aeb8..04a05bd0820 100644 --- a/lib/BackgroundJob/RemoveEmptyRooms.php +++ b/lib/BackgroundJob/RemoveEmptyRooms.php @@ -90,7 +90,7 @@ private function deleteIfFileIsRemoved(Room $room): bool { return false; } - $mountsForFile = $this->userMountCache->getMountsForFileId((int) $room->getObjectId()); + $mountsForFile = $this->userMountCache->getMountsForFileId((int)$room->getObjectId()); if (!empty($mountsForFile)) { return false; } diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 86c9577c378..8fb7cdc7f44 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -184,7 +184,7 @@ public function getCapabilities(): array { // 'folder' => string, ], 'call' => [ - 'enabled' => ((int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE, + 'enabled' => ((int)$this->serverConfig->getAppValue('spreed', 'start_calls', (string)Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE, 'breakout-rooms' => $this->talkConfig->isBreakoutRoomsEnabled(), 'recording' => $this->talkConfig->isRecordingEnabled(), 'recording-consent' => $this->talkConfig->recordingConsentRequired(), diff --git a/lib/Chat/AutoComplete/SearchPlugin.php b/lib/Chat/AutoComplete/SearchPlugin.php index e8099412100..26c5401f661 100644 --- a/lib/Chat/AutoComplete/SearchPlugin.php +++ b/lib/Chat/AutoComplete/SearchPlugin.php @@ -110,7 +110,7 @@ protected function searchUsers(string $search, array $users, ISearchResult $sear $matches = $exactMatches = []; foreach ($users as $userId => $displayName) { - $userId = (string) $userId; + $userId = (string)$userId; if ($this->userId !== '' && $this->userId === $userId) { // Do not suggest the current user continue; @@ -219,7 +219,7 @@ protected function searchGroups(string $search, array $groups, ISearchResult $se continue; } - $groupId = (string) $groupId; + $groupId = (string)$groupId; if ($searchResult->hasResult($type, $groupId)) { continue; } diff --git a/lib/Chat/Changelog/Manager.php b/lib/Chat/Changelog/Manager.php index a6bcf5a594a..6c3c2a9657c 100644 --- a/lib/Chat/Changelog/Manager.php +++ b/lib/Chat/Changelog/Manager.php @@ -29,7 +29,7 @@ public function __construct( } public function getChangelogForUser(string $userId): int { - return (int) $this->config->getUserValue($userId, 'spreed', 'changelog', '0'); + return (int)$this->config->getUserValue($userId, 'spreed', 'changelog', '0'); } public function userHasNewChangelog(string $userId): bool { @@ -43,7 +43,7 @@ public function updateChangelog(string $userId): void { $hasReceivedLog = $this->getChangelogForUser($userId); try { - $this->config->setUserValue($userId, 'spreed', 'changelog', (string) count($logs), (string) $hasReceivedLog); + $this->config->setUserValue($userId, 'spreed', 'changelog', (string)count($logs), (string)$hasReceivedLog); } catch (PreConditionNotMetException $e) { // Parallel request won the race return; diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index fea3bcdff05..9843720dd65 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -109,10 +109,10 @@ public function __construct( * Sends a new message to the given chat. * * @param bool $shouldSkipLastMessageUpdate If multiple messages will be posted - * (e.g. when adding multiple users to a room) we can skip the last - * message and last activity update until the last entry was created - * and then update with those values. - * This will replace O(n) with 1 database update. + * (e.g. when adding multiple users to a room) we can skip the last + * message and last activity update until the last entry was created + * and then update with those values. + * This will replace O(n) with 1 database update. * @throws MessagingNotAllowedException */ public function addSystemMessage( @@ -133,7 +133,7 @@ public function addSystemMessage( throw $e; } - $comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string) $chat->getId()); + $comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string)$chat->getId()); $comment->setMessage($message, self::MAX_CHAT_LENGTH); $comment->setCreationDateTime($creationDateTime); if ($referenceId !== null) { @@ -200,10 +200,10 @@ public function addSystemMessage( $alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $captionComment ?? $comment, $alreadyNotifiedUsers, $silent); if (!empty($alreadyNotifiedUsers)) { $userIds = array_column($alreadyNotifiedUsers, 'id'); - $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int) $comment->getId(), $usersDirectlyMentioned); + $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int)$comment->getId(), $usersDirectlyMentioned); } if (!empty($federatedUsersDirectlyMentioned)) { - $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int) $comment->getId(), $federatedUsersDirectlyMentioned); + $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int)$comment->getId(), $federatedUsersDirectlyMentioned); } $this->notifier->notifyOtherParticipant($chat, $comment, [], $silent); @@ -214,7 +214,7 @@ public function addSystemMessage( // e.g. sharing an item to the chat try { $participant = $this->participantService->getParticipantByActor($chat, $actorType, $actorId); - $this->participantService->updateLastReadMessage($participant, (int) $comment->getId()); + $this->participantService->updateLastReadMessage($participant, (int)$comment->getId()); } catch (ParticipantNotFoundException) { // Participant not found => No read-marker update needed } @@ -245,7 +245,7 @@ public function addSystemMessage( * @return IComment */ public function addChangelogMessage(Room $chat, string $message): IComment { - $comment = $this->commentsManager->create(Attendee::ACTOR_GUESTS, Attendee::ACTOR_ID_CHANGELOG, 'chat', (string) $chat->getId()); + $comment = $this->commentsManager->create(Attendee::ACTOR_GUESTS, Attendee::ACTOR_ID_CHANGELOG, 'chat', (string)$chat->getId()); $comment->setMessage($message, self::MAX_CHAT_LENGTH); $comment->setCreationDateTime($this->timeFactory->getDateTime()); @@ -294,7 +294,7 @@ public function sendMessage( throw $e; } - $comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string) $chat->getId()); + $comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string)$chat->getId()); $comment->setMessage($message, self::MAX_CHAT_LENGTH); $comment->setCreationDateTime($creationDateTime); // A verb ('comment', 'like'...) must be provided to be able to save a @@ -340,7 +340,7 @@ public function sendMessage( $this->commentsManager->save($comment); if ($participant instanceof Participant) { - $this->participantService->updateLastReadMessage($participant, (int) $comment->getId()); + $this->participantService->updateLastReadMessage($participant, (int)$comment->getId()); } // Update last_message @@ -368,10 +368,10 @@ public function sendMessage( $alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $comment, $alreadyNotifiedUsers, $silent, $participant); if (!empty($alreadyNotifiedUsers)) { $userIds = array_column($alreadyNotifiedUsers, 'id'); - $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int) $comment->getId(), $usersDirectlyMentioned); + $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int)$comment->getId(), $usersDirectlyMentioned); } if (!empty($federatedUsersDirectlyMentioned)) { - $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int) $comment->getId(), $federatedUsersDirectlyMentioned); + $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int)$comment->getId(), $federatedUsersDirectlyMentioned); } // User was not mentioned, send a normal notification @@ -460,7 +460,7 @@ public function removePollOnMessageDelete(Room $room, Participant $participant, ], ], JSON_THROW_ON_ERROR), 'chat', - [(string) $room->getId()], + [(string)$room->getId()], 'system', 0 ); @@ -517,7 +517,7 @@ public function deleteMessage(Room $chat, IComment $comment, Participant $partic $this->commentsManager->save($comment); - $this->attachmentService->deleteAttachmentByMessageId((int) $comment->getId()); + $this->attachmentService->deleteAttachmentByMessageId((int)$comment->getId()); $this->referenceManager->invalidateCache($chat->getToken()); @@ -602,10 +602,10 @@ public function editMessage(Room $chat, IComment $comment, Participant $particip $alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $comment, $usersToNotifyBefore, silent: false); if (!empty($alreadyNotifiedUsers)) { $userIds = array_column($alreadyNotifiedUsers, 'id'); - $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int) $comment->getId(), $addedUsersDirectMentioned); + $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int)$comment->getId(), $addedUsersDirectMentioned); } if (!empty($federatedUsersDirectlyMentionedAfter)) { - $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentionedAfter, (int) $comment->getId(), $federatedUsersDirectlyMentionedAfter); + $this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentionedAfter, (int)$comment->getId(), $federatedUsersDirectlyMentionedAfter); } } } @@ -631,7 +631,7 @@ protected static function compareMention(array $mention1, array $mention2): int } public function clearHistory(Room $chat, string $actorType, string $actorId): IComment { - $this->commentsManager->deleteCommentsAtObject('chat', (string) $chat->getId()); + $this->commentsManager->deleteCommentsAtObject('chat', (string)$chat->getId()); $this->shareProvider->deleteInRoom($chat->getToken()); @@ -660,7 +660,7 @@ public function clearHistory(Room $chat, string $actorType, string $actorId): IC public function getParentComment(Room $chat, string $parentId): IComment { $comment = $this->commentsManager->get($parentId); - if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string) $chat->getId()) { + if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string)$chat->getId()) { throw new NotFoundException('Parent not found in the right context'); } @@ -680,7 +680,7 @@ public function getComment(Room $chat, string $messageId): IComment { $comment = $this->commentsManager->get($messageId); - if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string) $chat->getId()) { + if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string)$chat->getId()) { throw new NotFoundException('Message not found in the right context'); } @@ -688,12 +688,12 @@ public function getComment(Room $chat, string $messageId): IComment { } public function getLastReadMessageFromLegacy(Room $chat, IUser $user): int { - $marker = $this->commentsManager->getReadMark('chat', (string) $chat->getId(), $user); + $marker = $this->commentsManager->getReadMark('chat', (string)$chat->getId(), $user); if ($marker === null) { return 0; } - return $this->commentsManager->getLastCommentBeforeDate('chat', (string) $chat->getId(), $marker, self::VERB_MESSAGE); + return $this->commentsManager->getLastCommentBeforeDate('chat', (string)$chat->getId(), $marker, self::VERB_MESSAGE); } public function getUnreadCount(Room $chat, int $lastReadMessage): int { @@ -705,7 +705,7 @@ public function getUnreadCount(Room $chat, int $lastReadMessage): int { $key = $chat->getId() . '-' . $lastReadMessage; $unreadCount = $this->unreadCountCache->get($key); if ($unreadCount === null) { - $unreadCount = $this->commentsManager->getNumberOfCommentsWithVerbsForObjectSinceComment('chat', (string) $chat->getId(), $lastReadMessage, [self::VERB_MESSAGE, 'object_shared']); + $unreadCount = $this->commentsManager->getNumberOfCommentsWithVerbsForObjectSinceComment('chat', (string)$chat->getId(), $lastReadMessage, [self::VERB_MESSAGE, 'object_shared']); $this->unreadCountCache->set($key, $unreadCount, 1800); } return $unreadCount; @@ -730,11 +730,11 @@ public function getLastCommonReadMessage(Room $chat): int { * @param int $limit * @param bool $includeLastKnown * @return IComment[] the messages found (only the id, actor type and id, - * creation date and message are relevant), or an empty array if the - * timeout expired. + * creation date and message are relevant), or an empty array if the + * timeout expired. */ public function getHistory(Room $chat, int $offset, int $limit, bool $includeLastKnown): array { - return $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'desc', $limit, $includeLastKnown); + return $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'desc', $limit, $includeLastKnown); } /** @@ -748,7 +748,7 @@ public function getHistory(Room $chat, int $offset, int $limit, bool $includeLas public function getPreviousMessageWithVerb(Room $chat, int $offset, array $verbs, bool $offsetIsVerbMatch): IComment { $messages = $this->commentsManager->getCommentsWithVerbForObjectSinceComment( 'chat', - (string) $chat->getId(), + (string)$chat->getId(), $verbs, $offset, 'desc', @@ -780,8 +780,8 @@ public function getPreviousMessageWithVerb(Room $chat, int $offset, array $verbs * @param bool $includeLastKnown * @param bool $markNotificationsAsRead (defaults to true) * @return IComment[] the messages found (only the id, actor type and id, - * creation date and message are relevant), or an empty array if the - * timeout expired. + * creation date and message are relevant), or an empty array if the + * timeout expired. */ public function waitForNewMessages(Room $chat, int $offset, int $limit, int $timeout, ?IUser $user, bool $includeLastKnown, bool $markNotificationsAsRead = true): array { if ($markNotificationsAsRead && $user instanceof IUser) { @@ -839,7 +839,7 @@ protected function checkCacheOrDatabase(Room $chat, int $offset, int $limit, boo } // Load data from the database - $comments = $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'asc', $limit, $includeLastKnown); + $comments = $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'asc', $limit, $includeLastKnown); if (empty($comments)) { // We only write the cache when there were no new comments, @@ -865,13 +865,13 @@ protected function checkCacheOrDatabase(Room $chat, int $offset, int $limit, boo protected function waitForNewMessagesWithDatabase(Room $chat, int $offset, int $limit, int $timeout, bool $includeLastKnown): array { $elapsedTime = 0; - $comments = $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'asc', $limit, $includeLastKnown); + $comments = $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'asc', $limit, $includeLastKnown); while (empty($comments) && $elapsedTime < $timeout) { sleep(1); $elapsedTime++; - $comments = $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'asc', $limit, $includeLastKnown); + $comments = $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'asc', $limit, $includeLastKnown); } return $comments; @@ -883,7 +883,7 @@ protected function waitForNewMessagesWithDatabase(Room $chat, int $offset, int $ * @param Room $chat */ public function deleteMessages(Room $chat): void { - $this->commentsManager->deleteCommentsAtObject('chat', (string) $chat->getId()); + $this->commentsManager->deleteCommentsAtObject('chat', (string)$chat->getId()); $this->shareProvider->deleteInRoom($chat->getToken()); diff --git a/lib/Chat/CommentsManager.php b/lib/Chat/CommentsManager.php index 02266cc85fa..a573147ef77 100644 --- a/lib/Chat/CommentsManager.php +++ b/lib/Chat/CommentsManager.php @@ -43,7 +43,7 @@ public function getCommentsById(array $ids): array { $comments = []; $result = $query->execute(); while ($row = $result->fetch()) { - $comments[(int) $row['id']] = $this->getCommentFromData($row); + $comments[(int)$row['id']] = $this->getCommentFromData($row); } $result->closeCursor(); @@ -70,8 +70,8 @@ public function retrieveReactionsByActor(string $actorType, string $actorId, arr $reactions = []; $result = $query->executeQuery(); while ($row = $result->fetch()) { - $reactions[(int) $row['parent_id']] ??= []; - $reactions[(int) $row['parent_id']][] = $row['reaction']; + $reactions[(int)$row['parent_id']] ??= []; + $reactions[(int)$row['parent_id']][] = $row['reaction']; } $result->closeCursor(); diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php index f32d2dc97c9..653efb57205 100644 --- a/lib/Chat/Notifier.php +++ b/lib/Chat/Notifier.php @@ -555,7 +555,7 @@ private function createNotification(Room $chat, IComment $comment, string $subje } protected function getDefaultGroupNotification(): int { - return (int) $this->config->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_MENTION); + return (int)$this->config->getAppValue('spreed', 'default_group_notification', (string)Participant::NOTIFY_MENTION); } /** diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 078a626b24c..d6e2204c72e 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -524,7 +524,7 @@ protected function parseMessage(Message $chatMessage): void { } } elseif ($message === 'object_shared') { $parsedParameters['object'] = $parameters['metaData']; - $parsedParameters['object']['id'] = (string) $parsedParameters['object']['id']; + $parsedParameters['object']['id'] = (string)$parsedParameters['object']['id']; $parsedMessage = '{object}'; if (isset($parsedParameters['object']['type']) @@ -576,10 +576,10 @@ protected function parseMessage(Message $chatMessage): void { $parsedMessage = $this->l->t('You deleted a reaction'); } } elseif ($message === 'message_expiration_enabled') { - $weeks = $parameters['seconds'] >= (86400 * 7) ? (int) round($parameters['seconds'] / (86400 * 7)) : 0; - $days = $parameters['seconds'] >= 86400 ? (int) round($parameters['seconds'] / 86400) : 0; - $hours = $parameters['seconds'] >= 3600 ? (int) round($parameters['seconds'] / 3600) : 0; - $minutes = (int) round($parameters['seconds'] / 60); + $weeks = $parameters['seconds'] >= (86400 * 7) ? (int)round($parameters['seconds'] / (86400 * 7)) : 0; + $days = $parameters['seconds'] >= 86400 ? (int)round($parameters['seconds'] / 86400) : 0; + $hours = $parameters['seconds'] >= 3600 ? (int)round($parameters['seconds'] / 3600) : 0; + $minutes = (int)round($parameters['seconds'] / 60); if ($currentUserIsActor) { if ($weeks > 0) { @@ -624,7 +624,7 @@ protected function parseMessage(Message $chatMessage): void { } } elseif ($message === 'poll_closed') { $parsedParameters['poll'] = $parameters['poll']; - $parsedParameters['poll']['id'] = (string) $parsedParameters['poll']['id']; + $parsedParameters['poll']['id'] = (string)$parsedParameters['poll']['id']; $parsedMessage = $this->l->t('{actor} ended the poll {poll}'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You ended the poll {poll}'); @@ -653,7 +653,7 @@ protected function parseMessage(Message $chatMessage): void { $parsedMessage = $this->l->t('The recording failed'); } elseif ($message === 'poll_voted') { $parsedParameters['poll'] = $parameters['poll']; - $parsedParameters['poll']['id'] = (string) $parsedParameters['poll']['id']; + $parsedParameters['poll']['id'] = (string)$parsedParameters['poll']['id']; $parsedMessage = $this->l->t('Someone voted on the poll {poll}'); unset($parsedParameters['actor']); @@ -738,7 +738,7 @@ protected function parseDeletedMessage(Message $chatMessage): void { * @throws ShareNotFound */ protected function getFileFromShare(Room $room, ?Participant $participant, string $shareId): array { - $share = $this->shareProvider->getShareById((int) $shareId); + $share = $this->shareProvider->getShareById((int)$shareId); if ($participant && $participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS) { if ($share->getShareOwner() !== $participant->getAttendee()->getActorId()) { @@ -800,13 +800,13 @@ protected function getFileFromShare(Room $room, ?Participant $participant, strin $data = [ 'type' => 'file', - 'id' => (string) $fileId, + 'id' => (string)$fileId, 'name' => $name, - 'size' => (string) $size, + 'size' => (string)$size, 'path' => $path, 'link' => $url, 'etag' => $node->getEtag(), - 'permissions' => (string) $node->getPermissions(), + 'permissions' => (string)$node->getPermissions(), 'mimetype' => $node->getMimeType(), 'preview-available' => $isPreviewAvailable ? 'yes' : 'no', ]; @@ -816,8 +816,8 @@ protected function getFileFromShare(Room $room, ?Participant $participant, strin try { $sizeMetadata = $this->metadataCache->getImageMetadataForFileId($fileId); if (isset($sizeMetadata['width'], $sizeMetadata['height'])) { - $data['width'] = (string) $sizeMetadata['width']; - $data['height'] = (string) $sizeMetadata['height']; + $data['width'] = (string)$sizeMetadata['width']; + $data['height'] = (string)$sizeMetadata['height']; } if (isset($sizeMetadata['blurhash'])) { @@ -832,7 +832,7 @@ protected function getFileFromShare(Room $room, ?Participant $participant, strin $vObject = Reader::read($vCard); if (!empty($vObject->FN)) { - $data['contact-name'] = (string) $vObject->FN; + $data['contact-name'] = (string)$vObject->FN; } $photo = $this->photoCache->getPhotoFromVObject($vObject); diff --git a/lib/Chat/ReactionManager.php b/lib/Chat/ReactionManager.php index 9c14c1d639f..11a0efe3e1b 100644 --- a/lib/Chat/ReactionManager.php +++ b/lib/Chat/ReactionManager.php @@ -50,11 +50,11 @@ public function __construct( * @throws ReactionOutOfContextException */ public function addReactionMessage(Room $chat, string $actorType, string $actorId, int $messageId, string $reaction): IComment { - $parentMessage = $this->getCommentToReact($chat, (string) $messageId); + $parentMessage = $this->getCommentToReact($chat, (string)$messageId); try { // Check if the user already reacted with the same reaction $this->commentsManager->getReactionComment( - (int) $parentMessage->getId(), + (int)$parentMessage->getId(), $actorType, $actorId, $reaction @@ -67,7 +67,7 @@ public function addReactionMessage(Room $chat, string $actorType, string $actorI $actorType, $actorId, 'chat', - (string) $chat->getId() + (string)$chat->getId() ); $comment->setParentId($parentMessage->getId()); $comment->setMessage($reaction); @@ -93,7 +93,7 @@ public function addReactionMessage(Room $chat, string $actorType, string $actorI */ public function deleteReactionMessage(Room $chat, string $actorType, string $actorId, int $messageId, string $reaction): IComment { // Just to verify that messageId is part of the room and throw error if not. - $parentComment = $this->getCommentToReact($chat, (string) $messageId); + $parentComment = $this->getCommentToReact($chat, (string)$messageId); $comment = $this->commentsManager->getReactionComment( $messageId, @@ -115,7 +115,7 @@ public function deleteReactionMessage(Room $chat, string $actorType, string $act $chat, $actorType, $actorId, - json_encode(['message' => 'reaction_revoked', 'parameters' => ['message' => (int) $comment->getId()]]), + json_encode(['message' => 'reaction_revoked', 'parameters' => ['message' => (int)$comment->getId()]]), $this->timeFactory->getDateTime(), false, null, @@ -181,7 +181,7 @@ public function getCommentToReact(Room $chat, string $messageId): IComment { $comment = $this->commentsManager->get($messageId); if ($comment->getObjectType() !== 'chat' - || $comment->getObjectId() !== (string) $chat->getId() + || $comment->getObjectId() !== (string)$chat->getId() || !in_array($comment->getVerb(), [ ChatManager::VERB_MESSAGE, ChatManager::VERB_OBJECT_SHARED, diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php index bbfa7a73d46..702ab950ac5 100644 --- a/lib/Chat/SystemMessage/Listener.php +++ b/lib/Chat/SystemMessage/Listener.php @@ -382,7 +382,7 @@ protected function fixMimeTypeOfVoiceMessage(ShareCreatedEvent|BeforeDuplicateSh } if (isset($metaData[Message::METADATA_SILENT])) { - $silent = (bool) $metaData[Message::METADATA_SILENT]; + $silent = (bool)$metaData[Message::METADATA_SILENT]; } else { $silent = false; } @@ -454,14 +454,14 @@ protected function sendSystemMessage(Room $room, string $message, array $paramet // the system message left for the share in the chat. $referenceId = $this->request->getParam('referenceId', null); if ($referenceId !== null) { - $referenceId = (string) $referenceId; + $referenceId = (string)$referenceId; } $parent = null; $replyTo = $parameters['metaData']['replyTo'] ?? null; if ($replyTo !== null) { try { - $parentComment = $this->chatManager->getParentComment($room, (string) $replyTo); + $parentComment = $this->chatManager->getParentComment($room, (string)$replyTo); $parentMessage = $this->messageParser->createMessage($room, $participant, $parentComment, $this->l); $this->messageParser->parseMessage($parentMessage); if ($parentMessage->isReplyable()) { diff --git a/lib/Collaboration/Reference/TalkReferenceProvider.php b/lib/Collaboration/Reference/TalkReferenceProvider.php index 7ed415a7e1f..d1710720214 100644 --- a/lib/Collaboration/Reference/TalkReferenceProvider.php +++ b/lib/Collaboration/Reference/TalkReferenceProvider.php @@ -93,7 +93,7 @@ protected function getTalkAppLinkToken(string $referenceText): ?array { if ($hashPosition !== false) { $afterHash = substr($urlOfInterest, $hashPosition + 1); if (preg_match('/^message_(\d+)$/', $afterHash, $matches)) { - $messageId = (int) $matches[1]; + $messageId = (int)$matches[1]; } } @@ -163,7 +163,7 @@ protected function fetchReference(Reference $reference): void { * Description is the plain text chat message */ if ($participant && !empty($referenceMatch['message'])) { - $messageId = (string) $referenceMatch['message']; + $messageId = (string)$referenceMatch['message']; if (!$room->isFederatedConversation()) { try { $comment = $this->chatManager->getComment($room, $messageId); @@ -174,7 +174,7 @@ protected function fetchReference(Reference $reference): void { $this->messageParser->parseMessage($message); } else { try { - $proxy = $this->proxyCacheMessageMapper->findById($room, (int) $messageId); + $proxy = $this->proxyCacheMessageMapper->findById($room, (int)$messageId); if ($proxy->getLocalToken() !== $room->getToken()) { throw new RoomNotFoundException(); } diff --git a/lib/Command/Bot/Remove.php b/lib/Command/Bot/Remove.php index 137ba49e34e..0fff1facdc2 100644 --- a/lib/Command/Bot/Remove.php +++ b/lib/Command/Bot/Remove.php @@ -49,7 +49,7 @@ protected function configure(): void { } protected function execute(InputInterface $input, OutputInterface $output): int { - $botId = (int) $input->getArgument('bot-id'); + $botId = (int)$input->getArgument('bot-id'); $tokens = $input->getArgument('token'); try { diff --git a/lib/Command/Bot/Setup.php b/lib/Command/Bot/Setup.php index bb66955f569..e45cfd06de3 100644 --- a/lib/Command/Bot/Setup.php +++ b/lib/Command/Bot/Setup.php @@ -52,7 +52,7 @@ protected function configure(): void { } protected function execute(InputInterface $input, OutputInterface $output): int { - $botId = (int) $input->getArgument('bot-id'); + $botId = (int)$input->getArgument('bot-id'); $tokens = $input->getArgument('token'); try { diff --git a/lib/Command/Bot/Uninstall.php b/lib/Command/Bot/Uninstall.php index 60736288343..0ab20540170 100644 --- a/lib/Command/Bot/Uninstall.php +++ b/lib/Command/Bot/Uninstall.php @@ -45,7 +45,7 @@ protected function configure(): void { } protected function execute(InputInterface $input, OutputInterface $output): int { - $botId = (int) $input->getArgument('id'); + $botId = (int)$input->getArgument('id'); try { if ($botId === 0) { diff --git a/lib/Command/Developer/AgeChatMessages.php b/lib/Command/Developer/AgeChatMessages.php index 345ed0b0921..a0093810a07 100644 --- a/lib/Command/Developer/AgeChatMessages.php +++ b/lib/Command/Developer/AgeChatMessages.php @@ -53,7 +53,7 @@ protected function configure(): void { protected function execute(InputInterface $input, OutputInterface $output): int { $token = $input->getArgument('token'); - $hours = (int) $input->getOption('hours'); + $hours = (int)$input->getOption('hours'); if ($hours < 1) { $output->writeln('Invalid age: ' . $hours . ''); return 1; diff --git a/lib/Command/Monitor/Calls.php b/lib/Command/Monitor/Calls.php index 24f55cf885f..a92a9face07 100644 --- a/lib/Command/Monitor/Calls.php +++ b/lib/Command/Monitor/Calls.php @@ -49,12 +49,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $data = []; $result = $query->executeQuery(); while ($row = $result->fetch()) { - $key = (string) $row['token']; + $key = (string)$row['token']; if ($input->getOption('output') === Base::OUTPUT_FORMAT_PLAIN) { $key = '"' . $key . '"'; } - $data[$key] = (int) $row['num_attendees']; + $data[$key] = (int)$row['num_attendees']; } $result->closeCursor(); diff --git a/lib/Command/Monitor/HasActiveCalls.php b/lib/Command/Monitor/HasActiveCalls.php index 0f5481df73e..94da6a8b14a 100644 --- a/lib/Command/Monitor/HasActiveCalls.php +++ b/lib/Command/Monitor/HasActiveCalls.php @@ -39,7 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->where($query->expr()->isNotNull('active_since')); $result = $query->executeQuery(); - $numCalls = (int) $result->fetchColumn(); + $numCalls = (int)$result->fetchColumn(); $result->closeCursor(); if ($numCalls === 0) { @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->andWhere($query->expr()->gt('last_ping', $query->createNamedParameter(time() - 60))); $result = $query->executeQuery(); - $numParticipants = (int) $result->fetchColumn(); + $numParticipants = (int)$result->fetchColumn(); $result->closeCursor(); diff --git a/lib/Command/Monitor/Room.php b/lib/Command/Monitor/Room.php index 42348a0b22a..bbb779f5376 100644 --- a/lib/Command/Monitor/Room.php +++ b/lib/Command/Monitor/Room.php @@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->where($query->expr()->eq('token', $query->createNamedParameter($token))); $result = $query->executeQuery(); - $roomId = (int) $result->fetchOne(); + $roomId = (int)$result->fetchOne(); $result->closeCursor(); if ($roomId === 0) { @@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->where($query->expr()->eq('room_id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT))); $result = $query->executeQuery(); - $numAttendees = (int) $result->fetchOne(); + $numAttendees = (int)$result->fetchOne(); $result->closeCursor(); $numSessions = $numSessionsInCall = 0; @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->andWhere($query->expr()->gt('s.last_ping', $query->createNamedParameter(time() - 60, IQueryBuilder::PARAM_INT))); $result = $query->executeQuery(); - $numSessions = (int) $result->fetchOne(); + $numSessions = (int)$result->fetchOne(); $result->closeCursor(); $query = $this->connection->getQueryBuilder(); @@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->andWhere($query->expr()->gt('s.last_ping', $query->createNamedParameter(time() - 60, IQueryBuilder::PARAM_INT))); $result = $query->executeQuery(); - $numSessionsInCall = (int) $result->fetchOne(); + $numSessionsInCall = (int)$result->fetchOne(); $result->closeCursor(); if ($input->getOption('output') === Base::OUTPUT_FORMAT_PLAIN) { diff --git a/lib/Command/Room/Create.php b/lib/Command/Room/Create.php index b84cf4deff8..141311d8e71 100644 --- a/lib/Command/Room/Create.php +++ b/lib/Command/Room/Create.php @@ -136,7 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($messageExpiration !== null) { - $this->setMessageExpiration($room, (int) $messageExpiration); + $this->setMessageExpiration($room, (int)$messageExpiration); } } catch (InvalidArgumentException $e) { $this->roomService->deleteRoom($room); diff --git a/lib/Command/Room/TRoomCommand.php b/lib/Command/Room/TRoomCommand.php index c06eec2a6f6..75f7925626c 100644 --- a/lib/Command/Room/TRoomCommand.php +++ b/lib/Command/Room/TRoomCommand.php @@ -41,7 +41,7 @@ public function __construct( } /** - * @param Room $room + * @param Room $room * @param string $name * * @throws InvalidArgumentException @@ -74,7 +74,7 @@ protected function validateRoomName(string $name): bool { } /** - * @param Room $room + * @param Room $room * @param string $description * * @throws InvalidArgumentException @@ -136,7 +136,7 @@ protected function setRoomListable(Room $room, int $listable): void { } /** - * @param Room $room + * @param Room $room * @param string $password * * @throws InvalidArgumentException @@ -160,7 +160,7 @@ protected function setRoomPassword(Room $room, string $password): void { } /** - * @param Room $room + * @param Room $room * @param string $userId * * @throws InvalidArgumentException @@ -196,7 +196,7 @@ protected function unsetRoomOwner(Room $room): void { } /** - * @param Room $room + * @param Room $room * @param string[] $groupIds * * @throws InvalidArgumentException @@ -217,7 +217,7 @@ protected function addRoomParticipantsByGroup(Room $room, array $groupIds): void } /** - * @param Room $room + * @param Room $room * @param string[] $userIds * * @throws InvalidArgumentException @@ -264,7 +264,7 @@ protected function addRoomParticipants(Room $room, array $userIds): void { } /** - * @param Room $room + * @param Room $room * @param string[] $userIds * * @throws InvalidArgumentException @@ -287,7 +287,7 @@ protected function removeRoomParticipants(Room $room, array $userIds): void { } /** - * @param Room $room + * @param Room $room * @param string[] $userIds * * @throws InvalidArgumentException @@ -316,7 +316,7 @@ protected function addRoomModerators(Room $room, array $userIds): void { } /** - * @param Room $room + * @param Room $room * @param string[] $userIds * * @throws InvalidArgumentException diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php index aef0c6d0a9c..0386fe357fd 100644 --- a/lib/Command/Room/Update.php +++ b/lib/Command/Room/Update.php @@ -154,7 +154,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($messageExpiration !== null) { - $this->setMessageExpiration($room, (int) $messageExpiration); + $this->setMessageExpiration($room, (int)$messageExpiration); } } catch (InvalidArgumentException $e) { $output->writeln(sprintf('%s', $e->getMessage())); diff --git a/lib/Config.php b/lib/Config.php index 6a24e16410e..6996b9999c3 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -65,17 +65,17 @@ public function getAllowedTalkGroupIds(): array { } public function getUserReadPrivacy(string $userId): int { - return (int) $this->config->getUserValue( + return (int)$this->config->getUserValue( $userId, 'spreed', 'read_status_privacy', - (string) Participant::PRIVACY_PUBLIC); + (string)Participant::PRIVACY_PUBLIC); } public function getUserTypingPrivacy(string $userId): int { - return (int) $this->config->getUserValue( + return (int)$this->config->getUserValue( $userId, 'spreed', 'typing_privacy', - (string) Participant::PRIVACY_PUBLIC); + (string)Participant::PRIVACY_PUBLIC); } @@ -211,7 +211,7 @@ public function recordingConsentRequired(): int { * @return RecordingService::CONSENT_REQUIRED_* */ public function getRecordingConsentConfig(): int { - return match ((int) $this->config->getAppValue('spreed', 'recording_consent', (string) RecordingService::CONSENT_REQUIRED_NO)) { + return match ((int)$this->config->getAppValue('spreed', 'recording_consent', (string)RecordingService::CONSENT_REQUIRED_NO)) { RecordingService::CONSENT_REQUIRED_YES => RecordingService::CONSENT_REQUIRED_YES, RecordingService::CONSENT_REQUIRED_OPTIONAL => RecordingService::CONSENT_REQUIRED_OPTIONAL, default => RecordingService::CONSENT_REQUIRED_NO, @@ -260,7 +260,7 @@ public function getDefaultPermissions(): int { // Admin configured default permissions $configurableDefault = $this->config->getAppValue('spreed', 'default_permissions'); if ($configurableDefault !== '') { - return (int) $configurableDefault; + return (int)$configurableDefault; } // Falling back to an unrestricted set of permissions, only ignoring the lobby is off @@ -588,7 +588,7 @@ public function getSignalingFederatedUserData(): array { /** * @param string|null $userId if given, the id of a user in this instance or - * a cloud id. + * a cloud id. * @return string */ private function getSignalingTicketV2(?string $userId): string { @@ -644,7 +644,7 @@ public function validateSignalingTicket(?string $userId, string $ticket): bool { } public function getGridVideosLimit(): int { - return (int) $this->config->getAppValue('spreed', 'grid_videos_limit', '19'); // 5*4 - self + return (int)$this->config->getAppValue('spreed', 'grid_videos_limit', '19'); // 5*4 - self } public function getGridVideosLimitEnforced(): bool { diff --git a/lib/Controller/BotController.php b/lib/Controller/BotController.php index 0d2e8a31b3c..0b8cf9797e0 100644 --- a/lib/Controller/BotController.php +++ b/lib/Controller/BotController.php @@ -156,7 +156,7 @@ public function sendMessage(string $token, string $message, string $referenceId $parent = null; if ($replyTo !== 0) { try { - $parent = $this->chatManager->getParentComment($room, (string) $replyTo); + $parent = $this->chatManager->getParentComment($room, (string)$replyTo); } catch (NotFoundException $e) { // Someone is trying to reply cross-rooms or to a non-existing message return new DataResponse([], Http::STATUS_BAD_REQUEST); @@ -224,7 +224,7 @@ public function react(string $token, int $messageId, string $reaction): DataResp return new DataResponse([], Http::STATUS_NOT_FOUND); } catch (ReactionAlreadyExistsException) { return new DataResponse([], Http::STATUS_OK); - } catch (ReactionNotSupportedException | ReactionOutOfContextException | \Exception) { + } catch (ReactionNotSupportedException|ReactionOutOfContextException|\Exception) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -273,7 +273,7 @@ public function deleteReaction(string $token, int $messageId, string $reaction): $messageId, $reaction ); - } catch (ReactionNotSupportedException | ReactionOutOfContextException | NotFoundException) { + } catch (ReactionNotSupportedException|ReactionOutOfContextException|NotFoundException) { return new DataResponse([], Http::STATUS_NOT_FOUND); } catch (\Exception) { return new DataResponse([], Http::STATUS_BAD_REQUEST); diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index babc5d2074f..b1396220c67 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -118,9 +118,9 @@ public function getPeersForCall(): DataResponse { * @psalm-param int-mask-of|null $flags * @param bool $silent Join the call silently * @param bool $recordingConsent When the user ticked a checkbox and agreed with being recorded - * (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} - * or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} - * and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ) + * (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} + * or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} + * and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ) * @return DataResponse, array{}>|DataResponse * * 200: Call joined successfully @@ -177,7 +177,7 @@ public function joinCall(?int $flags = null, bool $silent = false, bool $recordi * Validates and stores recording consent. * * @throws \InvalidArgumentException if recording consent is required but - * not given + * not given */ protected function validateRecordingConsent(bool $recordingConsent): void { if (!$recordingConsent && $this->talkConfig->recordingConsentRequired() !== RecordingService::CONSENT_REQUIRED_NO) { diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index f0be4a68895..2aa44cdccac 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -154,7 +154,7 @@ protected function parseCommentToResponse(IComment $comment, ?Message $parentMes if (!$chatMessage->getVisibility()) { $headers = []; if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { - $headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)]; + $headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)]; } return new DataResponse(null, Http::STATUS_CREATED, $headers); } @@ -166,7 +166,7 @@ protected function parseCommentToResponse(IComment $comment, ?Message $parentMes $headers = []; if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { - $headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)]; + $headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)]; } return new DataResponse($data, Http::STATUS_CREATED, $headers); } @@ -216,7 +216,7 @@ public function sendMessage(string $message, string $actorDisplayName = '', stri $parent = $parentMessage = null; if ($replyTo !== 0) { try { - $parent = $this->chatManager->getParentComment($this->room, (string) $replyTo); + $parent = $this->chatManager->getParentComment($this->room, (string)$replyTo); } catch (NotFoundException $e) { // Someone is trying to reply cross-rooms or to a non-existing message return new DataResponse([], Http::STATUS_BAD_REQUEST); @@ -499,7 +499,7 @@ protected function prepareCommentsAsDataResponse(array $comments, int $lastCommo // As per "section 10.3.5 of RFC 2616" entity headers shall be // stripped out on 304: https://stackoverflow.com/a/17822709 /** @var array{X-Chat-Last-Common-Read?: numeric-string, X-Chat-Last-Given?: numeric-string} $headers */ - $headers = ['X-Chat-Last-Common-Read' => (string) $newLastCommonRead]; + $headers = ['X-Chat-Last-Common-Read' => (string)$newLastCommonRead]; return new DataResponse([], Http::STATUS_OK, $headers); } } @@ -512,7 +512,7 @@ protected function prepareCommentsAsDataResponse(array $comments, int $lastCommo $now = $this->timeFactory->getDateTime(); $messages = $commentIdToIndex = $parentIds = []; foreach ($comments as $comment) { - $id = (int) $comment->getId(); + $id = (int)$comment->getId(); $message = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l); $this->messageParser->parseMessage($message); @@ -579,7 +579,7 @@ protected function prepareCommentsAsDataResponse(array $comments, int $lastCommo } $loadedParents[$parentId] = [ - 'id' => (int) $parentId, + 'id' => (int)$parentId, 'deleted' => true, ]; } catch (NotFoundException $e) { @@ -588,7 +588,7 @@ protected function prepareCommentsAsDataResponse(array $comments, int $lastCommo // Message is not visible to the user $messages[$commentKey]['parent'] = [ - 'id' => (int) $parentId, + 'id' => (int)$parentId, 'deleted' => true, ]; } @@ -598,7 +598,7 @@ protected function prepareCommentsAsDataResponse(array $comments, int $lastCommo $headers = []; $newLastKnown = end($comments); if ($newLastKnown instanceof IComment) { - $headers = ['X-Chat-Last-Given' => (string) (int) $newLastKnown->getId()]; + $headers = ['X-Chat-Last-Given' => (string)(int)$newLastKnown->getId()]; if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { /** * This falsely set the read marker on new messages, although you @@ -668,9 +668,9 @@ protected function loadSelfReactions(array $messages, array $commentIdToIndex): // Create a map, so we can translate the parent's $messageId to the correct child entries $parentMap = $parentIdsWithReactions = []; foreach ($parentsWithReactions as $entry) { - $parentMap[(int) $entry['parent']] ??= []; - $parentMap[(int) $entry['parent']][] = (int) $entry['message']; - $parentIdsWithReactions[] = (int) $entry['parent']; + $parentMap[(int)$entry['parent']] ??= []; + $parentMap[(int)$entry['parent']][] = (int)$entry['message']; + $parentIdsWithReactions[] = (int)$entry['parent']; } // Unique list for the query @@ -728,7 +728,7 @@ public function deleteMessage(int $messageId): DataResponse { } try { - $message = $this->chatManager->getComment($this->room, (string) $messageId); + $message = $this->chatManager->getComment($this->room, (string)$messageId); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } @@ -766,7 +766,7 @@ public function deleteMessage(int $messageId): DataResponse { $systemMessage = $this->messageParser->createMessage($this->room, $this->participant, $systemMessageComment, $this->l); $this->messageParser->parseMessage($systemMessage); - $comment = $this->chatManager->getComment($this->room, (string) $messageId); + $comment = $this->chatManager->getComment($this->room, (string)$messageId); $message = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l); $this->messageParser->parseMessage($message); @@ -781,7 +781,7 @@ public function deleteMessage(int $messageId): DataResponse { $headers = []; if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { - $headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)]; + $headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)]; } return new DataResponse($data, $hasBotOrBridge ? Http::STATUS_ACCEPTED : Http::STATUS_OK, $headers); } @@ -821,7 +821,7 @@ public function editMessage(int $messageId, string $message): DataResponse { } try { - $comment = $this->chatManager->getComment($this->room, (string) $messageId); + $comment = $this->chatManager->getComment($this->room, (string)$messageId); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } @@ -873,7 +873,7 @@ public function editMessage(int $messageId, string $message): DataResponse { $systemMessage = $this->messageParser->createMessage($this->room, $this->participant, $systemMessageComment, $this->l); $this->messageParser->parseMessage($systemMessage); - $comment = $this->chatManager->getComment($this->room, (string) $messageId); + $comment = $this->chatManager->getComment($this->room, (string)$messageId); $parseMessage = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l); $this->messageParser->parseMessage($parseMessage); @@ -888,7 +888,7 @@ public function editMessage(int $messageId, string $message): DataResponse { $headers = []; if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { - $headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)]; + $headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)]; } return new DataResponse($data, $hasBotOrBridge ? Http::STATUS_ACCEPTED : Http::STATUS_OK, $headers); } @@ -1051,7 +1051,7 @@ public function clearHistory(): DataResponse { $headers = []; if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { - $headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)]; + $headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)]; } return new DataResponse($data, $bridge['enabled'] ? Http::STATUS_ACCEPTED : Http::STATUS_OK, $headers); } @@ -1087,7 +1087,7 @@ public function setReadMarker(?int $lastReadMessage = null): DataResponse { $headers = $lastCommonRead = []; if ($attendee->getReadPrivacy() === Participant::PRIVACY_PUBLIC) { $lastCommonRead[$this->room->getId()] = $this->chatManager->getLastCommonReadMessage($this->room); - $headers = ['X-Chat-Last-Common-Read' => (string) $lastCommonRead[$this->room->getId()]]; + $headers = ['X-Chat-Last-Common-Read' => (string)$lastCommonRead[$this->room->getId()]]; } return new DataResponse($this->roomFormatter->formatRoom( @@ -1126,7 +1126,7 @@ public function markUnread(): DataResponse { [ChatManager::VERB_MESSAGE], $message->getVerb() === ChatManager::VERB_MESSAGE ); - $unreadId = (int) $previousMessage->getId(); + $unreadId = (int)$previousMessage->getId(); } catch (NotFoundException $e) { // No chat message found, only system messages. // Marking unread from beginning @@ -1212,7 +1212,7 @@ public function getObjectsSharedInRoom(string $objectType, int $lastKnownMessage $headers = []; if (!empty($messages)) { - $newLastKnown = (string) (int) min(array_keys($messages)); + $newLastKnown = (string)(int)min(array_keys($messages)); $headers = ['X-Chat-Last-Given' => $newLastKnown]; } @@ -1243,7 +1243,7 @@ protected function getMessagesForRoom(array $messageIds): array { continue; } - $messages[(int) $comment->getId()] = $message->toArray($this->getResponseFormat()); + $messages[(int)$comment->getId()] = $message->toArray($this->getResponseFormat()); } return $messages; @@ -1286,7 +1286,7 @@ public function mentions(string $search, int $limit = 20, bool $includeStatus = $this->autoCompleteManager->registerSorter(Sorter::class); $this->autoCompleteManager->runSorters(['talk_chat_participants'], $results, [ 'itemType' => 'chat', - 'itemId' => (string) $this->room->getId(), + 'itemId' => (string)$this->room->getId(), 'search' => $search, ]); diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php index f0c7b6e62f8..f881f0caeae 100644 --- a/lib/Controller/FilesIntegrationController.php +++ b/lib/Controller/FilesIntegrationController.php @@ -77,8 +77,8 @@ public function __construct( * * @param string $fileId ID of the file * @return DataResponse|DataResponse, array{}> - * 200: Room token returned - * 400: Rooms not allowed for shares + * 200: Room token returned + * 400: Rooms not allowed for shares * @throws OCSNotFoundException Share not found */ #[NoAdminRequired] @@ -143,9 +143,9 @@ public function getRoomByFileId(string $fileId): DataResponse { * * @param string $shareToken Token of the file share * @return DataResponse|DataResponse, array{}> - * 200: Room token and user info returned - * 400: Rooms not allowed for shares - * 404: Share not found + * 200: Room token and user info returned + * 400: Rooms not allowed for shares + * 404: Share not found */ #[PublicPage] #[UseSession] diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 96925a0a7b5..cf6b64b9664 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -201,7 +201,7 @@ protected function pageHandler(string $token = '', string $callUser = '', string } if ($requirePassword) { - $password = $password !== '' ? $password : (string) $this->talkSession->getPasswordForRoom($token); + $password = $password !== '' ? $password : (string)$this->talkSession->getPasswordForRoom($token); $passwordVerification = $this->roomService->verifyPassword($room, $password); @@ -356,7 +356,7 @@ protected function guestEnterRoom(string $token, string $password): Response { } if ($room->hasPassword()) { - $password = $password !== '' ? $password : (string) $this->talkSession->getPasswordForRoom($token); + $password = $password !== '' ? $password : (string)$this->talkSession->getPasswordForRoom($token); $passwordVerification = $this->roomService->verifyPassword($room, $password); if ($passwordVerification['result']) { diff --git a/lib/Controller/ReactionController.php b/lib/Controller/ReactionController.php index bff0c2faf4f..85b90aaeab5 100644 --- a/lib/Controller/ReactionController.php +++ b/lib/Controller/ReactionController.php @@ -76,7 +76,7 @@ public function react(int $messageId, string $reaction): DataResponse { return new DataResponse([], Http::STATUS_NOT_FOUND); } catch (ReactionAlreadyExistsException $e) { $status = Http::STATUS_OK; - } catch (ReactionNotSupportedException | ReactionOutOfContextException | \Exception $e) { + } catch (ReactionNotSupportedException|ReactionOutOfContextException|\Exception $e) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } $reactions = $this->reactionManager->retrieveReactionMessages($this->getRoom(), $this->getParticipant(), $messageId); @@ -117,7 +117,7 @@ public function delete(int $messageId, string $reaction): DataResponse { $reaction ); $reactions = $this->reactionManager->retrieveReactionMessages($this->getRoom(), $this->getParticipant(), $messageId); - } catch (ReactionNotSupportedException | ReactionOutOfContextException | NotFoundException $e) { + } catch (ReactionNotSupportedException|ReactionOutOfContextException|NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } catch (\Exception $e) { return new DataResponse([], Http::STATUS_BAD_REQUEST); @@ -150,8 +150,8 @@ public function getReactions(int $messageId, ?string $reaction): DataResponse { try { // Verify that messageId is part of the room - $this->reactionManager->getCommentToReact($this->getRoom(), (string) $messageId); - } catch (ReactionNotSupportedException | ReactionOutOfContextException | NotFoundException $e) { + $this->reactionManager->getCommentToReact($this->getRoom(), (string)$messageId); + } catch (ReactionNotSupportedException|ReactionOutOfContextException|NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } diff --git a/lib/Controller/RecordingController.php b/lib/Controller/RecordingController.php index 30699838e5c..f42caa1c535 100644 --- a/lib/Controller/RecordingController.php +++ b/lib/Controller/RecordingController.php @@ -69,7 +69,7 @@ public function getWelcomeMessage(int $serverId): DataResponse { $url = rtrim($recordingServers[$serverId]['server'], '/'); $url = strtolower($url); - $verifyServer = (bool) $recordingServers[$serverId]['verify']; + $verifyServer = (bool)$recordingServers[$serverId]['verify']; if ($verifyServer && str_contains($url, 'https://')) { $expiration = $this->certificateService->getCertificateExpirationInDays($url); diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index b4397b33fe7..d28e2a74077 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -254,11 +254,11 @@ public function getRooms(int $noStatusUpdate = 0, bool $includeStatus = false, i } /** @var array{X-Nextcloud-Talk-Modified-Before: numeric-string, X-Nextcloud-Talk-Federation-Invites?: numeric-string} $headers */ - $headers = ['X-Nextcloud-Talk-Modified-Before' => (string) $nextModifiedSince]; + $headers = ['X-Nextcloud-Talk-Modified-Before' => (string)$nextModifiedSince]; if ($this->talkConfig->isFederationEnabledForUserId($user)) { $numInvites = $this->federationManager->getNumberOfPendingInvitationsForUser($user); if ($numInvites !== 0) { - $headers['X-Nextcloud-Talk-Federation-Invites'] = (string) $numInvites; + $headers['X-Nextcloud-Talk-Federation-Invites'] = (string)$numInvites; } } @@ -1019,7 +1019,7 @@ protected function formatParticipantList(array $participants, bool $includeStatu // Generate a PIN if the attendee is a user and doesn't have one. $this->participantService->generatePinForParticipant($this->room, $participant); - $result['attendeePin'] = (string) $participant->getAttendee()->getPin(); + $result['attendeePin'] = (string)$participant->getAttendee()->getPin(); } if ($participant->getSession() instanceof Session) { @@ -1610,7 +1610,7 @@ public function joinRoom(string $token, string $password = '', bool $force = tru 'result' => true, ]; } else { - $result = $this->roomService->verifyPassword($room, (string) $this->session->getPasswordForRoom($token)); + $result = $this->roomService->verifyPassword($room, (string)$this->session->getPasswordForRoom($token)); } $user = $this->userManager->get($this->userId); @@ -2282,7 +2282,7 @@ public function setSIPEnabled(int $state): DataResponse { * Set recording consent requirement for this conversation * * @param int $recordingConsent New consent setting for the conversation - * (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.) + * (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.) * @psalm-param RecordingService::CONSENT_REQUIRED_NO|RecordingService::CONSENT_REQUIRED_YES $recordingConsent * @return DataResponse|DataResponse|DataResponse, array{}> * diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 8102a35e4dd..1989d90f8ee 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -61,7 +61,7 @@ public function setUserSetting(string $key, $value): DataResponse { $this->config->setUserValue($this->userId, 'spreed', $key, $value); if ($key === 'read_status_privacy') { - $this->participantService->updateReadPrivacyForActor(Attendee::ACTOR_USERS, $this->userId, (int) $value); + $this->participantService->updateReadPrivacyForActor(Attendee::ACTOR_USERS, $this->userId, (int)$value); } return new DataResponse(); @@ -95,8 +95,8 @@ protected function validateUserSetting(string $setting, $value): bool { } if ($setting === 'typing_privacy' || $setting === 'read_status_privacy') { - return (int) $value === Participant::PRIVACY_PUBLIC || - (int) $value === Participant::PRIVACY_PRIVATE; + return (int)$value === Participant::PRIVACY_PUBLIC || + (int)$value === Participant::PRIVACY_PRIVATE; } if ($setting === 'play_sounds') { return $value === 'yes' || $value === 'no'; diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php index 7f8c0e9d159..b9bae69ffd7 100644 --- a/lib/Controller/SignalingController.php +++ b/lib/Controller/SignalingController.php @@ -284,7 +284,7 @@ public function getWelcomeMessage(int $serverId): DataResponse { $url = 'http://' . substr($url, 5); } - $verifyServer = (bool) $signalingServers[$serverId]['verify']; + $verifyServer = (bool)$signalingServers[$serverId]['verify']; if ($verifyServer && str_contains($url, 'https://')) { $expiration = $this->certificateService->getCertificateExpirationInDays($url); @@ -866,7 +866,7 @@ private function backendRoom(array $roomRequest): DataResponse { 'room' => [ 'version' => '1.0', 'roomid' => $room->getToken(), - 'properties' => $room->getPropertiesForSignaling((string) $userId), + 'properties' => $room->getPropertiesForSignaling((string)$userId), 'permissions' => $permissions, ], ]; diff --git a/lib/Federation/Authenticator.php b/lib/Federation/Authenticator.php index 42a5ed73297..57faaae0350 100644 --- a/lib/Federation/Authenticator.php +++ b/lib/Federation/Authenticator.php @@ -30,7 +30,7 @@ public function __construct( } protected function readHeaders(): void { - $this->isFederationRequest = (bool) $this->request->getHeader('X-Nextcloud-Federation'); + $this->isFederationRequest = (bool)$this->request->getHeader('X-Nextcloud-Federation'); if (!$this->isFederationRequest) { $this->federationCloudId = ''; $this->accessToken = ''; diff --git a/lib/Federation/BackendNotifier.php b/lib/Federation/BackendNotifier.php index 5900855b6de..db891f07c92 100644 --- a/lib/Federation/BackendNotifier.php +++ b/lib/Federation/BackendNotifier.php @@ -110,7 +110,7 @@ public function sendRemoteShare( $response = $this->federationProviderManager->sendCloudShare($share); if ($response->getStatusCode() === Http::STATUS_CREATED) { $body = $response->getBody(); - $data = json_decode((string) $body, true); + $data = json_decode((string)$body, true); if (isset($data['recipientUserId']) && $data['recipientUserId'] !== '') { $shareWithCloudId = $data['recipientUserId'] . '@' . $remote; } @@ -122,7 +122,7 @@ public function sendRemoteShare( $this->logger->warning("Failed sharing $roomToken with $shareWith, received status code {code}\n{body}", [ 'code' => $response->getStatusCode(), - 'body' => (string) $response->getBody(), + 'body' => (string)$response->getBody(), ]); return false; @@ -152,7 +152,7 @@ public function sendShareAccepted( $notification->setMessage( FederationManager::NOTIFICATION_SHARE_ACCEPTED, FederationManager::TALK_ROOM_RESOURCE, - (string) $remoteAttendeeId, + (string)$remoteAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -181,7 +181,7 @@ public function sendShareDeclined( $notification->setMessage( FederationManager::NOTIFICATION_SHARE_DECLINED, FederationManager::TALK_ROOM_RESOURCE, - (string) $remoteAttendeeId, + (string)$remoteAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -206,7 +206,7 @@ public function sendRemoteUnShare( $notification->setMessage( FederationManager::NOTIFICATION_SHARE_UNSHARED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -239,7 +239,7 @@ public function sendRoomModifiedUpdate( $notification->setMessage( FederationManager::NOTIFICATION_ROOM_MODIFIED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -273,7 +273,7 @@ public function sendParticipantModifiedUpdate( $notification->setMessage( FederationManager::NOTIFICATION_PARTICIPANT_MODIFIED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -310,7 +310,7 @@ public function sendCallStarted( $notification->setMessage( FederationManager::NOTIFICATION_ROOM_MODIFIED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -349,7 +349,7 @@ public function sendCallEnded( $notification->setMessage( FederationManager::NOTIFICATION_ROOM_MODIFIED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -387,7 +387,7 @@ public function sendRoomModifiedLobbyUpdate( $notification->setMessage( FederationManager::NOTIFICATION_ROOM_MODIFIED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -395,7 +395,7 @@ public function sendRoomModifiedLobbyUpdate( 'changedProperty' => $changedProperty, 'newValue' => $newValue, 'oldValue' => $oldValue, - 'dateTime' => $dateTime ? (string) $dateTime->getTimestamp() : '', + 'dateTime' => $dateTime ? (string)$dateTime->getTimestamp() : '', 'timerReached' => $timerReached, ], ); @@ -425,7 +425,7 @@ public function sendMessageUpdate( $notification->setMessage( FederationManager::NOTIFICATION_MESSAGE_POSTED, FederationManager::TALK_ROOM_RESOURCE, - (string) $localAttendeeId, + (string)$localAttendeeId, [ 'remoteServerUrl' => $this->getServerRemoteUrl(), 'sharedSecret' => $accessToken, @@ -446,7 +446,7 @@ protected function sendUpdateToRemote(string $remote, ICloudFederationNotificati } if ($response->getStatusCode() === Http::STATUS_BAD_REQUEST) { - $ocmBody = json_decode((string) $response->getBody(), true) ?? []; + $ocmBody = json_decode((string)$response->getBody(), true) ?? []; if (isset($ocmBody['message']) && $ocmBody['message'] === FederationManager::OCM_RESOURCE_NOT_FOUND) { // Remote exists but tells us the OCM notification can not be received (invalid invite data) // So we stop retrying @@ -456,7 +456,7 @@ protected function sendUpdateToRemote(string $remote, ICloudFederationNotificati $this->logger->warning("Failed to send notification for share from $remote, received status code {code}\n{body}", [ 'code' => $response->getStatusCode(), - 'body' => (string) $response->getBody(), + 'body' => (string)$response->getBody(), ]); } catch (OCMProviderException $e) { $this->logger->error("Failed to send notification for share from $remote, received OCMProviderException", ['exception' => $e]); diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index 5fd5b6b50c0..43c7a8e3271 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -115,7 +115,7 @@ public function shareReceived(ICloudFederationShare $share): string { } $roomType = $share->getProtocol()['roomType']; - if (!is_numeric($roomType) || !in_array((int) $roomType, $this->validSharedRoomTypes(), true)) { + if (!is_numeric($roomType) || !in_array((int)$roomType, $this->validSharedRoomTypes(), true)) { $this->logger->debug('Received a federation invite for invalid room type'); throw new ProviderCouldNotAddShareException('roomType is not a valid number', '', Http::STATUS_BAD_REQUEST); } @@ -133,7 +133,7 @@ public function shareReceived(ICloudFederationShare $share): string { $cloudId = $this->cloudIdManager->getCloudId($shareWith, null); $localCloudId = $cloudId->getUser() . '@' . $cloudId->getRemote(); } - $roomType = (int) $roomType; + $roomType = (int)$roomType; $sharedByDisplayName = $share->getSharedByDisplayName(); $sharedByFederatedId = $share->getSharedBy(); $ownerDisplayName = $share->getOwnerDisplayName(); @@ -174,10 +174,10 @@ public function shareReceived(ICloudFederationShare $share): string { throw new ProviderCouldNotAddShareException('User does not exist', '', Http::STATUS_BAD_REQUEST); } - $invite = $this->federationManager->addRemoteRoom($shareWithUser, (int) $remoteId, $roomType, $roomName, $roomDefaultPermissions, $roomToken, $remote, $shareSecret, $sharedByFederatedId, $sharedByDisplayName, $localCloudId); + $invite = $this->federationManager->addRemoteRoom($shareWithUser, (int)$remoteId, $roomType, $roomName, $roomDefaultPermissions, $roomToken, $remote, $shareSecret, $sharedByFederatedId, $sharedByDisplayName, $localCloudId); - $this->notifyAboutNewShare($shareWithUser, (string) $invite->getId(), $sharedByFederatedId, $sharedByDisplayName, $roomName, $roomToken, $remote); - return (string) $invite->getId(); + $this->notifyAboutNewShare($shareWithUser, (string)$invite->getId(), $sharedByFederatedId, $sharedByDisplayName, $roomName, $roomToken, $remote); + return (string)$invite->getId(); } $this->logger->debug('Received a federation invite with missing request data'); @@ -193,17 +193,17 @@ public function notificationReceived($notificationType, $providerId, array $noti } switch ($notificationType) { case FederationManager::NOTIFICATION_SHARE_ACCEPTED: - return $this->shareAccepted((int) $providerId, $notification); + return $this->shareAccepted((int)$providerId, $notification); case FederationManager::NOTIFICATION_SHARE_DECLINED: - return $this->shareDeclined((int) $providerId, $notification); + return $this->shareDeclined((int)$providerId, $notification); case FederationManager::NOTIFICATION_SHARE_UNSHARED: - return $this->shareUnshared((int) $providerId, $notification); + return $this->shareUnshared((int)$providerId, $notification); case FederationManager::NOTIFICATION_PARTICIPANT_MODIFIED: - return $this->participantModified((int) $providerId, $notification); + return $this->participantModified((int)$providerId, $notification); case FederationManager::NOTIFICATION_ROOM_MODIFIED: - return $this->roomModified((int) $providerId, $notification); + return $this->roomModified((int)$providerId, $notification); case FederationManager::NOTIFICATION_MESSAGE_POSTED: - return $this->messagePosted((int) $providerId, $notification); + return $this->messagePosted((int)$providerId, $notification); } throw new BadRequestException([$notificationType]); @@ -461,7 +461,7 @@ private function messagePosted(int $remoteAttendeeId, array $notification): arra $lastMessageId = $room->getLastMessageId(); if ($notification['messageData']['remoteMessageId'] > $lastMessageId) { - $lastMessageId = (int) $notification['messageData']['remoteMessageId']; + $lastMessageId = (int)$notification['messageData']['remoteMessageId']; } if ($notification['messageData']['systemMessage'] !== 'message_edited' diff --git a/lib/Federation/FederationManager.php b/lib/Federation/FederationManager.php index e350897498f..4c3706b9d51 100644 --- a/lib/Federation/FederationManager.php +++ b/lib/Federation/FederationManager.php @@ -130,7 +130,7 @@ protected function markNotificationProcessed(string $userId, int $shareId): void $notification = $this->notificationManager->createNotification(); $notification->setApp(Application::APP_ID) ->setUser($userId) - ->setObject('remote_talk_share', (string) $shareId); + ->setObject('remote_talk_share', (string)$shareId); $this->notificationManager->markProcessed($notification); } diff --git a/lib/Federation/Proxy/TalkV1/Controller/AvatarController.php b/lib/Federation/Proxy/TalkV1/Controller/AvatarController.php index d00a161f784..317e415a39f 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/AvatarController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/AvatarController.php @@ -49,7 +49,7 @@ public function getAvatar(Room $room, ?Participant $participant, ?Invitation $in ); if ($proxy->getStatusCode() !== Http::STATUS_OK) { - $this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string) $proxy->getBody()); + $this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string)$proxy->getBody()); throw new CannotReachRemoteException('Avatar request had unexpected status code'); } @@ -83,7 +83,7 @@ public function getUserProxyAvatar(string $remoteServer, string $user, int $size if ($proxy->getStatusCode() !== Http::STATUS_OK) { if ($proxy->getStatusCode() !== Http::STATUS_NOT_FOUND) { - $this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string) $proxy->getBody()); + $this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string)$proxy->getBody()); } throw new CannotReachRemoteException('Avatar request had unexpected status code'); } diff --git a/lib/Federation/Proxy/TalkV1/Controller/CallController.php b/lib/Federation/Proxy/TalkV1/Controller/CallController.php index 128f6d66356..5cb8f79cd90 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/CallController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/CallController.php @@ -68,7 +68,7 @@ public function getPeersForCall(Room $room, Participant $participant): DataRespo * * @param Room $room the federated room to join the call in * @param Participant $participant the federated user that will join the - * call; the participant must have a session + * call; the participant must have a session * @param int<0, 15> $flags In-Call flags * @psalm-param int-mask-of $flags * @param bool $silent Join the call silently @@ -109,7 +109,7 @@ public function joinFederatedCall(Room $room, Participant $participant, int $fla * * @param Room $room the federated room to update the call flags in * @param Participant $participant the federated user to update the call - * flags; the participant must have a session + * flags; the participant must have a session * @param int<0, 15> $flags New flags * @psalm-param int-mask-of $flags New flags * @return DataResponse, array{}> @@ -146,7 +146,7 @@ public function updateFederatedCallFlags(Room $room, Participant $participant, i * * @param Room $room the federated room to leave the call in * @param Participant $participant the federated user that will leave the - * call; the participant must have a session + * call; the participant must have a session * @return DataResponse, array{}> * @throws CannotReachRemoteException * diff --git a/lib/Federation/Proxy/TalkV1/Controller/ChatController.php b/lib/Federation/Proxy/TalkV1/Controller/ChatController.php index cc0a406e315..bf8951f9d53 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/ChatController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/ChatController.php @@ -93,7 +93,7 @@ public function sendMessage(Room $room, Participant $participant, string $messag $headers = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read'); } return new DataResponse( @@ -134,7 +134,7 @@ public function receiveMessages( if ($lookIntoFuture) { if ($this->proxyCacheMessages instanceof ICache) { for ($i = 0; $i <= $timeout; $i++) { - $cacheData = (int) $this->proxyCacheMessages->get($cacheKey); + $cacheData = (int)$this->proxyCacheMessages->get($cacheKey); if ($lastKnownMessageId !== $cacheData) { break; } @@ -169,7 +169,7 @@ public function receiveMessages( 0, false, false, - (int) ($proxy->getHeader('X-Chat-Last-Given') ?: $lastKnownMessageId), + (int)($proxy->getHeader('X-Chat-Last-Given') ?: $lastKnownMessageId), ); } @@ -185,14 +185,14 @@ public function receiveMessages( $headers = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read'); } if ($proxy->getHeader('X-Chat-Last-Given')) { - $headers['X-Chat-Last-Given'] = (string) (int) $proxy->getHeader('X-Chat-Last-Given'); + $headers['X-Chat-Last-Given'] = (string)(int)$proxy->getHeader('X-Chat-Last-Given'); if ($lookIntoFuture && $this->proxyCacheMessages instanceof ICache) { $cacheData = $this->proxyCacheMessages->get($cacheKey); if ($cacheData === null || $cacheData < $headers['X-Chat-Last-Given']) { - $this->proxyCacheMessages->set($cacheKey, (int) $headers['X-Chat-Last-Given'], 300); + $this->proxyCacheMessages->set($cacheKey, (int)$headers['X-Chat-Last-Given'], 300); } } } @@ -234,10 +234,10 @@ public function getMessageContext(Room $room, Participant $participant, int $mes $headers = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read'); } if ($proxy->getHeader('X-Chat-Last-Given')) { - $headers['X-Chat-Last-Given'] = (string) (int) $proxy->getHeader('X-Chat-Last-Given'); + $headers['X-Chat-Last-Given'] = (string)(int)$proxy->getHeader('X-Chat-Last-Given'); } /** @var TalkChatMessageWithParent[] $data */ @@ -297,7 +297,7 @@ public function editMessage(Room $room, Participant $participant, int $messageId $headers = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read'); } return new DataResponse( @@ -348,7 +348,7 @@ public function deleteMessage(Room $room, Participant $participant, int $message $headers = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read'); } return new DataResponse( @@ -390,8 +390,8 @@ public function setReadMarker(Room $room, Participant $participant, string $resp $headers = $lastCommonRead = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $lastCommonRead[$room->getId()] = (int) $proxy->getHeader('X-Chat-Last-Common-Read'); - $headers['X-Chat-Last-Common-Read'] = (string) $lastCommonRead[$room->getId()]; + $lastCommonRead[$room->getId()] = (int)$proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)$lastCommonRead[$room->getId()]; } return new DataResponse($this->roomFormatter->formatRoom( @@ -431,8 +431,8 @@ public function markUnread(Room $room, Participant $participant, string $respons $headers = $lastCommonRead = []; if ($proxy->getHeader('X-Chat-Last-Common-Read')) { - $lastCommonRead[$room->getId()] = (int) $proxy->getHeader('X-Chat-Last-Common-Read'); - $headers['X-Chat-Last-Common-Read'] = (string) $lastCommonRead[$room->getId()]; + $lastCommonRead[$room->getId()] = (int)$proxy->getHeader('X-Chat-Last-Common-Read'); + $headers['X-Chat-Last-Common-Read'] = (string)$lastCommonRead[$room->getId()]; } return new DataResponse($this->roomFormatter->formatRoom( diff --git a/lib/Federation/Proxy/TalkV1/Controller/RoomController.php b/lib/Federation/Proxy/TalkV1/Controller/RoomController.php index 651719f7aac..0a4ce7dd77c 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/RoomController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/RoomController.php @@ -64,7 +64,7 @@ public function getParticipants(Room $room, Participant $participant): DataRespo * * @param Room $room the federated room to join * @param Participant $participant the federated user to will join the room; - * the participant must have a session + * the participant must have a session * @return DataResponse, array{X-Nextcloud-Talk-Proxy-Hash: string}> * @throws CannotReachRemoteException * @@ -104,7 +104,7 @@ public function joinFederatedRoom(Room $room, Participant $participant): DataRes * * @param Room $room the federated room to leave * @param Participant $participant the federated user that will leave the - * room; the participant must have a session + * room; the participant must have a session * @return DataResponse, array{}> * @throws CannotReachRemoteException * diff --git a/lib/Federation/Proxy/TalkV1/Notifier/CancelRetryOCMListener.php b/lib/Federation/Proxy/TalkV1/Notifier/CancelRetryOCMListener.php index fb707fd93d0..f7a543551d3 100644 --- a/lib/Federation/Proxy/TalkV1/Notifier/CancelRetryOCMListener.php +++ b/lib/Federation/Proxy/TalkV1/Notifier/CancelRetryOCMListener.php @@ -34,7 +34,7 @@ public function handle(Event $event): void { } $this->retryNotificationMapper->deleteByProviderId( - (string) $event->getAttendee()->getId() + (string)$event->getAttendee()->getId() ); } } diff --git a/lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php b/lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php index 1d8c0b2868b..7f54abb095d 100644 --- a/lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php +++ b/lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php @@ -77,11 +77,11 @@ public function handle(Event $event): void { if ($parent instanceof IComment) { $metaData[ProxyCacheMessage::METADATA_REPLY_TO_ACTOR_TYPE] = $parent->getActorType(); $metaData[ProxyCacheMessage::METADATA_REPLY_TO_ACTOR_ID] = $parent->getActorId(); - $metaData[ProxyCacheMessage::METADATA_REPLY_TO_MESSAGE_ID] = (int) $parent->getId(); + $metaData[ProxyCacheMessage::METADATA_REPLY_TO_MESSAGE_ID] = (int)$parent->getId(); } $messageData = [ - 'remoteMessageId' => (int) $event->getComment()->getId(), + 'remoteMessageId' => (int)$event->getComment()->getId(), 'actorType' => $chatMessage->getActorType(), 'actorId' => $chatMessage->getActorId(), 'actorDisplayName' => $chatMessage->getActorDisplayName(), diff --git a/lib/Files/Util.php b/lib/Files/Util.php index 8e6ecdd41c0..66545b3154e 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -37,7 +37,7 @@ public function __construct( */ public function getUsersWithAccessFile(string $fileId): array { if (!isset($this->accessLists[$fileId])) { - $nodes = $this->rootFolder->getById((int) $fileId); + $nodes = $this->rootFolder->getById((int)$fileId); if (empty($nodes)) { return []; @@ -68,7 +68,7 @@ public function canUserAccessFile(string $fileId, string $userId): bool { public function canGuestsAccessFile(string $fileId): bool { if (!isset($this->publicAccessLists[$fileId])) { - $nodes = $this->rootFolder->getById((int) $fileId); + $nodes = $this->rootFolder->getById((int)$fileId); if (empty($nodes)) { return false; @@ -106,7 +106,7 @@ public function canGuestAccessFile(string $shareToken): bool { */ public function getAnyNodeOfFileAccessibleByUser(string $fileId, string $userId): ?Node { $userFolder = $this->rootFolder->getUserFolder($userId); - $nodes = $userFolder->getById((int) $fileId); + $nodes = $userFolder->getById((int)$fileId); $nodes = array_filter($nodes, static function (Node $node) { return $node->getType() === FileInfo::TYPE_FILE; diff --git a/lib/Listener/DisplayNameListener.php b/lib/Listener/DisplayNameListener.php index d5fd7feea3b..095e02cdc6d 100644 --- a/lib/Listener/DisplayNameListener.php +++ b/lib/Listener/DisplayNameListener.php @@ -31,10 +31,10 @@ public function __construct( public function handle(Event $event): void { if ($event instanceof UserChangedEvent && $event->getFeature() === 'displayName') { - $this->updateCachedName(Attendee::ACTOR_USERS, $event->getUser()->getUID(), (string) $event->getValue()); + $this->updateCachedName(Attendee::ACTOR_USERS, $event->getUser()->getUID(), (string)$event->getValue()); } if ($event instanceof GroupChangedEvent && $event->getFeature() === 'displayName') { - $this->updateCachedName(Attendee::ACTOR_GROUPS, $event->getGroup()->getGID(), (string) $event->getValue()); + $this->updateCachedName(Attendee::ACTOR_GROUPS, $event->getGroup()->getGID(), (string)$event->getValue()); } } diff --git a/lib/Manager.php b/lib/Manager.php index 50a49fda55f..94e67bfd0ba 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -150,7 +150,7 @@ public function createRoomObject(array $row): Room { $assignedSignalingServer = $row['assigned_hpb']; if ($assignedSignalingServer !== null) { - $assignedSignalingServer = (int) $assignedSignalingServer; + $assignedSignalingServer = (int)$assignedSignalingServer; } return new Room( @@ -158,37 +158,37 @@ public function createRoomObject(array $row): Room { $this->db, $this->dispatcher, $this->timeFactory, - (int) $row['r_id'], - (int) $row['type'], - (int) $row['read_only'], - (int) $row['listable'], - (int) $row['message_expiration'], - (int) $row['lobby_state'], - (int) $row['sip_enabled'], + (int)$row['r_id'], + (int)$row['type'], + (int)$row['read_only'], + (int)$row['listable'], + (int)$row['message_expiration'], + (int)$row['lobby_state'], + (int)$row['sip_enabled'], $assignedSignalingServer, - (string) $row['token'], - (string) $row['name'], - (string) $row['description'], - (string) $row['password'], - (string) $row['avatar'], - (string) $row['remote_server'], - (string) $row['remote_token'], - (int) $row['default_permissions'], - (int) $row['call_permissions'], - (int) $row['call_flag'], + (string)$row['token'], + (string)$row['name'], + (string)$row['description'], + (string)$row['password'], + (string)$row['avatar'], + (string)$row['remote_server'], + (string)$row['remote_token'], + (int)$row['default_permissions'], + (int)$row['call_permissions'], + (int)$row['call_flag'], $activeSince, $lastActivity, - (int) $row['last_message'], + (int)$row['last_message'], $lastMessage, $lobbyTimer, - (string) $row['object_type'], - (string) $row['object_id'], - (int) $row['breakout_room_mode'], - (int) $row['breakout_room_status'], - (int) $row['call_recording'], - (int) $row['recording_consent'], - (int) $row['has_federation'], - (int) $row['mention_permissions'], + (string)$row['object_type'], + (string)$row['object_id'], + (int)$row['breakout_room_mode'], + (int)$row['breakout_room_status'], + (int)$row['call_recording'], + (int)$row['recording_consent'], + (int)$row['has_federation'], + (int)$row['mention_permissions'], ); } @@ -1219,7 +1219,7 @@ protected function getRoomNameByParticipants(Room $room): string { * @return string */ protected function getNewToken(): string { - $entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', '8'); + $entropy = (int)$this->config->getAppValue('spreed', 'token_entropy', '8'); $entropy = max(8, $entropy); // For update cases $digitsOnly = $this->talkConfig->isSIPConfigured(); if ($digitsOnly) { @@ -1250,7 +1250,7 @@ protected function getNewToken(): string { } $entropy++; - $this->config->setAppValue('spreed', 'token_entropy', (string) $entropy); + $this->config->setAppValue('spreed', 'token_entropy', (string)$entropy); return $this->generateNewToken($query, $entropy, $digitsOnly); } diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php index f4e65769b16..26e94f1f702 100644 --- a/lib/MatterbridgeManager.php +++ b/lib/MatterbridgeManager.php @@ -161,12 +161,12 @@ public function checkAllBridges(): void { $result = $query->executeQuery(); while ($row = $result->fetch()) { $bridge = [ - 'enabled' => (bool) $row['enabled'], - 'pid' => (int) $row['pid'], + 'enabled' => (bool)$row['enabled'], + 'pid' => (int)$row['pid'], 'parts' => json_decode($row['json_values'], true), ]; try { - $room = $this->manager->getRoomById((int) $row['room_id']); + $room = $this->manager->getRoomById((int)$row['room_id']); } catch (RoomNotFoundException $e) { continue; } @@ -519,7 +519,7 @@ private function cleanUrl(string $url): string { private function checkBridgeProcess(Room $room, array $bridge, bool $relaunch = true): int { $pid = 0; - if (isset($bridge['pid']) && (int) $bridge['pid'] !== 0) { + if (isset($bridge['pid']) && (int)$bridge['pid'] !== 0) { // config : there is a PID stored $isRunning = $this->isRunning($bridge['pid']); // if bridge running and enabled is false : kill it @@ -676,7 +676,7 @@ private function launchMatterbridge(Room $room): int { $cmdResult = $this->runCommand($cmd); if (!is_null($cmdResult) && $cmdResult['return_code'] === 0 && is_numeric($cmdResult['stdout'] ?? 0)) { - return (int) $cmdResult['stdout']; + return (int)$cmdResult['stdout']; } return 0; } @@ -696,7 +696,7 @@ public function killZombieBridges(bool $killAll = false): void { if (preg_match('/matterbridge/i', $l)) { $items = preg_split('/\s+/', $l); if (count($items) > 1 && is_numeric($items[1])) { - $runningPidList[] = (int) $items[1]; + $runningPidList[] = (int)$items[1]; } } } @@ -724,7 +724,7 @@ public function killZombieBridges(bool $killAll = false): void { $result = $query->executeQuery(); while ($row = $result->fetch()) { - $expectedPidList[] = (int) $row['pid']; + $expectedPidList[] = (int)$row['pid']; } $result->closeCursor(); @@ -765,7 +765,7 @@ private function isRunning(int $pid): bool { foreach ($lines as $l) { $items = preg_split('/\s+/', $l); if (count($items) > 1 && is_numeric($items[1])) { - $lPid = (int) $items[1]; + $lPid = (int)$items[1]; if ($lPid === $pid) { return true; } @@ -840,8 +840,8 @@ private function getBridgeFromDb(Room $room): array { $pid = 0; $jsonValues = '[]'; if ($row = $result->fetch()) { - $pid = (int) $row['pid']; - $enabled = ((int) $row['enabled'] === 1); + $pid = (int)$row['pid']; + $enabled = ((int)$row['enabled'] === 1); $jsonValues = $row['json_values']; } $result->closeCursor(); diff --git a/lib/Middleware/CanUseTalkMiddleware.php b/lib/Middleware/CanUseTalkMiddleware.php index 8bec755677c..351f0c719a9 100644 --- a/lib/Middleware/CanUseTalkMiddleware.php +++ b/lib/Middleware/CanUseTalkMiddleware.php @@ -91,7 +91,7 @@ public function beforeController(Controller $controller, string $methodName): vo $hasAttribute = !empty($reflectionMethod->getAttributes(RequireCallEnabled::class)); if ($hasAttribute - && ((int) $this->serverConfig->getAppValue('spreed', 'start_calls')) === Room::START_CALL_NOONE) { + && ((int)$this->serverConfig->getAppValue('spreed', 'start_calls')) === Room::START_CALL_NOONE) { throw new CanNotUseTalkException(); } } diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php index 1f2e79b6e35..9ff0550b226 100644 --- a/lib/Middleware/InjectionMiddleware.php +++ b/lib/Middleware/InjectionMiddleware.php @@ -93,7 +93,7 @@ public function beforeController(Controller $controller, string $methodName): vo $reflectionMethod = new \ReflectionMethod($controller, $methodName); $apiVersion = $this->request->getParam('apiVersion'); - $controller->setAPIVersion((int) substr($apiVersion, 1)); + $controller->setAPIVersion((int)substr($apiVersion, 1)); if (!empty($reflectionMethod->getAttributes(AllowWithoutParticipantWhenPendingInvitation::class))) { try { diff --git a/lib/Migration/ClearResourceAccessCache.php b/lib/Migration/ClearResourceAccessCache.php index b4881470855..1adaa9156cc 100644 --- a/lib/Migration/ClearResourceAccessCache.php +++ b/lib/Migration/ClearResourceAccessCache.php @@ -29,7 +29,7 @@ public function getName(): string { } public function run(IOutput $output): void { - $invalidatedCache = (int) $this->config->getAppValue('spreed', 'project_access_invalidated', '0'); + $invalidatedCache = (int)$this->config->getAppValue('spreed', 'project_access_invalidated', '0'); if ($invalidatedCache === self::INVALIDATIONS) { $output->info('Invalidation not required'); @@ -37,6 +37,6 @@ public function run(IOutput $output): void { } $this->manager->invalidateAccessCacheForProvider($this->provider); - $this->config->setAppValue('spreed', 'project_access_invalidated', (string) self::INVALIDATIONS); + $this->config->setAppValue('spreed', 'project_access_invalidated', (string)self::INVALIDATIONS); } } diff --git a/lib/Migration/Version10000Date20201015134000.php b/lib/Migration/Version10000Date20201015134000.php index 07766013356..b091c6f437a 100644 --- a/lib/Migration/Version10000Date20201015134000.php +++ b/lib/Migration/Version10000Date20201015134000.php @@ -191,15 +191,15 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array } $insert - ->setParameter('room_id', (int) $row['room_id'], IQueryBuilder::PARAM_INT) + ->setParameter('room_id', (int)$row['room_id'], IQueryBuilder::PARAM_INT) ->setParameter('actor_type', Attendee::ACTOR_USERS) ->setParameter('actor_id', $row['user_id']) - ->setParameter('participant_type', (int) $row['participant_type'], IQueryBuilder::PARAM_INT) - ->setParameter('favorite', (bool) $row['favorite'], IQueryBuilder::PARAM_BOOL) - ->setParameter('notification_level', (int) $row['notification_level'], IQueryBuilder::PARAM_INT) + ->setParameter('participant_type', (int)$row['participant_type'], IQueryBuilder::PARAM_INT) + ->setParameter('favorite', (bool)$row['favorite'], IQueryBuilder::PARAM_BOOL) + ->setParameter('notification_level', (int)$row['notification_level'], IQueryBuilder::PARAM_INT) ->setParameter('last_joined_call', $lastJoinedCall, IQueryBuilder::PARAM_INT) - ->setParameter('last_read_message', (int) $row['last_read_message'], IQueryBuilder::PARAM_INT) - ->setParameter('last_mention_message', (int) $row['last_mention_message'], IQueryBuilder::PARAM_INT) + ->setParameter('last_read_message', (int)$row['last_read_message'], IQueryBuilder::PARAM_INT) + ->setParameter('last_mention_message', (int)$row['last_mention_message'], IQueryBuilder::PARAM_INT) ; try { diff --git a/lib/Migration/Version14000Date20220330141647.php b/lib/Migration/Version14000Date20220330141647.php index e3a0082d12b..b122b3bcd38 100644 --- a/lib/Migration/Version14000Date20220330141647.php +++ b/lib/Migration/Version14000Date20220330141647.php @@ -118,8 +118,8 @@ protected function chunkedWriting(IQueryBuilder $insert, IQueryBuilder $select, $result = $select->executeQuery(); while ($row = $result->fetch()) { $attachment = [ - 'room_id' => (int) $row['object_id'], - 'message_id' => (int) $row['id'], + 'room_id' => (int)$row['object_id'], + 'message_id' => (int)$row['id'], 'actor_type' => $row['actor_type'], 'actor_id' => $row['actor_id'], ]; @@ -152,13 +152,13 @@ protected function chunkedWriting(IQueryBuilder $insert, IQueryBuilder $select, $attachment['object_type'] = Attachment::TYPE_MEDIA; } else { if ($mimetype === '' && isset($parameters['share'])) { - $sharesWithoutMimetype[(int) $parameters['share']] = (int) $row['id']; + $sharesWithoutMimetype[(int)$parameters['share']] = (int)$row['id']; } $attachment['object_type'] = Attachment::TYPE_FILE; } } - $attachments[(int) $row['id']] = $attachment; + $attachments[(int)$row['id']] = $attachment; } $result->closeCursor(); diff --git a/lib/Migration/Version2000Date20171026140256.php b/lib/Migration/Version2000Date20171026140256.php index d16c36e1805..1f32a8cf482 100644 --- a/lib/Migration/Version2000Date20171026140256.php +++ b/lib/Migration/Version2000Date20171026140256.php @@ -53,7 +53,7 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array continue; } - $update->setParameter('room_id', (int) $row['id'], IQueryBuilder::PARAM_INT) + $update->setParameter('room_id', (int)$row['id'], IQueryBuilder::PARAM_INT) ->executeStatement(); } $output->finishProgress(); diff --git a/lib/Migration/Version2000Date20171026140257.php b/lib/Migration/Version2000Date20171026140257.php index 114afa645fe..d668db5103e 100644 --- a/lib/Migration/Version2000Date20171026140257.php +++ b/lib/Migration/Version2000Date20171026140257.php @@ -40,7 +40,7 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array } $chars = str_replace(['l', '0', '1'], '', ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS); - $entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', '8'); + $entropy = (int)$this->config->getAppValue('spreed', 'token_entropy', '8'); $update = $this->connection->getQueryBuilder(); $update->update('spreedme_rooms') @@ -61,7 +61,7 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $token = $this->getNewToken($entropy, $chars); $update->setParameter('token', $token) - ->setParameter('room_id', (int) $row['id'], IQueryBuilder::PARAM_INT) + ->setParameter('room_id', (int)$row['id'], IQueryBuilder::PARAM_INT) ->executeStatement(); } $output->finishProgress(); diff --git a/lib/Migration/Version2001Date20170707115443.php b/lib/Migration/Version2001Date20170707115443.php index 8782656acc4..581d1632fc6 100644 --- a/lib/Migration/Version2001Date20170707115443.php +++ b/lib/Migration/Version2001Date20170707115443.php @@ -65,9 +65,9 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $query->selectAlias($query->createFunction('COUNT(*)'), 'num_rooms') ->from('spreedme_rooms'); $result = $query->executeQuery(); - $return = (int) $result->fetch(); + $return = (int)$result->fetch(); $result->closeCursor(); - $numRooms = (int) $return['num_rooms']; + $numRooms = (int)$return['num_rooms']; if ($numRooms === 0) { return; @@ -80,7 +80,7 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $one2oneRooms = []; while ($row = $result->fetch()) { - $one2oneRooms[] = (int) $row['id']; + $one2oneRooms[] = (int)$row['id']; } $result->closeCursor(); diff --git a/lib/Migration/Version2001Date20171026134605.php b/lib/Migration/Version2001Date20171026134605.php index f32388c8d2a..34e960be3bd 100644 --- a/lib/Migration/Version2001Date20171026134605.php +++ b/lib/Migration/Version2001Date20171026134605.php @@ -176,7 +176,7 @@ protected function copyRooms(): array { $insert ->setParameter('name', $row['name']) ->setParameter('token', $row['token']) - ->setParameter('type', (int) $row['type'], IQueryBuilder::PARAM_INT) + ->setParameter('type', (int)$row['type'], IQueryBuilder::PARAM_INT) ->setParameter('password', $row['password']); $insert->executeStatement(); @@ -218,20 +218,20 @@ protected function copyParticipants(array $roomIdMap): void { $result = $query->executeQuery(); while ($row = $result->fetch()) { - if (!isset($roomIdMap[(int) $row['roomId']])) { + if (!isset($roomIdMap[(int)$row['roomId']])) { continue; } $insert ->setParameter('userId', $row['userId']) - ->setParameter('roomId', $roomIdMap[(int) $row['roomId']], IQueryBuilder::PARAM_INT) - ->setParameter('lastPing', (int) $row['lastPing'], IQueryBuilder::PARAM_INT) + ->setParameter('roomId', $roomIdMap[(int)$row['roomId']], IQueryBuilder::PARAM_INT) + ->setParameter('lastPing', (int)$row['lastPing'], IQueryBuilder::PARAM_INT) ->setParameter('sessionId', $row['sessionId']) ; if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) { - $insert->setParameter('participantType', (int) $row['participantType'], IQueryBuilder::PARAM_INT); + $insert->setParameter('participantType', (int)$row['participantType'], IQueryBuilder::PARAM_INT); } else { - $insert->setParameter('participantType', (int) $row['participanttype'], IQueryBuilder::PARAM_INT); + $insert->setParameter('participantType', (int)$row['participanttype'], IQueryBuilder::PARAM_INT); } $insert->executeStatement(); } @@ -264,17 +264,17 @@ protected function fixNotifications(array $roomIdMap): void { } while ($row = $result->fetch()) { - if (!isset($roomIdMap[(int) $row['object_id']])) { + if (!isset($roomIdMap[(int)$row['object_id']])) { $delete - ->setParameter('id', (int) $row['notification_id']) + ->setParameter('id', (int)$row['notification_id']) ; $delete->executeStatement(); continue; } $update - ->setParameter('id', (int) $row['notification_id']) - ->setParameter('newId', $roomIdMap[(int) $row['object_id']]) + ->setParameter('id', (int)$row['notification_id']) + ->setParameter('newId', $roomIdMap[(int)$row['object_id']]) ; $update->executeStatement(); } @@ -309,9 +309,9 @@ protected function fixActivities(array $roomIdMap): void { } while ($row = $result->fetch()) { - if (!isset($roomIdMap[(int) $row['object_id']])) { + if (!isset($roomIdMap[(int)$row['object_id']])) { $delete - ->setParameter('id', (int) $row['activity_id']) + ->setParameter('id', (int)$row['activity_id']) ; $delete->executeStatement(); continue; @@ -321,17 +321,17 @@ protected function fixActivities(array $roomIdMap): void { if (!isset($params['room'])) { $delete - ->setParameter('id', (int) $row['activity_id']) + ->setParameter('id', (int)$row['activity_id']) ; $delete->executeStatement(); continue; } - $params['room'] = $roomIdMap[(int) $row['object_id']]; + $params['room'] = $roomIdMap[(int)$row['object_id']]; $update - ->setParameter('id', (int) $row['activity_id']) - ->setParameter('newId', $roomIdMap[(int) $row['object_id']]) + ->setParameter('id', (int)$row['activity_id']) + ->setParameter('newId', $roomIdMap[(int)$row['object_id']]) ->setParameter('subjectParams', json_encode($params)) ; $update->executeStatement(); @@ -367,18 +367,18 @@ protected function fixActivityMails(array $roomIdMap): void { while ($row = $result->fetch()) { $params = json_decode($row['subjectparams'], true); - if (!isset($params['room']) || !isset($roomIdMap[(int) $params['room']])) { + if (!isset($params['room']) || !isset($roomIdMap[(int)$params['room']])) { $delete - ->setParameter('id', (int) $row['mail_id']) + ->setParameter('id', (int)$row['mail_id']) ; $delete->executeStatement(); continue; } - $params['room'] = $roomIdMap[(int) $params['room']]; + $params['room'] = $roomIdMap[(int)$params['room']]; $update - ->setParameter('id', (int) $row['mail_id']) + ->setParameter('id', (int)$row['mail_id']) ->setParameter('subjectParams', json_encode($params)) ; $update->executeStatement(); diff --git a/lib/Migration/Version7000Date20190724121136.php b/lib/Migration/Version7000Date20190724121136.php index 4ec4c4cffda..51fd6beb2bf 100644 --- a/lib/Migration/Version7000Date20190724121136.php +++ b/lib/Migration/Version7000Date20190724121136.php @@ -79,9 +79,9 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $result = $query->executeQuery(); while ($row = $result->fetch()) { - $update->setParameter('message_id', (int) $row['last_comment'], IQueryBuilder::PARAM_INT) + $update->setParameter('message_id', (int)$row['last_comment'], IQueryBuilder::PARAM_INT) ->setParameter('user_id', $row['user_id']) - ->setParameter('room_id', (int) $row['object_id'], IQueryBuilder::PARAM_INT); + ->setParameter('room_id', (int)$row['object_id'], IQueryBuilder::PARAM_INT); $update->executeStatement(); } $result->closeCursor(); diff --git a/lib/Migration/Version7000Date20190724121137.php b/lib/Migration/Version7000Date20190724121137.php index 4b27f387ed4..7695a244201 100644 --- a/lib/Migration/Version7000Date20190724121137.php +++ b/lib/Migration/Version7000Date20190724121137.php @@ -50,9 +50,9 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $result = $query->executeQuery(); while ($row = $result->fetch()) { - $update->setParameter('message_id', (int) $row['last_mention_message'], IQueryBuilder::PARAM_INT) + $update->setParameter('message_id', (int)$row['last_mention_message'], IQueryBuilder::PARAM_INT) ->setParameter('user_id', $row['user_id']) - ->setParameter('room_id', (int) $row['room_id'], IQueryBuilder::PARAM_INT); + ->setParameter('room_id', (int)$row['room_id'], IQueryBuilder::PARAM_INT); $update->executeStatement(); } $result->closeCursor(); diff --git a/lib/Model/AttachmentMapper.php b/lib/Model/AttachmentMapper.php index 0ae4ab17f89..c41a30be10b 100644 --- a/lib/Model/AttachmentMapper.php +++ b/lib/Model/AttachmentMapper.php @@ -31,13 +31,13 @@ public function __construct(IDBConnection $db) { public function createAttachmentFromRow(array $row): Attachment { return $this->mapRowToEntity([ - 'id' => (int) $row['id'], - 'room_id' => (int) $row['room_id'], - 'message_id' => (int) $row['message_id'], - 'message_time' => (int) $row['message_time'], - 'object_type' => (string) $row['object_type'], - 'actor_type' => (string) $row['actor_type'], - 'actor_id' => (string) $row['actor_id'], + 'id' => (int)$row['id'], + 'room_id' => (int)$row['room_id'], + 'message_id' => (int)$row['message_id'], + 'message_time' => (int)$row['message_time'], + 'object_type' => (string)$row['object_type'], + 'actor_type' => (string)$row['actor_type'], + 'actor_id' => (string)$row['actor_id'], ]); } diff --git a/lib/Model/Attendee.php b/lib/Model/Attendee.php index dd57df21074..2682c9b44f9 100644 --- a/lib/Model/Attendee.php +++ b/lib/Model/Attendee.php @@ -150,6 +150,6 @@ public function __construct() { } public function getDisplayName(): string { - return (string) $this->displayName; + return (string)$this->displayName; } } diff --git a/lib/Model/AttendeeMapper.php b/lib/Model/AttendeeMapper.php index 8e85de7da9c..2448942ed69 100644 --- a/lib/Model/AttendeeMapper.php +++ b/lib/Model/AttendeeMapper.php @@ -158,7 +158,7 @@ public function getActorsCountByType(int $roomId, string $actorType, ?int $lastJ } $result = $query->executeQuery(); - $count = (int) $result->fetchOne(); + $count = (int)$result->fetchOne(); $result->closeCursor(); return $count; @@ -187,7 +187,7 @@ public function countActorsByParticipantType(int $roomId, array $participantType $row = $result->fetch(); $result->closeCursor(); - return (int) ($row['num_actors'] ?? 0); + return (int)($row['num_actors'] ?? 0); } /** @@ -304,26 +304,26 @@ public function createAttendeeFromRow(array $row): Attendee { 'room_id' => $row['room_id'], 'actor_type' => $row['actor_type'], 'actor_id' => $row['actor_id'], - 'display_name' => (string) $row['display_name'], + 'display_name' => (string)$row['display_name'], 'pin' => $row['pin'], - 'participant_type' => (int) $row['participant_type'], - 'favorite' => (bool) $row['favorite'], - 'notification_level' => (int) $row['notification_level'], - 'notification_calls' => (int) $row['notification_calls'], - 'last_joined_call' => (int) $row['last_joined_call'], - 'last_read_message' => (int) $row['last_read_message'], - 'last_mention_message' => (int) $row['last_mention_message'], - 'last_mention_direct' => (int) $row['last_mention_direct'], - 'read_privacy' => (int) $row['read_privacy'], - 'permissions' => (int) $row['permissions'], - 'access_token' => (string) $row['access_token'], - 'remote_id' => (string) $row['remote_id'], - 'invited_cloud_id' => (string) $row['invited_cloud_id'], + 'participant_type' => (int)$row['participant_type'], + 'favorite' => (bool)$row['favorite'], + 'notification_level' => (int)$row['notification_level'], + 'notification_calls' => (int)$row['notification_calls'], + 'last_joined_call' => (int)$row['last_joined_call'], + 'last_read_message' => (int)$row['last_read_message'], + 'last_mention_message' => (int)$row['last_mention_message'], + 'last_mention_direct' => (int)$row['last_mention_direct'], + 'read_privacy' => (int)$row['read_privacy'], + 'permissions' => (int)$row['permissions'], + 'access_token' => (string)$row['access_token'], + 'remote_id' => (string)$row['remote_id'], + 'invited_cloud_id' => (string)$row['invited_cloud_id'], 'phone_number' => $row['phone_number'], 'call_id' => $row['call_id'], - 'state' => (int) $row['state'], - 'unread_messages' => (int) $row['unread_messages'], - 'last_attendee_activity' => (int) $row['last_attendee_activity'], + 'state' => (int)$row['state'], + 'unread_messages' => (int)$row['unread_messages'], + 'last_attendee_activity' => (int)$row['last_attendee_activity'], ]); } } diff --git a/lib/Model/InvitationMapper.php b/lib/Model/InvitationMapper.php index 73e9d7d83c7..b64a33f090a 100644 --- a/lib/Model/InvitationMapper.php +++ b/lib/Model/InvitationMapper.php @@ -93,7 +93,7 @@ public function countInvitationsForUser(IUser $user, ?int $state = null): int { } $result = $qb->executeQuery(); - $count = (int) $result->fetchOne(); + $count = (int)$result->fetchOne(); $result->closeCursor(); return $count; @@ -128,6 +128,6 @@ public function countInvitationsForLocalRoom(Room $room): int { $row = $result->fetch(); $result->closeCursor(); - return (int) ($row['num_invitations'] ?? 0); + return (int)($row['num_invitations'] ?? 0); } } diff --git a/lib/Model/Message.php b/lib/Model/Message.php index c1407bd2e29..9743f86e552 100644 --- a/lib/Model/Message.php +++ b/lib/Model/Message.php @@ -95,7 +95,7 @@ public function getParticipant(): ?Participant { */ public function getMessageId(): int { - return $this->comment ? (int) $this->comment->getId() : $this->proxy->getRemoteMessageId(); + return $this->comment ? (int)$this->comment->getId() : $this->proxy->getRemoteMessageId(); } public function getExpirationDateTime(): ?\DateTimeInterface { @@ -194,7 +194,7 @@ public function toArray(string $format): array { } $data = [ - 'id' => (int) $this->getComment()->getId(), + 'id' => (int)$this->getComment()->getId(), 'token' => $this->getRoom()->getToken(), 'actorType' => $this->getActorType(), 'actorId' => $this->getActorId(), @@ -205,7 +205,7 @@ public function toArray(string $format): array { 'systemMessage' => $this->getMessageType() === ChatManager::VERB_SYSTEM ? $this->getMessageRaw() : '', 'messageType' => $this->getMessageType(), 'isReplyable' => $this->isReplyable(), - 'referenceId' => (string) $this->getComment()->getReferenceId(), + 'referenceId' => (string)$this->getComment()->getReferenceId(), 'reactions' => $reactions, 'expirationTimestamp' => $expireDate ? $expireDate->getTimestamp() : 0, 'markdown' => $this->getMessageType() === ChatManager::VERB_SYSTEM ? false : true, diff --git a/lib/Model/SessionMapper.php b/lib/Model/SessionMapper.php index 99b7ff25f18..553dd62088a 100644 --- a/lib/Model/SessionMapper.php +++ b/lib/Model/SessionMapper.php @@ -91,10 +91,10 @@ public function createSessionFromRow(array $row): Session { return $this->mapRowToEntity([ 'id' => $row['s_id'], 'session_id' => $row['session_id'], - 'attendee_id' => (int) $row['a_id'], - 'in_call' => (int) $row['in_call'], - 'last_ping' => (int) $row['last_ping'], - 'state' => (int) $row['s_state'], + 'attendee_id' => (int)$row['a_id'], + 'in_call' => (int)$row['in_call'], + 'last_ping' => (int)$row['last_ping'], + 'state' => (int)$row['s_state'], ]); } } diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 7ffd454d81e..9e4e27983a0 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -133,7 +133,7 @@ protected function getRoom(string $objectId, string $userId): Room { try { // Before 3.2.3 the id was passed in notifications - $room = $this->manager->getRoomById((int) $objectId); + $room = $this->manager->getRoomById((int)$objectId); $this->rooms[$objectId] = $room; return $room; } catch (RoomNotFoundException $e) { @@ -401,7 +401,7 @@ protected function parseRemoteInvitationMessage(INotification $notification, IL1 $subjectParameters = $notification->getSubjectParameters(); try { - $invite = $this->federationManager->getRemoteShareById((int) $notification->getObjectId()); + $invite = $this->federationManager->getRemoteShareById((int)$notification->getObjectId()); if ($invite->getUserId() !== $notification->getUser()) { throw new AlreadyProcessedException(); } @@ -441,7 +441,7 @@ protected function parseRemoteInvitationMessage(INotification $notification, IL1 $acceptAction->setParsedLabel($l->t('Accept')); $acceptAction->setLink($this->url->linkToOCSRouteAbsolute( 'spreed.Federation.acceptShare', - ['apiVersion' => 'v1', 'id' => (int) $notification->getObjectId()] + ['apiVersion' => 'v1', 'id' => (int)$notification->getObjectId()] ), IAction::TYPE_POST); $acceptAction->setPrimary(true); $notification->addParsedAction($acceptAction); @@ -450,7 +450,7 @@ protected function parseRemoteInvitationMessage(INotification $notification, IL1 $declineAction->setParsedLabel($l->t('Decline')); $declineAction->setLink($this->url->linkToOCSRouteAbsolute( 'spreed.Federation.rejectShare', - ['apiVersion' => 'v1', 'id' => (int) $notification->getObjectId()] + ['apiVersion' => 'v1', 'id' => (int)$notification->getObjectId()] ), IAction::TYPE_DELETE); $notification->addParsedAction($declineAction); @@ -488,7 +488,7 @@ protected function parseChatMessage(INotification $notification, Room $room, Par * @see Listener::markReactionNotificationsRead() */ && $notification->getSubject() !== 'reaction' - && ((int) $messageParameters['commentId']) <= $participant->getAttendee()->getLastReadMessage()) { + && ((int)$messageParameters['commentId']) <= $participant->getAttendee()->getLastReadMessage()) { // Mark notifications of messages that are read as processed throw new AlreadyProcessedException(); } diff --git a/lib/Participant.php b/lib/Participant.php index 11f6f7364fd..f56495491be 100644 --- a/lib/Participant.php +++ b/lib/Participant.php @@ -80,7 +80,7 @@ public function canStartCall(IConfig $config): bool { return false; } - $defaultStartCall = (int) $config->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE); + $defaultStartCall = (int)$config->getAppValue('spreed', 'start_calls', (string)Room::START_CALL_EVERYONE); if ($defaultStartCall === Room::START_CALL_NOONE) { return false; diff --git a/lib/Recording/BackendNotifier.php b/lib/Recording/BackendNotifier.php index 75c62cc045b..590d78bb966 100644 --- a/lib/Recording/BackendNotifier.php +++ b/lib/Recording/BackendNotifier.php @@ -50,7 +50,7 @@ protected function doRequest(string $url, array $params, int $retries = 3): void $client = $this->clientService->newClient(); try { $response = $client->post($url, $params); - } catch (ServerException | ConnectException $e) { + } catch (ServerException|ConnectException $e) { if ($retries > 1) { $this->logger->error('Failed to send message to recording server, ' . $retries . ' retries left!', ['exception' => $e]); $this->doRequest($url, $params, $retries - 1); diff --git a/lib/Room.php b/lib/Room.php index 3c1a6d0d021..aa5ae0b02f7 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -156,9 +156,9 @@ public function getReadOnly(): int { /** * @param int $readOnly Currently it is only allowed to change between - * `self::READ_ONLY` and `self::READ_WRITE` - * Also it's only allowed on rooms of type - * `self::TYPE_GROUP` and `self::TYPE_PUBLIC` + * `self::READ_ONLY` and `self::READ_WRITE` + * Also it's only allowed on rooms of type + * `self::TYPE_GROUP` and `self::TYPE_PUBLIC` */ public function setReadOnly(int $readOnly): void { $this->readOnly = $readOnly; @@ -170,8 +170,8 @@ public function getListable(): int { /** * @param int $newState New listable scope from self::LISTABLE_* - * Also it's only allowed on rooms of type - * `self::TYPE_GROUP` and `self::TYPE_PUBLIC` + * Also it's only allowed on rooms of type + * `self::TYPE_GROUP` and `self::TYPE_PUBLIC` */ public function setListable(int $newState): void { $this->listable = $newState; @@ -362,7 +362,7 @@ public function getLastMessage(): ?IComment { public function setLastMessage(IComment $message): void { $this->lastMessage = $message; - $this->lastMessageId = (int) $message->getId(); + $this->lastMessageId = (int)$message->getId(); } public function getObjectType(): string { diff --git a/lib/Search/MessageSearch.php b/lib/Search/MessageSearch.php index 8fad0078bc4..00e1ed5c6a9 100644 --- a/lib/Search/MessageSearch.php +++ b/lib/Search/MessageSearch.php @@ -159,7 +159,7 @@ public function performSearch(IUser $user, ISearchQuery $query, string $title, a continue; } - $roomMap[(string) $room->getId()] = $room; + $roomMap[(string)$room->getId()] = $room; } if (empty($roomMap)) { @@ -187,7 +187,7 @@ public function performSearch(IUser $user, ISearchQuery $query, string $title, a } } - $offset = (int) $query->getCursor(); + $offset = (int)$query->getCursor(); $comments = $this->chatManager->searchForObjectsWithFilters( $query->getTerm(), array_keys($roomMap), @@ -223,7 +223,7 @@ public function performSearch(IUser $user, ISearchQuery $query, string $title, a protected function commentToSearchResultEntry(Room $room, IUser $user, IComment $comment, ISearchQuery $query): SearchResultEntry { $participant = $this->participantService->getParticipant($room, $user->getUID(), false); - $id = (int) $comment->getId(); + $id = (int)$comment->getId(); $message = $this->messageParser->createMessage($room, $participant, $comment, $this->l); $this->messageParser->parseMessage($message); diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php index ae312972623..1f4e98c5763 100644 --- a/lib/Service/AttachmentService.php +++ b/lib/Service/AttachmentService.php @@ -27,7 +27,7 @@ public function createAttachmentEntry(Room $room, IComment $comment, string $mes $attachment->setRoomId($room->getId()); $attachment->setActorType($comment->getActorType()); $attachment->setActorId($comment->getActorId()); - $attachment->setMessageId((int) $comment->getId()); + $attachment->setMessageId((int)$comment->getId()); $attachment->setMessageTime($comment->getCreationDateTime()->getTimestamp()); if ($messageType === 'object_shared') { diff --git a/lib/Service/BotService.php b/lib/Service/BotService.php index 16902f8278a..952e5cdcf90 100644 --- a/lib/Service/BotService.php +++ b/lib/Service/BotService.php @@ -175,7 +175,7 @@ public function afterSystemMessageSent(SystemMessageSentEvent $event, MessagePar /** * @param BotServer $botServer * @param array $body - * #param string|null $jsonBody + * #param string|null $jsonBody */ protected function sendAsyncRequest(BotServer $botServer, array $body, ?string $jsonBody = null): void { $jsonBody = $jsonBody ?? json_encode($body, JSON_THROW_ON_ERROR); diff --git a/lib/Service/BreakoutRoomService.php b/lib/Service/BreakoutRoomService.php index 6841c0b01a2..5cc0b38c062 100644 --- a/lib/Service/BreakoutRoomService.php +++ b/lib/Service/BreakoutRoomService.php @@ -159,7 +159,7 @@ public function setupBreakoutRooms(Room $parent, int $mode, int $amount, string continue; } - $roomNumber = (int) $cleanedMap[$participant->getAttendee()->getId()]; + $roomNumber = (int)$cleanedMap[$participant->getAttendee()->getId()]; $map[$roomNumber] ??= []; $map[$roomNumber][] = $participant; @@ -233,7 +233,7 @@ public function applyAttendeeMap(Room $parent, string $attendeeMap): array { continue; } - $roomNumber = (int) $cleanedMap[$participant->getAttendee()->getId()]; + $roomNumber = (int)$cleanedMap[$participant->getAttendee()->getId()]; $map[$roomNumber] ??= []; $map[$roomNumber][] = $participant; @@ -305,7 +305,7 @@ protected function createBreakoutRooms(Room $parent, int $amount): array { for ($i = 1; $i <= $amount; $i++) { $breakoutRoom = $this->roomService->createConversation( $parent->getType(), - str_replace('{number}', (string) $i, $label), + str_replace('{number}', (string)$i, $label), null, BreakoutRoom::PARENT_OBJECT_TYPE, $parent->getToken() diff --git a/lib/Service/HostedSignalingServerService.php b/lib/Service/HostedSignalingServerService.php index 780160328f2..ced215c1b3c 100644 --- a/lib/Service/HostedSignalingServerService.php +++ b/lib/Service/HostedSignalingServerService.php @@ -331,7 +331,7 @@ public function fetchAccountInfo(AccountId $accountId) { } $body = $response->getBody(); - $data = (array) json_decode($body, true); + $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); diff --git a/lib/Service/NoteToSelfService.php b/lib/Service/NoteToSelfService.php index 39759c9af34..66ce48d2ef4 100644 --- a/lib/Service/NoteToSelfService.php +++ b/lib/Service/NoteToSelfService.php @@ -79,7 +79,7 @@ protected function createNoteToSelfConversation(IUser $user, string|int $previou ); try { - $this->config->setUserValue($user->getUID(), 'spreed', 'note_to_self', (string) $room->getId(), (string) $previousValue); + $this->config->setUserValue($user->getUID(), 'spreed', 'note_to_self', (string)$room->getId(), (string)$previousValue); } catch (PreConditionNotMetException $e) { // This process didn't win the race for creating the conversation, so fetch the other one $this->roomService->deleteRoom($room); @@ -113,6 +113,6 @@ protected function createNoteToSelfConversation(IUser $user, string|int $previou } protected function getNoteToSelfConversationId(string $userId): int { - return (int) $this->config->getUserValue($userId, 'spreed', 'note_to_self', '0'); + return (int)$this->config->getUserValue($userId, 'spreed', 'note_to_self', '0'); } } diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 9e8214d8841..6292a5fe96e 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -413,7 +413,7 @@ public function joinRoomAsNewGuest(RoomService $roomService, Room $room, string $lastMessage = 0; if ($room->getLastMessage() instanceof IComment) { - $lastMessage = (int) $room->getLastMessage()->getId(); + $lastMessage = (int)$room->getLastMessage()->getId(); } if ($previousParticipant instanceof Participant) { @@ -465,7 +465,7 @@ public function addUsers(Room $room, array $participants, ?IUser $addedBy = null $lastMessage = 0; if ($room->getLastMessage() instanceof IComment) { - $lastMessage = (int) $room->getLastMessage()->getId(); + $lastMessage = (int)$room->getLastMessage()->getId(); } $bannedUserIds = []; @@ -531,7 +531,7 @@ public function addUsers(Room $room, array $participants, ?IUser $addedBy = null $this->attendeeMapper->insert($attendee); if ($attendee->getActorType() === Attendee::ACTOR_FEDERATED_USERS) { - $response = $this->backendNotifier->sendRemoteShare((string) $attendee->getId(), $attendee->getAccessToken(), $attendee->getActorId(), $addedBy, 'user', $room, $this->getHighestPermissionAttendee($room)); + $response = $this->backendNotifier->sendRemoteShare((string)$attendee->getId(), $attendee->getAccessToken(), $attendee->getActorId(), $addedBy, 'user', $room, $this->getHighestPermissionAttendee($room)); if (!$response) { $this->attendeeMapper->delete($attendee); throw new CannotReachRemoteException(); @@ -794,7 +794,7 @@ public function addCircle(Room $room, Circle $circle, array $existingParticipant public function inviteEmailAddress(Room $room, string $email): Participant { $lastMessage = 0; if ($room->getLastMessage() instanceof IComment) { - $lastMessage = (int) $room->getLastMessage()->getId(); + $lastMessage = (int)$room->getLastMessage()->getId(); } $attendee = new Attendee(); @@ -1087,7 +1087,7 @@ public function cleanGuestParticipants(Room $room): void { $sessionTableIds = []; $result = $query->executeQuery(); while ($row = $result->fetch()) { - $sessionTableIds[] = (int) $row['s_id']; + $sessionTableIds[] = (int)$row['s_id']; } $result->closeCursor(); @@ -1112,14 +1112,14 @@ public function cleanGuestParticipants(Room $room): void { continue; } - if ((int) $row['participant_type'] !== Participant::GUEST - || ((int) $row['permissions'] !== Attendee::PERMISSIONS_DEFAULT - && (int) $row['permissions'] !== Attendee::PERMISSIONS_CUSTOM)) { + if ((int)$row['participant_type'] !== Participant::GUEST + || ((int)$row['permissions'] !== Attendee::PERMISSIONS_DEFAULT + && (int)$row['permissions'] !== Attendee::PERMISSIONS_CUSTOM)) { // Keep guests with non-default permissions in case they just reconnect continue; } - $attendeeIds[] = (int) $row['a_id']; + $attendeeIds[] = (int)$row['a_id']; $attendees[] = $this->attendeeMapper->createAttendeeFromRow($row); } $result->closeCursor(); @@ -1415,7 +1415,7 @@ public function getLastCommonReadChatMessage(Room $room): int { $row = $result->fetch(); $result->closeCursor(); - return (int) ($row['last_common_read_message'] ?? 0); + return (int)($row['last_common_read_message'] ?? 0); } /** @@ -1440,7 +1440,7 @@ public function getLastCommonReadChatMessageForMultipleRooms(array $roomIds): ar $query->setParameter('roomIds', $chunk, IQueryBuilder::PARAM_INT_ARRAY); $result = $query->executeQuery(); while ($row = $result->fetch()) { - $commonReads[(int) $row['room_id']] = (int) $row['last_common_read_message']; + $commonReads[(int)$row['room_id']] = (int)$row['last_common_read_message']; } $result->closeCursor(); } @@ -1628,7 +1628,7 @@ protected function getParticipantsForRoomsFromQuery(IQueryBuilder $query, array $participants = []; $result = $query->executeQuery(); while ($row = $result->fetch()) { - $room = $rooms[(int) $row['room_id']] ?? null; + $room = $rooms[(int)$row['room_id']] ?? null; if ($room === null) { continue; } @@ -1815,7 +1815,7 @@ public function hasActiveSessions(Room $room): bool { $row = $result->fetch(); $result->closeCursor(); - return (bool) $row; + return (bool)$row; } public function cacheParticipant(Room $room, Participant $participant): void { @@ -1866,7 +1866,7 @@ public function hasActiveSessionsInCall(Room $room): bool { $row = $result->fetch(); $result->closeCursor(); - return (bool) $row; + return (bool)$row; } protected function generatePin(int $entropy = 7): string { diff --git a/lib/Service/RoomFormatter.php b/lib/Service/RoomFormatter.php index 00b56910649..92d9cee65bf 100644 --- a/lib/Service/RoomFormatter.php +++ b/lib/Service/RoomFormatter.php @@ -393,7 +393,7 @@ public function formatRoomV4( } if ($room->isFederatedConversation()) { - $roomData['attendeeId'] = (int) $attendee->getRemoteId(); + $roomData['attendeeId'] = (int)$attendee->getRemoteId(); $roomData['canLeaveConversation'] = true; } diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index 95921ec4ad9..36d4c8f82f7 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -349,9 +349,9 @@ public function setName(Room $room, string $newName, ?string $oldName = null): b /** * @param Room $room * @param int $newState Currently it is only allowed to change between - * `Webinary::LOBBY_NON_MODERATORS` and `Webinary::LOBBY_NONE` - * Also it's not allowed in one-to-one conversations, - * file conversations and password request conversations. + * `Webinary::LOBBY_NON_MODERATORS` and `Webinary::LOBBY_NONE` + * Also it's not allowed in one-to-one conversations, + * file conversations and password request conversations. * @param \DateTime|null $dateTime * @param bool $timerReached * @param bool $dispatchEvents (Only skip if the room is created in the same PHP request) @@ -421,7 +421,7 @@ public function setAvatar(Room $room, string $avatar): bool { * @param Room $room * @param integer $status 0 none|1 video|2 audio * @param Participant|null $participant the Participant that changed the - * state, null for the current user + * state, null for the current user * @throws InvalidArgumentException When the status is invalid, not Room::RECORDING_* * @throws InvalidArgumentException When trying to start */ @@ -521,9 +521,9 @@ public function setType(Room $room, int $newType, bool $allowSwitchingOneToOne = /** * @param Room $room * @param int $newState Currently it is only allowed to change between - * `Room::READ_ONLY` and `Room::READ_WRITE` - * Also it's only allowed on rooms of type - * `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC` + * `Room::READ_ONLY` and `Room::READ_WRITE` + * Also it's only allowed on rooms of type + * `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC` * @return bool True when the change was valid, false otherwise */ public function setReadOnly(Room $room, int $newState): bool { @@ -563,8 +563,8 @@ public function setReadOnly(Room $room, int $newState): bool { /** * @param Room $room * @param int $newState New listable scope from self::LISTABLE_* - * Also it's only allowed on rooms of type - * `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC` + * Also it's only allowed on rooms of type + * `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC` * @return bool True when the change was valid, false otherwise */ public function setListable(Room $room, int $newState): bool { @@ -654,7 +654,7 @@ public function setAssignedSignalingServer(Room $room, ?int $signalingServer): b $update->andWhere($update->expr()->isNull('assigned_hpb')); } - $updated = (bool) $update->executeStatement(); + $updated = (bool)$update->executeStatement(); if ($updated) { $room->setAssignedSignalingServer($signalingServer); } @@ -848,7 +848,7 @@ public function resetActiveSinceInDatabaseOnly(Room $room): bool { ->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))) ->andWhere($update->expr()->isNotNull('active_since')); - return (bool) $update->executeStatement(); + return (bool)$update->executeStatement(); } /** @@ -928,7 +928,7 @@ public function setActiveSince(Room $room, ?Participant $participant, \DateTime ->set('active_since', $update->createNamedParameter($since, IQueryBuilder::PARAM_DATE)) ->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))) ->andWhere($update->expr()->isNull('active_since')); - $result = (bool) $update->executeStatement(); + $result = (bool)$update->executeStatement(); $room->setActiveSince($since, $callFlag); @@ -946,7 +946,7 @@ public function setActiveSince(Room $room, ?Participant $participant, \DateTime public function setLastMessage(Room $room, IComment $message): void { $update = $this->db->getQueryBuilder(); $update->update('talk_rooms') - ->set('last_message', $update->createNamedParameter((int) $message->getId())) + ->set('last_message', $update->createNamedParameter((int)$message->getId())) ->set('last_activity', $update->createNamedParameter($message->getCreationDateTime(), 'datetime')) ->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))); $update->executeStatement(); @@ -1056,12 +1056,12 @@ public function syncPropertiesFromHostRoom(Room $local, array $host): void { $changed[] = ARoomModifiedEvent::PROPERTY_AVATAR; } } - if (isset($host['lastActivity']) && $host['lastActivity'] !== 0 && $host['lastActivity'] !== ((int) $local->getLastActivity()?->getTimestamp())) { + if (isset($host['lastActivity']) && $host['lastActivity'] !== 0 && $host['lastActivity'] !== ((int)$local->getLastActivity()?->getTimestamp())) { $lastActivity = $this->timeFactory->getDateTime('@' . $host['lastActivity']); $this->setLastActivity($local, $lastActivity); $changed[] = ARoomSyncedEvent::PROPERTY_LAST_ACTIVITY; } - if (isset($host['lobbyState'], $host['lobbyTimer']) && ($host['lobbyState'] !== $local->getLobbyState(false) || $host['lobbyTimer'] !== ((int) $local->getLobbyTimer(false)?->getTimestamp()))) { + if (isset($host['lobbyState'], $host['lobbyTimer']) && ($host['lobbyState'] !== $local->getLobbyState(false) || $host['lobbyTimer'] !== ((int)$local->getLobbyTimer(false)?->getTimestamp()))) { $hostTimer = $host['lobbyTimer'] === 0 ? null : $this->timeFactory->getDateTime('@' . $host['lobbyTimer']); $success = $this->setLobby($local, $host['lobbyState'], $hostTimer); if (!$success) { @@ -1071,7 +1071,7 @@ public function syncPropertiesFromHostRoom(Room $local, array $host): void { } } if (isset($host['callStartTime'], $host['callFlag'])) { - $localCallStartTime = (int) $local->getActiveSince()?->getTimestamp(); + $localCallStartTime = (int)$local->getActiveSince()?->getTimestamp(); if ($host['callStartTime'] === 0 && ($host['callStartTime'] !== $localCallStartTime || $host['callFlag'] !== $local->getCallFlag())) { $this->resetActiveSince($local, null); $changed[] = ARoomModifiedEvent::PROPERTY_ACTIVE_SINCE; diff --git a/lib/Service/SIPDialOutService.php b/lib/Service/SIPDialOutService.php index 6ebca88fb53..84b0a3344c3 100644 --- a/lib/Service/SIPDialOutService.php +++ b/lib/Service/SIPDialOutService.php @@ -56,10 +56,10 @@ protected function validateDialOutResponse(string $response): Response { ->map( Response::class, Source::json($response) - ->map([ - 'dialout' => 'dialOut', - 'dialout.callid' => 'callId', - ]) + ->map([ + 'dialout' => 'dialOut', + 'dialout.callid' => 'callId', + ]) ); } catch (MappingError $e) { throw new \InvalidArgumentException('Not a valid dial-out response', 0, $e); diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index 67e05de682a..e03d0a9c75e 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -68,14 +68,14 @@ public function getForm(): TemplateResponse { } protected function initGeneralSettings(): void { - $this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_MENTION)); - $this->initialState->provideInitialState('conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1')); - $this->initialState->provideInitialState('conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1')); + $this->initialState->provideInitialState('default_group_notification', (int)$this->serverConfig->getAppValue('spreed', 'default_group_notification', (string)Participant::NOTIFY_MENTION)); + $this->initialState->provideInitialState('conversations_files', (int)$this->serverConfig->getAppValue('spreed', 'conversations_files', '1')); + $this->initialState->provideInitialState('conversations_files_public_shares', (int)$this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1')); $this->initialState->provideInitialState('valid_apache_php_configuration', $this->validApachePHPConfiguration()); } protected function initAllowedGroups(): void { - $this->initialState->provideInitialState('start_calls', (int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE)); + $this->initialState->provideInitialState('start_calls', (int)$this->serverConfig->getAppValue('spreed', 'start_calls', (string)Room::START_CALL_EVERYONE)); $groups = $this->getGroupDetailsArray($this->talkConfig->getAllowedConversationsGroupIds(), 'start_conversations'); $this->initialState->provideInitialState('start_conversations', $groups); @@ -95,7 +95,7 @@ protected function initFederation(): void { protected function initMatterbridge(): void { $error = ''; try { - $version = (string) $this->bridgeManager->getCurrentVersionFromBinary(); + $version = (string)$this->bridgeManager->getCurrentVersionFromBinary(); if ($version === '') { $error = 'binary'; } @@ -518,8 +518,8 @@ public function getSection(): string { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/lib/Settings/Admin/Section.php b/lib/Settings/Admin/Section.php index e495df39a1f..f6630e3ea1f 100644 --- a/lib/Settings/Admin/Section.php +++ b/lib/Settings/Admin/Section.php @@ -55,8 +55,8 @@ public function getName(): string { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 * @since 9.1 diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index f94484edae9..0574b05b7cb 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -38,8 +38,8 @@ public function getSection(): string { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 6e93f84de1e..12b26f49540 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -426,7 +426,7 @@ public function restore(IShare $share, string $recipient): IShare { $update->executeStatement(); - return $this->getShareById((int) $share->getId(), $recipient); + return $this->getShareById((int)$share->getId(), $recipient); } /** @@ -668,7 +668,7 @@ public function getSharesByIds(array $ids, ?string $recipientId = null): array { $id = $data['id']; if ($this->isAccessibleResult($data)) { $share = $this->createShareObject($data); - $shares[(int) $share->getId()] = $share; + $shares[(int)$share->getId()] = $share; } else { $share = false; } @@ -1003,8 +1003,8 @@ public function getAccessList($nodes, $currentAccess): array { protected function filterSharesOfUser(array $shares): array { // Room shares when the user has a share exception foreach ($shares as $id => $share) { - $type = (int) $share['share_type']; - $permissions = (int) $share['permissions']; + $type = (int)$share['share_type']; + $permissions = (int)$share['permissions']; if ($type === self::SHARE_TYPE_USERROOM) { unset($shares[$share['parent']]); diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index 0d58b778e28..22928bffe10 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -499,7 +499,7 @@ public function dialOutToAttendee(Room $room, Attendee $attendee): ?string { 'app' => 'spreed-hpb', ]); - return (string) $response->getBody(); + return (string)$response->getBody(); } /** diff --git a/lib/TInitialState.php b/lib/TInitialState.php index 6fcfdaf771f..8b6b5c5d0ee 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -51,7 +51,7 @@ protected function publishInitialStateShared(): void { $this->initialState->provideInitialState( 'call_enabled', - ((int) $this->serverConfig->getAppValue('spreed', 'start_calls')) !== Room::START_CALL_NOONE + ((int)$this->serverConfig->getAppValue('spreed', 'start_calls')) !== Room::START_CALL_NOONE ); $this->initialState->provideInitialState( diff --git a/templates/authenticate.php b/templates/authenticate.php index 5f779d7a910..481c5d1c629 100644 --- a/templates/authenticate.php +++ b/templates/authenticate.php @@ -6,8 +6,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -/** @var $_ array */ -/** @var $l \OCP\IL10N */ +/** @var array $_ */ +/** @var \OCP\IL10N $l */ \OCP\Util::addStyle('core', 'publicshareauth'); \OCP\Util::addScript('core', 'publicshareauth'); ?> diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index d7721eb7a47..678ba40d37f 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -484,7 +484,7 @@ private function assertRooms(array $rooms, TableNode $formData, bool $shouldOrde $data['description'] = $room['description']; } if (isset($expectedRoom['type'])) { - $data['type'] = (string) $room['type']; + $data['type'] = (string)$room['type']; } if (isset($expectedRoom['remoteServer'])) { $data['remoteServer'] = isset($room['remoteServer']) ? self::translateRemoteServer($room['remoteServer']) : ''; @@ -497,31 +497,31 @@ private function assertRooms(array $rooms, TableNode $formData, bool $shouldOrde } } if (isset($expectedRoom['hasPassword'])) { - $data['hasPassword'] = (string) $room['hasPassword']; + $data['hasPassword'] = (string)$room['hasPassword']; } if (isset($expectedRoom['readOnly'])) { - $data['readOnly'] = (string) $room['readOnly']; + $data['readOnly'] = (string)$room['readOnly']; } if (isset($expectedRoom['listable'])) { - $data['listable'] = (string) $room['listable']; + $data['listable'] = (string)$room['listable']; } if (isset($expectedRoom['participantType'])) { - $data['participantType'] = (string) $room['participantType']; + $data['participantType'] = (string)$room['participantType']; } if (isset($expectedRoom['sipEnabled'])) { - $data['sipEnabled'] = (string) $room['sipEnabled']; + $data['sipEnabled'] = (string)$room['sipEnabled']; } if (isset($expectedRoom['callFlag'])) { - $data['callFlag'] = (int) $room['callFlag']; + $data['callFlag'] = (int)$room['callFlag']; } if (isset($expectedRoom['lobbyState'])) { - $data['lobbyState'] = (int) $room['lobbyState']; + $data['lobbyState'] = (int)$room['lobbyState']; } if (isset($expectedRoom['breakoutRoomMode'])) { - $data['breakoutRoomMode'] = (int) $room['breakoutRoomMode']; + $data['breakoutRoomMode'] = (int)$room['breakoutRoomMode']; } if (isset($expectedRoom['breakoutRoomStatus'])) { - $data['breakoutRoomStatus'] = (int) $room['breakoutRoomStatus']; + $data['breakoutRoomStatus'] = (int)$room['breakoutRoomStatus']; } if (isset($expectedRoom['attendeePin'])) { $data['attendeePin'] = $room['attendeePin'] ? '**PIN**' : ''; @@ -539,25 +539,25 @@ private function assertRooms(array $rooms, TableNode $formData, bool $shouldOrde $data['lastMessageActorId'] = str_replace(rtrim($this->remoteServerUrl, '/'), '{$REMOTE_URL}', $data['lastMessageActorId']); } if (isset($expectedRoom['lastReadMessage'])) { - $data['lastReadMessage'] = self::$messageIdToText[(int) $room['lastReadMessage']] ?? (!$room['lastReadMessage'] ? 'ZERO': 'UNKNOWN_MESSAGE'); + $data['lastReadMessage'] = self::$messageIdToText[(int)$room['lastReadMessage']] ?? (!$room['lastReadMessage'] ? 'ZERO': 'UNKNOWN_MESSAGE'); } if (isset($expectedRoom['unreadMessages'])) { - $data['unreadMessages'] = (int) $room['unreadMessages']; + $data['unreadMessages'] = (int)$room['unreadMessages']; } if (isset($expectedRoom['unreadMention'])) { - $data['unreadMention'] = (int) $room['unreadMention']; + $data['unreadMention'] = (int)$room['unreadMention']; } if (isset($expectedRoom['unreadMentionDirect'])) { - $data['unreadMentionDirect'] = (int) $room['unreadMentionDirect']; + $data['unreadMentionDirect'] = (int)$room['unreadMentionDirect']; } if (isset($expectedRoom['messageExpiration'])) { - $data['messageExpiration'] = (int) $room['messageExpiration']; + $data['messageExpiration'] = (int)$room['messageExpiration']; } if (isset($expectedRoom['callRecording'])) { - $data['callRecording'] = (int) $room['callRecording']; + $data['callRecording'] = (int)$room['callRecording']; } if (isset($expectedRoom['recordingConsent'])) { - $data['recordingConsent'] = (int) $room['recordingConsent']; + $data['recordingConsent'] = (int)$room['recordingConsent']; } if (isset($expectedRoom['permissions'])) { $data['permissions'] = $this->mapPermissionsAPIOutput($room['permissions']); @@ -655,7 +655,7 @@ private function assertInvites($invites, TableNode $formData) { Assert::assertCount(count($formData->getHash()), $invites, 'Invite count does not match'); $expectedInvites = array_map(static function ($expectedInvite): array { if (isset($expectedInvite['state'])) { - $expectedInvite['state'] = (int) $expectedInvite['state']; + $expectedInvite['state'] = (int)$expectedInvite['state']; } return $expectedInvite; }, $formData->getHash()); @@ -811,31 +811,31 @@ protected function assertAttendeeList(string $identifier, ?TableNode $formData, $data['actorId'] = $attendee['actorId']; } if (isset($expectedKeys['participantType'])) { - $data['participantType'] = (string) $attendee['participantType']; + $data['participantType'] = (string)$attendee['participantType']; } if (isset($expectedKeys['inCall'])) { - $data['inCall'] = (string) $attendee['inCall']; + $data['inCall'] = (string)$attendee['inCall']; } if (isset($expectedKeys['attendeePin'])) { $data['attendeePin'] = $attendee['attendeePin'] ? '**PIN**' : ''; } if (isset($expectedKeys['permissions'])) { - $data['permissions'] = (string) $attendee['permissions']; + $data['permissions'] = (string)$attendee['permissions']; } if (isset($expectedKeys['attendeePermissions'])) { - $data['attendeePermissions'] = (string) $attendee['attendeePermissions']; + $data['attendeePermissions'] = (string)$attendee['attendeePermissions']; } if (isset($expectedKeys['displayName'])) { - $data['displayName'] = (string) $attendee['displayName']; + $data['displayName'] = (string)$attendee['displayName']; } if (isset($expectedKeys['phoneNumber'])) { - $data['phoneNumber'] = (string) $attendee['phoneNumber']; + $data['phoneNumber'] = (string)$attendee['phoneNumber']; } if (isset($expectedKeys['callId'])) { - $data['callId'] = (string) $attendee['callId']; + $data['callId'] = (string)$attendee['callId']; } if (isset($expectedKeys['status'], $attendee['status'])) { - $data['status'] = (string) $attendee['status']; + $data['status'] = (string)$attendee['status']; } if (isset($expectedKeys['sessionIds'])) { $sessionIds = '['; @@ -1017,7 +1017,7 @@ private function mapPermissionsTestInput($permissions): int { } private function mapPermissionsAPIOutput($permissions): string { - $permissions = (int) $permissions; + $permissions = (int)$permissions; $permissionsString = !$permissions ? 'D' : ''; foreach (self::$permissionsMap as $char => $int) { @@ -2214,9 +2214,9 @@ public function userSeesPeersInCall(string $user, int $numPeers, string $identif if ($statusCode === 200) { $response = $this->getDataFromResponse($this->response); - Assert::assertCount((int) $numPeers, $response); + Assert::assertCount((int)$numPeers, $response); } else { - Assert::assertEquals((int) $numPeers, 0); + Assert::assertEquals((int)$numPeers, 0); } } @@ -2551,7 +2551,7 @@ protected function preparePollExpectedData(array $expected): array { if (isset($expected['details'])) { $expected['details'] = json_decode($expected['details'], true); } - $expected['numVoters'] = (int) $expected['numVoters']; + $expected['numVoters'] = (int)$expected['numVoters']; $expected['options'] = json_decode($expected['options'], true); $result = preg_match('/POLL_ID\(([^)]+)\)/', $expected['id'], $matches); @@ -2586,8 +2586,8 @@ public function userGetsDashboardWidgets($user, $apiVersion = 'v1', ?TableNode $ unset($widget['icon_url'], $data[$id]['icon_url']); - $widget['item_icons_round'] = (bool) $widget['item_icons_round']; - $widget['order'] = (int) $widget['order']; + $widget['item_icons_round'] = (bool)$widget['item_icons_round']; + $widget['order'] = (int)$widget['order']; $widget['widget_url'] = str_replace('{$BASE_URL}', $this->baseUrl, $widget['widget_url']); $widget['buttons'] = str_replace('{$BASE_URL}', $this->baseUrl, $widget['buttons']); $widget['buttons'] = json_decode($widget['buttons'], true); @@ -2879,7 +2879,7 @@ public function userSeesTheFollowingSharedOverviewMediaInRoom($user, $identifier if ($formData instanceof TableNode) { $expected = $formData->getRowsHash(); $summarized = array_map(function ($type) { - return (string) count($type); + return (string)count($type); }, $overview); Assert::assertEquals($expected, $summarized); } @@ -3160,9 +3160,9 @@ public function userSeesTheFollowingSystemMessagesInRoom($user, $identifier, $st Assert::assertEquals($expected, array_map(function ($message, $expected) { $data = [ 'room' => self::$tokenToIdentifier[$message['token']], - 'actorType' => (string) $message['actorType'], - 'actorId' => ($message['actorType'] === 'guests') ? self::$sessionIdToUser[$message['actorId']] : (string) $message['actorId'], - 'systemMessage' => (string) $message['systemMessage'], + 'actorType' => (string)$message['actorType'], + 'actorId' => ($message['actorType'] === 'guests') ? self::$sessionIdToUser[$message['actorId']] : (string)$message['actorId'], + 'systemMessage' => (string)$message['systemMessage'], ]; if (isset($expected['actorDisplayName'])) { @@ -3415,7 +3415,7 @@ public function userCreatesBreakoutRooms(string $user, int $amount, string $mode foreach ($formData->getRowsHash() as $attendee => $roomNumber) { [$type, $id] = explode('::', $attendee); $attendeeId = $this->getAttendeeId($type, $id, $identifier); - $mapArray[$attendeeId] = (int) $roomNumber; + $mapArray[$attendeeId] = (int)$roomNumber; } $data['attendeeMap'] = json_encode($mapArray, JSON_THROW_ON_ERROR); } @@ -3455,7 +3455,7 @@ public function userMovesParticipantsInsideBreakoutRooms(string $user, string $i foreach ($formData->getRowsHash() as $attendee => $roomNumber) { [$type, $id] = explode('::', $attendee); $attendeeId = $this->getAttendeeId($type, $id, $identifier); - $mapArray[$attendeeId] = (int) $roomNumber; + $mapArray[$attendeeId] = (int)$roomNumber; } $data['attendeeMap'] = json_encode($mapArray, JSON_THROW_ON_ERROR); } @@ -3717,20 +3717,20 @@ private function assertNotifications($notifications, TableNode $formData) { } } if (isset($expectedNotification['subject'])) { - $data['subject'] = (string) $notification['subject']; + $data['subject'] = (string)$notification['subject']; } if (isset($expectedNotification['message'])) { - $data['message'] = (string) $notification['message']; + $data['message'] = (string)$notification['message']; $result = preg_match('/ROOM\(([^)]+)\)/', $expectedNotification['message'], $matches); if ($result && isset(self::$identifierToToken[$matches[1]])) { $data['message'] = str_replace(self::$identifierToToken[$matches[1]], $matches[0], $data['message']); } } if (isset($expectedNotification['object_type'])) { - $data['object_type'] = (string) $notification['object_type']; + $data['object_type'] = (string)$notification['object_type']; } if (isset($expectedNotification['app'])) { - $data['app'] = (string) $notification['app']; + $data['app'] = (string)$notification['app']; } return $data; @@ -4202,7 +4202,7 @@ private function assertReactionList(?TableNode $formData): void { $actual = array_map(function ($reaction, $list) use ($expected): array { $list = array_map(function ($reaction) { unset($reaction['timestamp']); - $reaction['actorId'] = ($reaction['actorType'] === 'guests') ? self::$sessionIdToUser[$reaction['actorId']] : (string) $reaction['actorId']; + $reaction['actorId'] = ($reaction['actorType'] === 'guests') ? self::$sessionIdToUser[$reaction['actorId']] : (string)$reaction['actorId']; if ($reaction['actorType'] === 'federated_users') { $reaction['actorId'] = str_replace(rtrim($this->localServerUrl, '/'), '{$LOCAL_URL}', $reaction['actorId']); $reaction['actorId'] = str_replace(rtrim($this->localRemoteServerUrl, '/'), '{$LOCAL_REMOTE_URL}', $reaction['actorId']); @@ -4464,7 +4464,7 @@ public function userStopRecordingInRoom(string $user, string $identifier, int $s public function userStoreRecordingFileInRoom(string $user, string $file, string $identifier, int $statusCode, string $apiVersion = 'v1'): void { $recordingServerSharedSecret = 'the secret'; $this->setAppConfig('spreed', new TableNode([['recording_servers', json_encode(['secret' => $recordingServerSharedSecret])]])); - $validRandom = md5((string) rand()); + $validRandom = md5((string)rand()); $validChecksum = hash_hmac('sha256', $validRandom . self::$identifierToToken[$identifier], $recordingServerSharedSecret); $headers = [ 'TALK_RECORDING_RANDOM' => $validRandom, @@ -4665,9 +4665,9 @@ public function runReminderBackgroundJobs(string $useForce, string $class): void foreach ($list as $job) { if ($useForce === 'force run') { - $this->runOcc(['background-job:execute', (string) $job['id'], '--force-execute']); + $this->runOcc(['background-job:execute', (string)$job['id'], '--force-execute']); } else { - $this->runOcc(['background-job:execute', (string) $job['id']]); + $this->runOcc(['background-job:execute', (string)$job['id']]); } if ($this->lastStdErr) { diff --git a/tests/integration/features/bootstrap/RecordingTrait.php b/tests/integration/features/bootstrap/RecordingTrait.php index 628a225e96c..e667f0b06f7 100644 --- a/tests/integration/features/bootstrap/RecordingTrait.php +++ b/tests/integration/features/bootstrap/RecordingTrait.php @@ -275,7 +275,7 @@ public function recordingServerSentFailedRequestForRecordingInRoomWith(string $i private function sendBackendRequestFromRecordingServer(array $data, int $statusCode, string $apiVersion = 'v1') { $body = json_encode($data); - $random = md5((string) rand()); + $random = md5((string)rand()); $checksum = hash_hmac('sha256', $random . $body, 'the recording secret'); $headers = [ diff --git a/tests/integration/features/bootstrap/SharingContext.php b/tests/integration/features/bootstrap/SharingContext.php index 02391c8913e..ee113c09c03 100644 --- a/tests/integration/features/bootstrap/SharingContext.php +++ b/tests/integration/features/bootstrap/SharingContext.php @@ -583,11 +583,11 @@ public function shareXIsReturnedWith(int $number, TableNode $body) { $returnedShare = $this->getXmlResponse()->data[0]; if ($returnedShare->element) { - $returnedShare = (array) $returnedShare; + $returnedShare = (array)$returnedShare; $returnedShare = $returnedShare['element']; if (is_array($returnedShare)) { usort($returnedShare, static function ($share1, $share2) { - return (int) $share1->id - (int) $share2->id; + return (int)$share1->id - (int)$share2->id; }); } diff --git a/tests/integration/spreedcheats/lib/Controller/ApiController.php b/tests/integration/spreedcheats/lib/Controller/ApiController.php index e05e079512d..20242bd6afb 100644 --- a/tests/integration/spreedcheats/lib/Controller/ApiController.php +++ b/tests/integration/spreedcheats/lib/Controller/ApiController.php @@ -111,7 +111,7 @@ public function ageChat(string $token, int $hours): DataResponse { ->where($query->expr()->eq('token', $query->createNamedParameter($token))); $result = $query->executeQuery(); - $roomId = (int) $result->fetchOne(); + $roomId = (int)$result->fetchOne(); $result->closeCursor(); if (!$roomId) { diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php index cabb3adbc01..4a17dd966f8 100644 --- a/tests/php/CapabilitiesTest.php +++ b/tests/php/CapabilitiesTest.php @@ -90,7 +90,7 @@ public function testGetCapabilitiesGuest(): void { ->willReturnMap([ ['spreed', 'has_reference_id', 'no', 'no'], ['spreed', 'max-gif-size', '3145728', '200000'], - ['spreed', 'start_calls', (string) Room::START_CALL_EVERYONE, (string) Room::START_CALL_EVERYONE], + ['spreed', 'start_calls', (string)Room::START_CALL_EVERYONE, (string)Room::START_CALL_EVERYONE], ['spreed', 'session-ping-limit', '200', '200'], ['core', 'backgroundjobs_mode', 'ajax', 'cron'], ]); @@ -221,7 +221,7 @@ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCrea ->willReturnMap([ ['spreed', 'has_reference_id', 'no', 'yes'], ['spreed', 'max-gif-size', '3145728', '200000'], - ['spreed', 'start_calls', (string) Room::START_CALL_EVERYONE, (string) Room::START_CALL_NOONE], + ['spreed', 'start_calls', (string)Room::START_CALL_EVERYONE, (string)Room::START_CALL_NOONE], ['spreed', 'session-ping-limit', '200', '50'], ['core', 'backgroundjobs_mode', 'ajax', 'cron'], ]); diff --git a/tests/php/Chat/ChatManagerTest.php b/tests/php/Chat/ChatManagerTest.php index 07bbcdfdd42..628b6d3ab4f 100644 --- a/tests/php/Chat/ChatManagerTest.php +++ b/tests/php/Chat/ChatManagerTest.php @@ -85,7 +85,7 @@ public function setUp(): void { $this->l->method('n') ->willReturnCallback(function (string $singular, string $plural, int $count, array $parameters = []) { $text = $count === 1 ? $singular : $plural; - return vsprintf(str_replace('%n', (string) $count, $text), $parameters); + return vsprintf(str_replace('%n', (string)$count, $text), $parameters); }); $this->chatManager = $this->getManager(); @@ -149,7 +149,7 @@ protected function getManager(array $methods = []): ChatManager { private function newComment($id, string $actorType, string $actorId, \DateTime $creationDateTime, string $message): IComment { $comment = $this->createMock(IComment::class); - $id = (string) $id; + $id = (string)$id; $comment->method('getId')->willReturn($id); $comment->method('getActorType')->willReturn($actorType); @@ -169,7 +169,7 @@ private function newCommentFromArray(array $data): IComment { foreach ($data as $key => $value) { if ($key === 'id') { - $value = (string) $value; + $value = (string)$value; } $comment->method('get' . ucfirst($key))->willReturn($value); } diff --git a/tests/php/Chat/NotifierTest.php b/tests/php/Chat/NotifierTest.php index 445b56b51c7..fc015f827ce 100644 --- a/tests/php/Chat/NotifierTest.php +++ b/tests/php/Chat/NotifierTest.php @@ -170,7 +170,7 @@ public static function dataNotifyMentionedUsers(): array { public function testNotifyMentionedUsers(string $message, array $alreadyNotifiedUsers, array $notify, array $expectedReturn): void { if (count($notify)) { $this->notificationManager->expects($this->exactly(count($notify))) - ->method('notify'); + ->method('notify'); } $room = $this->getRoom(); diff --git a/tests/php/Chat/Parser/SystemMessageTest.php b/tests/php/Chat/Parser/SystemMessageTest.php index 1d4f3c96343..f6149b1535b 100644 --- a/tests/php/Chat/Parser/SystemMessageTest.php +++ b/tests/php/Chat/Parser/SystemMessageTest.php @@ -81,7 +81,7 @@ public function setUp(): void { $this->l->method('n') ->willReturnCallback(function (string $singular, string $plural, int $count, array $parameters = []) { $text = $count === 1 ? $singular : $plural; - return vsprintf(str_replace('%n', (string) $count, $text), $parameters); + return vsprintf(str_replace('%n', (string)$count, $text), $parameters); }); } diff --git a/tests/php/ConfigTest.php b/tests/php/ConfigTest.php index a1fbc183ee6..0acf7373f0e 100644 --- a/tests/php/ConfigTest.php +++ b/tests/php/ConfigTest.php @@ -410,7 +410,7 @@ public function testSignalingTicketV2User(string $algo): void { $this->assertEquals($now, $decoded->iat); $this->assertEquals('https://domain.invalid/nextcloud', $decoded->iss); $this->assertEquals('user1', $decoded->sub); - $this->assertSame(['displayname' => 'Jane Doe'], (array) $decoded->userdata); + $this->assertSame(['displayname' => 'Jane Doe'], (array)$decoded->userdata); } /** diff --git a/tests/stubs/oc_comments_manager.php b/tests/stubs/oc_comments_manager.php index 946e2436b32..998ce927f53 100644 --- a/tests/stubs/oc_comments_manager.php +++ b/tests/stubs/oc_comments_manager.php @@ -10,7 +10,7 @@ use OCP\IUser; class Manager implements \OCP\Comments\ICommentsManager { - /** @var IDBConnection */ + /** @var IDBConnection */ protected $dbConn; protected function normalizeDatabaseData(array $data): array { From 8119df6ddc4762435f9e7a4b5915fd17f9effbdb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2024 14:15:40 +0200 Subject: [PATCH 4/5] chore(assets): Recompile assets Signed-off-by: Joas Schilling --- openapi-full.json | 4 ++-- openapi.json | 4 ++-- src/types/openapi/openapi-full.ts | 8 ++++---- src/types/openapi/openapi.ts | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openapi-full.json b/openapi-full.json index f60814e70c5..17ebdf1963e 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -4079,7 +4079,7 @@ "recordingConsent": { "type": "boolean", "default": false, - "description": "When the user ticked a checkbox and agreed with being recorded\n (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES}\n or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL}\n and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} )" + "description": "When the user ticked a checkbox and agreed with being recorded\n (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES}\n or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL}\n and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} )" } } } @@ -15174,7 +15174,7 @@ "recordingConsent": { "type": "integer", "format": "int64", - "description": "New consent setting for the conversation\n (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.)" + "description": "New consent setting for the conversation\n (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.)" } } } diff --git a/openapi.json b/openapi.json index 133cc412a48..b1c4193eefa 100644 --- a/openapi.json +++ b/openapi.json @@ -3966,7 +3966,7 @@ "recordingConsent": { "type": "boolean", "default": false, - "description": "When the user ticked a checkbox and agreed with being recorded\n (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES}\n or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL}\n and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} )" + "description": "When the user ticked a checkbox and agreed with being recorded\n (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES}\n or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL}\n and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} )" } } } @@ -15294,7 +15294,7 @@ "recordingConsent": { "type": "integer", "format": "int64", - "description": "New consent setting for the conversation\n (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.)" + "description": "New consent setting for the conversation\n (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.)" } } } diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 1b7b0015fa7..02bd64a7c18 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -3287,9 +3287,9 @@ export interface operations { silent?: boolean; /** * @description When the user ticked a checkbox and agreed with being recorded - * (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} - * or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} - * and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ) + * (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} + * or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} + * and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ) * @default false */ recordingConsent?: boolean; @@ -7781,7 +7781,7 @@ export interface operations { /** * Format: int64 * @description New consent setting for the conversation - * (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.) + * (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.) */ recordingConsent: number; }; diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 418bd57fbb3..9b265449367 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -2768,9 +2768,9 @@ export interface operations { silent?: boolean; /** * @description When the user ticked a checkbox and agreed with being recorded - * (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} - * or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} - * and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ) + * (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} + * or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} + * and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ) * @default false */ recordingConsent?: boolean; @@ -7359,7 +7359,7 @@ export interface operations { /** * Format: int64 * @description New consent setting for the conversation - * (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.) + * (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.) */ recordingConsent: number; }; From 10dc3c7b7167d1d830cc86561aaf5edd2d606420 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2024 16:40:41 +0200 Subject: [PATCH 5/5] chore: ignore coding-standard update 1.2.3 in git blame Signed-off-by: Joas Schilling --- .git-blame-ignore-revs | 3 +++ README.md | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..28a167dfab8 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,3 @@ +# .git-blame-ignore-revs +# Update to nextcloud/coding-standard 1.2.3 +956a1ab00ffb25d87c0f5192333c9b66e56a63fe diff --git a/README.md b/README.md index 2db48364a84..d41a04311e2 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,12 @@ You can enable HMR (Hot module replacement) to avoid page reloads when working o We are also available on [our public Talk team conversation](https://cloud.nextcloud.com/call/c7fz9qpr), if you want to join the discussion. +### 🙈 Ignore code style updates in git blame + +```sh +git config blame.ignoreRevsFile .git-blame-ignore-revs +``` + ### 🌏 Testing federation locally When testing federated conversations locally, some additional steps might be needed,