From bafea52e727beef1ebd82e6e4d70571237f709bd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 26 Aug 2024 12:33:46 +0200 Subject: [PATCH] chore: Run php cs fixer Signed-off-by: Ferdinand Thiessen --- .php-cs-fixer.dist.php | 1 + lib/Controller/APIv1Controller.php | 2 +- lib/Controller/APIv2Controller.php | 16 +++++++-------- lib/Controller/ActivitiesController.php | 4 ++-- lib/Controller/SettingsController.php | 18 ++++++++--------- lib/CurrentUser.php | 4 ++-- lib/Dashboard/ActivityWidget.php | 8 ++++---- lib/Data.php | 4 ++-- lib/DigestSender.php | 10 +++++----- lib/FilesHooks.php | 16 +++++++-------- lib/GroupHelper.php | 20 +++++++++---------- lib/MailQueueHandler.php | 16 +++++++-------- .../Version2006Date20170919095939.php | 2 +- lib/Settings/Admin.php | 6 +++--- lib/Settings/AdminSection.php | 4 ++-- lib/Settings/Personal.php | 12 +++++------ lib/Settings/PersonalSection.php | 4 ++-- lib/UserSettings.php | 12 +++++------ tests/Controller/APIv2ControllerTest.php | 2 +- tests/Controller/FeedControllerTest.php | 4 ++-- tests/CurrentUserTest.php | 2 +- tests/Mock/Setting1.php | 4 ++-- tests/Mock/Setting2.php | 4 ++-- 23 files changed, 88 insertions(+), 87 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3ff6486d2..c2ca0357c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -12,6 +12,7 @@ ->notPath('build') ->notPath('l10n') ->notPath('src') + ->notPath('node_modules') ->notPath('vendor') ->in(__DIR__); return $config; diff --git a/lib/Controller/APIv1Controller.php b/lib/Controller/APIv1Controller.php index d28056bde..78d097193 100644 --- a/lib/Controller/APIv1Controller.php +++ b/lib/Controller/APIv1Controller.php @@ -86,7 +86,7 @@ protected function getSinceFromOffset($offset) { $result->closeCursor(); if ($row) { - return (int) $row['activity_id']; + return (int)$row['activity_id']; } return 0; diff --git a/lib/Controller/APIv2Controller.php b/lib/Controller/APIv2Controller.php index 2c38a3319..cc0158019 100644 --- a/lib/Controller/APIv2Controller.php +++ b/lib/Controller/APIv2Controller.php @@ -83,11 +83,11 @@ protected function validateParameters($filter, $since, $limit, $previews, $objec if ($this->filter !== $this->data->validateFilter($this->filter)) { throw new InvalidFilterException('Invalid filter'); } - $this->since = (int) $since; - $this->limit = (int) $limit; - $this->loadPreviews = (bool) $previews; - $this->objectType = (string) $objectType; - $this->objectId = (int) $objectId; + $this->since = (int)$since; + $this->limit = (int)$limit; + $this->loadPreviews = (bool)$previews; + $this->objectType = (string)$objectType; + $this->objectId = (int)$objectId; $this->sort = \in_array($sort, ['asc', 'desc'], true) ? $sort : 'desc'; if (($this->objectType !== '' && $this->objectId === 0) || ($this->objectType === '' && $this->objectId !== 0)) { @@ -223,15 +223,15 @@ protected function get($filter, $since, $limit, $previews, $filterObjectType, $f if ($activity['object_type'] === 'files') { if (!empty($activity['objects']) && \is_array($activity['objects'])) { foreach ($activity['objects'] as $objectId => $objectName) { - if (((int) $objectId) === 0 || $objectName === '') { + if (((int)$objectId) === 0 || $objectName === '') { // No file, no preview continue; } - $activity['previews'][] = $this->getPreview($activity['affecteduser'], (int) $objectId, $objectName); + $activity['previews'][] = $this->getPreview($activity['affecteduser'], (int)$objectId, $objectName); } } elseif ($activity['object_id']) { - $activity['previews'][] = $this->getPreview($activity['affecteduser'], (int) $activity['object_id'], $activity['object_name']); + $activity['previews'][] = $this->getPreview($activity['affecteduser'], (int)$activity['object_id'], $activity['object_name']); } } } diff --git a/lib/Controller/ActivitiesController.php b/lib/Controller/ActivitiesController.php index 7ca063d13..f9edc3b74 100644 --- a/lib/Controller/ActivitiesController.php +++ b/lib/Controller/ActivitiesController.php @@ -109,10 +109,10 @@ protected function getLinkList(): array { $filters = $this->activityManager->getFilters(); usort($filters, static function (IFilter $a, IFilter $b) { if ($a->getPriority() === $b->getPriority()) { - return (int) ($a->getIdentifier() > $b->getIdentifier()); + return (int)($a->getIdentifier() > $b->getIdentifier()); } - return (int) ($a->getPriority() > $b->getPriority()); + return (int)($a->getPriority() > $b->getPriority()); }); $entries = []; diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index aaf30d79c..d6364fbff 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -32,7 +32,7 @@ public function __construct( protected IL10N $l10n, CurrentUser $currentUser) { parent::__construct($appName, $request); - $this->user = (string) $currentUser->getUID(); + $this->user = (string)$currentUser->getUID(); } /** @@ -55,14 +55,14 @@ public function personal( $this->config->setUserValue( $this->user, 'activity', 'notify_notification_' . $setting->getIdentifier(), - (string)(int) $this->request->getParam($setting->getIdentifier() . '_notification', false) + (string)(int)$this->request->getParam($setting->getIdentifier() . '_notification', false) ); if ($setting->canChangeMail()) { $this->config->setUserValue( $this->user, 'activity', 'notify_email_' . $setting->getIdentifier(), - (string)(int) $this->request->getParam($setting->getIdentifier() . '_email', false) + (string)(int)$this->request->getParam($setting->getIdentifier() . '_email', false) ); } } @@ -84,17 +84,17 @@ public function personal( $this->config->setUserValue( $this->user, 'activity', 'notify_setting_self', - (string)(int) $notify_setting_self + (string)(int)$notify_setting_self ); $this->config->setUserValue( $this->user, 'activity', 'notify_setting_selfemail', - (string)(int) $notify_setting_selfemail + (string)(int)$notify_setting_selfemail ); $this->config->setUserValue( $this->user, 'activity', 'notify_setting_activity_digest', - (string)(int) $activity_digest + (string)(int)$activity_digest ); return new DataResponse([ @@ -126,7 +126,7 @@ public function admin( $this->config->setAppValue( 'activity', 'notify_email_' . $setting->getIdentifier(), - (string)(int) $this->request->getParam($setting->getIdentifier() . '_email', false) + (string)(int)$this->request->getParam($setting->getIdentifier() . '_email', false) ); } } @@ -148,12 +148,12 @@ public function admin( $this->config->setAppValue( 'activity', 'notify_setting_self', - (string)(int) $notify_setting_self + (string)(int)$notify_setting_self ); $this->config->setAppValue( 'activity', 'notify_setting_selfemail', - (string)(int) $notify_setting_selfemail + (string)(int)$notify_setting_selfemail ); return new DataResponse([ diff --git a/lib/CurrentUser.php b/lib/CurrentUser.php index 5bf5f77fb..dbe4c5553 100644 --- a/lib/CurrentUser.php +++ b/lib/CurrentUser.php @@ -68,7 +68,7 @@ public function getUID() { if ($this->sessionUser === false) { $user = $this->userSession->getUser(); if ($user instanceof IUser) { - $this->sessionUser = (string) $user->getUID(); + $this->sessionUser = (string)$user->getUID(); } else { $this->sessionUser = null; } @@ -85,7 +85,7 @@ public function getCloudId() { if ($this->cloudId === false) { $user = $this->userSession->getUser(); if ($user instanceof IUser) { - $this->cloudId = (string) $user->getCloudId(); + $this->cloudId = (string)$user->getCloudId(); } else { $this->cloudId = $this->getCloudIDFromToken(); } diff --git a/lib/Dashboard/ActivityWidget.php b/lib/Dashboard/ActivityWidget.php index 2c325f8e0..c954f6bc4 100644 --- a/lib/Dashboard/ActivityWidget.php +++ b/lib/Dashboard/ActivityWidget.php @@ -109,7 +109,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7): $this->helper, $this->settings, $userId, - $since ? (int) $since : 0, + $since ? (int)$since : 0, 50, 'desc', 'by', @@ -122,7 +122,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7): $this->dateTimeFormatter->formatTimeSpan($activity['timestamp']), $activity['link'], $activity['icon'], - (string) $activity['activity_id'] + (string)$activity['activity_id'] ); }, array_slice($activities['data'], 0, $limit)); } @@ -137,7 +137,7 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 $this->helper, $this->settings, $userId, - $since ? (int) $since : 0, + $since ? (int)$since : 0, 50, 'desc', 'by', @@ -160,7 +160,7 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 $this->dateTimeFormatter->formatTimeSpan($activity['timestamp']), $activity['link'], $userAvatarUrl, - (string) $activity['activity_id'], + (string)$activity['activity_id'], $activity['icon'], ); }, array_slice($activities['data'], 0, $limit)); diff --git a/lib/Data.php b/lib/Data.php index 35f04f960..2838bc2a9 100755 --- a/lib/Data.php +++ b/lib/Data.php @@ -341,8 +341,8 @@ public function expire($expireDays = 365) { * Delete activities that match certain conditions * * @param array $conditions Array with conditions that have to be met - * 'field' => 'value' => `field` = 'value' - * 'field' => array('value', 'operator') => `field` operator 'value' + * 'field' => 'value' => `field` = 'value' + * 'field' => array('value', 'operator') => `field` operator 'value' */ public function deleteActivities($conditions): void { $platform = $this->connection->getDatabasePlatform(); diff --git a/lib/DigestSender.php b/lib/DigestSender.php index 523a2b23e..75adc28cb 100644 --- a/lib/DigestSender.php +++ b/lib/DigestSender.php @@ -114,8 +114,8 @@ public function sendDigestForUser(string $uid, int $now, string $timezone, strin $this->activityManager->setCurrentUserId($uid); ['count' => $count, 'max' => $lastActivityId] = $this->data->getActivitySince($uid, $lastSend, true); - $count = (int) $count; - $lastActivityId = (int) $lastActivityId; + $count = (int)$count; + $lastActivityId = (int)$lastActivityId; if ($count === 0) { return; } @@ -181,7 +181,7 @@ public function sendDigestForUser(string $uid, int $now, string $timezone, strin $this->activityManager->setCurrentUserId(null); try { $this->mailer->send($message); - $this->config->setUserValue($user->getUID(), 'activity', 'activity_digest_last_send', (string) $lastActivityId); + $this->config->setUserValue($user->getUID(), 'activity', 'activity_digest_last_send', (string)$lastActivityId); } catch (\Exception $e) { $this->logger->error($e->getMessage()); return; @@ -202,9 +202,9 @@ protected function getHTMLSubject(IEvent $event): string { $placeholders[] = '{' . $placeholder . '}'; if ($parameter['type'] === 'file') { - $replacement = (string) $parameter['path']; + $replacement = (string)$parameter['path']; } else { - $replacement = (string) $parameter['name']; + $replacement = (string)$parameter['name']; } if (isset($parameter['link'])) { diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 5d58deb24..c671933b9 100755 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -697,7 +697,7 @@ protected function shareWithUser($shareWith, $fileSource, $itemType, $fileTarget $shareWith, 'shared_with_by', [[$fileSource => $fileTarget], $this->currentUser->getUserIdentifier()], (int)$fileSource, $fileTarget, $itemType === 'file', $this->userSettings->getUserSetting($shareWith, 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($shareWith, 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($shareWith, 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($shareWith, 'notification', Files_Sharing::TYPE_SHARED) ); } @@ -754,7 +754,7 @@ protected function shareByLink($fileSource, $itemType, $linkOwner) { $linkOwner, 'shared_link_self', [[$fileSource => $path]], (int)$fileSource, $path, $itemType === 'file', $this->userSettings->getUserSetting($linkOwner, 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($linkOwner, 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($linkOwner, 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($linkOwner, 'notification', Files_Sharing::TYPE_SHARED) ); } @@ -827,7 +827,7 @@ protected function unshareFromUser(IShare $share) { $share->getSharedWith(), $actionUser, [[$share->getNodeId() => $share->getTarget()], $this->currentUser->getUserIdentifier()], $share->getNodeId(), $share->getTarget(), $share->getNodeType() === 'file', $this->userSettings->getUserSetting($share->getSharedWith(), 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($share->getSharedWith(), 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($share->getSharedWith(), 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($share->getSharedWith(), 'notification', Files_Sharing::TYPE_SHARED) ); } @@ -880,7 +880,7 @@ protected function unshareFromGroup(IShare $share) { $users = $group->searchUsers('', self::USER_BATCH_SIZE, $offset); $shouldFlush = $this->startActivityTransaction(); while (!empty($users)) { - $this->addNotificationsForGroupUsers($users, $actionUser, $share->getNodeId(), $share->getNodeType(), $share->getTarget(), (int) $share->getId()); + $this->addNotificationsForGroupUsers($users, $actionUser, $share->getNodeId(), $share->getNodeType(), $share->getTarget(), (int)$share->getId()); $offset += self::USER_BATCH_SIZE; $users = $group->searchUsers('', self::USER_BATCH_SIZE, $offset); } @@ -925,7 +925,7 @@ protected function unshareLink(IShare $share) { $owner, $actionSharer, [[$share->getNodeId() => $share->getTarget()]], $share->getNodeId(), $share->getTarget(), $share->getNodeType() === 'file', $this->userSettings->getUserSetting($owner, 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($owner, 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($owner, 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($owner, 'notification', Files_Sharing::TYPE_SHARED) ); if ($share->getSharedBy() !== $share->getShareOwner()) { @@ -934,7 +934,7 @@ protected function unshareLink(IShare $share) { $owner, $actionOwner, [[$share->getNodeId() => $share->getTarget()], $share->getSharedBy()], $share->getNodeId(), $share->getTarget(), $share->getNodeType() === 'file', $this->userSettings->getUserSetting($owner, 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($owner, 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($owner, 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($owner, 'notification', Files_Sharing::TYPE_SHARED) ); } } @@ -1027,7 +1027,7 @@ protected function shareNotificationForSharer($subject, $shareWith, $fileSource, $sharer, $subject, [[$fileSource => $path], $shareWith], $fileSource, $path, ($itemType === 'file'), $this->userSettings->getUserSetting($sharer, 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($sharer, 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($sharer, 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($sharer, 'notification', Files_Sharing::TYPE_SHARED) ); } @@ -1053,7 +1053,7 @@ protected function reshareNotificationForSharer($owner, $subject, $shareWith, $f $owner, $subject, [[$fileSource => $path], $this->currentUser->getUserIdentifier(), $shareWith], $fileSource, $path, ($itemType === 'file'), $this->userSettings->getUserSetting($owner, 'email', Files_Sharing::TYPE_SHARED) ? $this->userSettings->getUserSetting($owner, 'setting', 'batchtime') : false, - (bool) $this->userSettings->getUserSetting($owner, 'notification', Files_Sharing::TYPE_SHARED) + (bool)$this->userSettings->getUserSetting($owner, 'notification', Files_Sharing::TYPE_SHARED) ); } diff --git a/lib/GroupHelper.php b/lib/GroupHelper.php index dfc37cafc..0d8921f73 100644 --- a/lib/GroupHelper.php +++ b/lib/GroupHelper.php @@ -41,7 +41,7 @@ public function setL10n(IL10N $l): void { * Add an activity to the internal array */ public function addActivity(array $activity): void { - $id = (int) $activity['activity_id']; + $id = (int)$activity['activity_id']; $event = $this->arrayToEvent($activity); $this->addEvent($id, $event); } @@ -142,15 +142,15 @@ public function getEvents(): array { protected function arrayToEvent(array $row): IEvent { $event = $this->activityManager->generateEvent(); - $event->setApp((string) $row['app']) - ->setType((string) $row['type']) - ->setAffectedUser((string) $row['affecteduser']) - ->setAuthor((string) $row['user']) - ->setTimestamp((int) $row['timestamp']) - ->setSubject((string) $row['subject'], (array) json_decode($row['subjectparams'], true)) - ->setMessage((string) $row['message'], (array) json_decode($row['messageparams'], true)) - ->setObject((string) $row['object_type'], (int) $row['object_id'], (string) $row['file']) - ->setLink((string) $row['link']); + $event->setApp((string)$row['app']) + ->setType((string)$row['type']) + ->setAffectedUser((string)$row['affecteduser']) + ->setAuthor((string)$row['user']) + ->setTimestamp((int)$row['timestamp']) + ->setSubject((string)$row['subject'], (array)json_decode($row['subjectparams'], true)) + ->setMessage((string)$row['message'], (array)json_decode($row['messageparams'], true)) + ->setObject((string)$row['object_type'], (int)$row['object_id'], (string)$row['file']) + ->setLink((string)$row['link']); return $event; } diff --git a/lib/MailQueueHandler.php b/lib/MailQueueHandler.php index 860aad1cc..dc681cc54 100644 --- a/lib/MailQueueHandler.php +++ b/lib/MailQueueHandler.php @@ -276,12 +276,12 @@ protected function sendEmailToUser(string $userName, string $email, string $lang foreach ($mailData as $activity) { $event = $this->activityManager->generateEvent(); try { - $event->setApp((string) $activity['amq_appid']) - ->setType((string) $activity['amq_type']) - ->setAffectedUser((string) $activity['amq_affecteduser']) - ->setTimestamp((int) $activity['amq_timestamp']) - ->setSubject((string) $activity['amq_subject'], (array) json_decode($activity['amq_subjectparams'], true)) - ->setObject((string) $activity['object_type'], (int) $activity['object_id']); + $event->setApp((string)$activity['amq_appid']) + ->setType((string)$activity['amq_type']) + ->setAffectedUser((string)$activity['amq_affecteduser']) + ->setTimestamp((int)$activity['amq_timestamp']) + ->setSubject((string)$activity['amq_subject'], (array)json_decode($activity['amq_subjectparams'], true)) + ->setObject((string)$activity['object_type'], (int)$activity['object_id']); } catch (\InvalidArgumentException $e) { continue; } @@ -365,9 +365,9 @@ protected function getHTMLSubject(IEvent $event): string { $placeholders[] = '{' . $placeholder . '}'; if ($parameter['type'] === 'file') { - $replacement = (string) $parameter['path']; + $replacement = (string)$parameter['path']; } else { - $replacement = (string) $parameter['name']; + $replacement = (string)$parameter['name']; } if (isset($parameter['link'])) { diff --git a/lib/Migration/Version2006Date20170919095939.php b/lib/Migration/Version2006Date20170919095939.php index bd96fcf8c..3c5f7abb3 100644 --- a/lib/Migration/Version2006Date20170919095939.php +++ b/lib/Migration/Version2006Date20170919095939.php @@ -13,7 +13,7 @@ class Version2006Date20170919095939 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ protected function getColumnsByTable() { diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index c937bb46f..709b64e98 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -35,10 +35,10 @@ public function getForm(): TemplateResponse { $settings = $this->manager->getSettings(); usort($settings, static function (ActivitySettings $a, ActivitySettings $b): int { if ($a->getPriority() === $b->getPriority()) { - return (int) ($a->getIdentifier() > $b->getIdentifier()); + return (int)($a->getIdentifier() > $b->getIdentifier()); } - return (int) ($a->getPriority() > $b->getPriority()); + return (int)($a->getPriority() > $b->getPriority()); }); $activityGroups = []; @@ -82,7 +82,7 @@ public function getForm(): TemplateResponse { } $settingBatchTime = UserSettings::EMAIL_SEND_HOURLY; - $currentSetting = (int) $this->userSettings->getAdminSetting('setting', 'batchtime'); + $currentSetting = (int)$this->userSettings->getAdminSetting('setting', 'batchtime'); if ($currentSetting === 3600 * 24 * 7) { $settingBatchTime = UserSettings::EMAIL_SEND_WEEKLY; } elseif ($currentSetting === 3600 * 24) { diff --git a/lib/Settings/AdminSection.php b/lib/Settings/AdminSection.php index 4efa9fab8..79d172b00 100644 --- a/lib/Settings/AdminSection.php +++ b/lib/Settings/AdminSection.php @@ -61,8 +61,8 @@ public function getName() { /** * @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 eedc6fe4e..83a57b0c7 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -39,7 +39,7 @@ public function __construct( $this->manager = $manager; $this->userSettings = $userSettings; $this->l10n = $l10n; - $this->userId = (string) $currentUser->getUID(); + $this->userId = (string)$currentUser->getUID(); $this->user = $currentUser->getUser(); $this->initialState = $initialState; } @@ -48,10 +48,10 @@ public function getForm(): TemplateResponse { $settings = $this->manager->getSettings(); usort($settings, static function (ActivitySettings $a, ActivitySettings $b): int { if ($a->getPriority() === $b->getPriority()) { - return (int) ($a->getIdentifier() > $b->getIdentifier()); + return (int)($a->getIdentifier() > $b->getIdentifier()); } - return (int) ($a->getPriority() > $b->getPriority()); + return (int)($a->getPriority() > $b->getPriority()); }); $activityGroups = []; @@ -95,7 +95,7 @@ public function getForm(): TemplateResponse { } $settingBatchTime = UserSettings::EMAIL_SEND_HOURLY; - $currentSetting = (int) $this->userSettings->getUserSetting($this->userId, 'setting', 'batchtime'); + $currentSetting = (int)$this->userSettings->getUserSetting($this->userId, 'setting', 'batchtime'); if ($currentSetting === 3600 * 24 * 7) { $settingBatchTime = UserSettings::EMAIL_SEND_WEEKLY; } elseif ($currentSetting === 3600 * 24) { @@ -149,8 +149,8 @@ public function getSection() { /** * @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/PersonalSection.php b/lib/Settings/PersonalSection.php index 66026f263..9929cc2c3 100644 --- a/lib/Settings/PersonalSection.php +++ b/lib/Settings/PersonalSection.php @@ -64,8 +64,8 @@ public function getName() { /** * @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/UserSettings.php b/lib/UserSettings.php index 1d1ce9b76..1932864a4 100644 --- a/lib/UserSettings.php +++ b/lib/UserSettings.php @@ -53,7 +53,7 @@ public function getUserSetting($user, $method, $type) { } if (is_bool($defaultSetting)) { - return (bool) $this->config->getUserValue( + return (bool)$this->config->getUserValue( $user, 'activity', 'notify_' . $method . '_' . $type, @@ -61,7 +61,7 @@ public function getUserSetting($user, $method, $type) { ); } - return (int) $this->config->getUserValue( + return (int)$this->config->getUserValue( $user, 'activity', 'notify_' . $method . '_' . $type, @@ -80,17 +80,17 @@ public function getUserSetting($user, $method, $type) { public function getAdminSetting($method, $type) { $defaultSetting = $this->getDefaultSetting($method, $type); if (is_bool($defaultSetting)) { - return (bool) $this->config->getAppValue( + return (bool)$this->config->getAppValue( 'activity', 'notify_' . $method . '_' . $type, - (string) $defaultSetting + (string)$defaultSetting ); } - return (int) $this->config->getAppValue( + return (int)$this->config->getAppValue( 'activity', 'notify_' . $method . '_' . $type, - (string) $defaultSetting + (string)$defaultSetting ); } diff --git a/tests/Controller/APIv2ControllerTest.php b/tests/Controller/APIv2ControllerTest.php index 9562590b1..a9830d66c 100644 --- a/tests/Controller/APIv2ControllerTest.php +++ b/tests/Controller/APIv2ControllerTest.php @@ -546,7 +546,7 @@ public function testGetNotModified(array $data, ?string $etag): void { $this->request->expects($etag !== null ? $this->once() : $this->never()) ->method('getHeader') - ->willReturn((string) $etag); + ->willReturn((string)$etag); $this->data->expects($this->once()) ->method('get') diff --git a/tests/Controller/FeedControllerTest.php b/tests/Controller/FeedControllerTest.php index 0a1a31e5c..13cf686bf 100644 --- a/tests/Controller/FeedControllerTest.php +++ b/tests/Controller/FeedControllerTest.php @@ -84,7 +84,7 @@ protected function setUp(): void { $this->manager = $this->createMock(IManager::class); $this->themingDefault = $this->createMock(ThemingDefaults::class); - /** @var $urlGenerator IURLGenerator|MockObject */ + /** @var IURLGenerator|MockObject $urlGenerator */ $urlGenerator = $this->createMock(IURLGenerator::class); $this->controller = new FeedController( @@ -168,7 +168,7 @@ public function testShowNoToken(?string $acceptHeader, string $expectedHeader): $this->assertNotEmpty($renderedResponse); $l = Util::getL10N('activity'); - $description = (string) $l->t('Your feed URL is invalid'); + $description = (string)$l->t('Your feed URL is invalid'); $this->assertStringContainsString($description, $renderedResponse); } diff --git a/tests/CurrentUserTest.php b/tests/CurrentUserTest.php index ab6260f40..9d7c642d7 100644 --- a/tests/CurrentUserTest.php +++ b/tests/CurrentUserTest.php @@ -165,7 +165,7 @@ protected function getShareMock(int $type, ?string $shareWith): IShare { ->willReturn($type); $share->expects($shareWith !== null ? $this->once() : $this->never()) ->method('getSharedWith') - ->willReturn((string) $shareWith); + ->willReturn((string)$shareWith); return $share; } diff --git a/tests/Mock/Setting1.php b/tests/Mock/Setting1.php index 0bf7fcc1a..a860262aa 100644 --- a/tests/Mock/Setting1.php +++ b/tests/Mock/Setting1.php @@ -43,8 +43,8 @@ public function getName() { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/tests/Mock/Setting2.php b/tests/Mock/Setting2.php index bf16f8052..ef3445881 100644 --- a/tests/Mock/Setting2.php +++ b/tests/Mock/Setting2.php @@ -43,8 +43,8 @@ public function getName() { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() {