diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-09-20 17:38:36 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-09-20 17:51:00 +0200 |
commit | 1a4978c4ead55daa2726df5967c1377d61a57f7a (patch) | |
tree | 88c8a82ed52b8698be9e0cd4e9cef29b3c0d8ea1 /apps/dav/lib | |
parent | 6db9cbfdeb7dd475a258c1c2f2c163c41856d6c2 (diff) | |
download | nextcloud-server-1a4978c4ead55daa2726df5967c1377d61a57f7a.tar.gz nextcloud-server-1a4978c4ead55daa2726df5967c1377d61a57f7a.zip |
chore: Apply rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/AppInfo/Application.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 24 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/CardDavBackend.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/SyncService.php | 6 | ||||
-rw-r--r-- | apps/dav/lib/Command/FixCalendarSyncCommand.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Command/SyncBirthdayCalendar.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Command/SyncSystemAddressBook.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Comments/CommentsPlugin.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/FilesPlugin.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ServerFactory.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Controller/BirthdayCalendarController.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/HookManager.php | 4 | ||||
-rw-r--r-- | apps/dav/lib/Migration/ChunkCleanup.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Server.php | 2 |
16 files changed, 39 insertions, 39 deletions
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 1ce59b44d8b..fb6a195aedb 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -214,20 +214,20 @@ class Application extends App implements IBootstrap { $hm->setup(); // first time login event setup - $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { + $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm): void { if ($event instanceof GenericEvent) { $hm->firstLogin($event->getSubject()); } }); - $dispatcher->addListener(UserUpdatedEvent::class, function (UserUpdatedEvent $event) use ($container) { + $dispatcher->addListener(UserUpdatedEvent::class, function (UserUpdatedEvent $event) use ($container): void { /** @var SyncService $syncService */ $syncService = \OCP\Server::get(SyncService::class); $syncService->updateUser($event->getUser()); }); - $dispatcher->addListener(CalendarShareUpdatedEvent::class, function (CalendarShareUpdatedEvent $event) use ($container) { + $dispatcher->addListener(CalendarShareUpdatedEvent::class, function (CalendarShareUpdatedEvent $event) use ($container): void { /** @var Backend $backend */ $backend = $container->query(Backend::class); $backend->onCalendarUpdateShares( @@ -272,7 +272,7 @@ class Application extends App implements IBootstrap { public function registerCalendarManager(ICalendarManager $calendarManager, IAppContainer $container): void { - $calendarManager->register(function () use ($container, $calendarManager) { + $calendarManager->register(function () use ($container, $calendarManager): void { $user = \OC::$server->getUserSession()->getUser(); if ($user !== null) { $this->setupCalendarProvider($calendarManager, $container, $user->getUID()); diff --git a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php index 61fe4cd8483..24149fe2263 100644 --- a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php +++ b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php @@ -41,7 +41,7 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob { * @inheritDoc */ public function run($argument) { - $this->userManager->callForSeenUsers(function (IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user): void { $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ 'userId' => $user->getUID(), 'purgeBeforeGenerating' => true diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index b8dfe762e35..101bf36617a 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -865,7 +865,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return void */ public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) { - $this->atomic(function () use ($calendarId, $forceDeletePermanently) { + $this->atomic(function () use ($calendarId, $forceDeletePermanently): void { // The calendar is deleted right away if this is either enforced by the caller // or the special contacts birthday calendar or when the preference of an empty // retention (0 seconds) is set, which signals a disabled trashbin. @@ -926,7 +926,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } public function restoreCalendar(int $id): void { - $this->atomic(function () use ($id) { + $this->atomic(function () use ($id): void { $qb = $this->db->getQueryBuilder(); $update = $qb->update('calendars') ->set('deleted_at', $qb->createNamedParameter(null)) @@ -1471,7 +1471,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription */ public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) { $this->cachedObjects = []; - $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently) { + $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); if ($data === null) { @@ -1553,7 +1553,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription */ public function restoreCalendarObject(array $objectData): void { $this->cachedObjects = []; - $this->atomic(function () use ($objectData) { + $this->atomic(function () use ($objectData): void { $id = (int)$objectData['id']; $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); $targetObject = $this->getCalendarObject( @@ -2697,7 +2697,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return void */ public function deleteSubscription($subscriptionId) { - $this->atomic(function () use ($subscriptionId) { + $this->atomic(function () use ($subscriptionId): void { $subscriptionRow = $this->getSubscriptionById($subscriptionId); $query = $this->db->getQueryBuilder(); @@ -2889,7 +2889,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $this->cachedObjects = []; $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; - $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table) { + $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void { $query = $this->db->getQueryBuilder(); $query->select('synctoken') ->from($table) @@ -2924,7 +2924,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { $this->cachedObjects = []; - $this->atomic(function () use ($calendarId, $calendarType) { + $this->atomic(function () use ($calendarId, $calendarType): void { $qbAdded = $this->db->getQueryBuilder(); $qbAdded->select('uri') ->from('calendarobjects') @@ -3090,7 +3090,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param list<string> $remove */ public function updateShares(IShareable $shareable, array $add, array $remove): void { - $this->atomic(function () use ($shareable, $add, $remove) { + $this->atomic(function () use ($shareable, $add, $remove): void { $calendarId = $shareable->getResourceId(); $calendarRow = $this->getCalendarById($calendarId); if ($calendarRow === null) { @@ -3188,7 +3188,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription */ public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { $this->cachedObjects = []; - $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType) { + $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void { $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); try { @@ -3260,7 +3260,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * deletes all birthday calendars */ public function deleteAllBirthdayCalendars() { - $this->atomic(function () { + $this->atomic(function (): void { $query = $this->db->getQueryBuilder(); $result = $query->select(['id'])->from('calendars') ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) @@ -3280,7 +3280,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param $subscriptionId */ public function purgeAllCachedEventsForSubscription($subscriptionId) { - $this->atomic(function () use ($subscriptionId) { + $this->atomic(function () use ($subscriptionId): void { $query = $this->db->getQueryBuilder(); $query->select('uri') ->from('calendarobjects') @@ -3326,7 +3326,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return; } - $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris) { + $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { foreach (array_chunk($calendarObjectIds, 1000) as $chunk) { $query = $this->db->getQueryBuilder(); $query->delete($this->dbObjectPropertiesTable) diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 9dee61638a5..b94da9fa7ed 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -416,7 +416,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @return void */ public function deleteAddressBook($addressBookId) { - $this->atomic(function () use ($addressBookId) { + $this->atomic(function () use ($addressBookId): void { $addressBookId = (int)$addressBookId; $addressBookData = $this->getAddressBookById($addressBookId); $shares = $this->getShares($addressBookId); @@ -939,7 +939,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @return void */ protected function addChange(int $addressBookId, string $objectUri, int $operation): void { - $this->atomic(function () use ($addressBookId, $objectUri, $operation) { + $this->atomic(function () use ($addressBookId, $objectUri, $operation): void { $query = $this->db->getQueryBuilder(); $query->select('synctoken') ->from('addressbooks') @@ -1014,7 +1014,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param list<string> $remove */ public function updateShares(IShareable $shareable, array $add, array $remove): void { - $this->atomic(function () use ($shareable, $add, $remove) { + $this->atomic(function () use ($shareable, $add, $remove): void { $addressBookId = $shareable->getResourceId(); $addressBookData = $this->getAddressBookById($addressBookId); $oldShares = $this->getShares($addressBookId); @@ -1292,7 +1292,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $vCardSerialized */ protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) { - $this->atomic(function () use ($addressBookId, $cardUri, $vCardSerialized) { + $this->atomic(function () use ($addressBookId, $cardUri, $vCardSerialized): void { $cardId = $this->getCardId($addressBookId, $cardUri); $vCard = $this->readCard($vCardSerialized); diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index 02b862f1930..5f8752a9d49 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -77,7 +77,7 @@ class SyncService { $cardUri = basename($resource); if (isset($status[200])) { $vCard = $this->download($url, $userName, $sharedSecret, $resource); - $this->atomic(function () use ($addressBookId, $cardUri, $vCard) { + $this->atomic(function () use ($addressBookId, $cardUri, $vCard): void { $existingCard = $this->backend->getCard($addressBookId, $cardUri); if ($existingCard === false) { $this->backend->createCard($addressBookId, $cardUri, $vCard); @@ -200,7 +200,7 @@ class SyncService { $cardId = self::getCardUri($user); if ($user->isEnabled()) { - $this->atomic(function () use ($addressBookId, $cardId, $user) { + $this->atomic(function () use ($addressBookId, $cardId, $user): void { $card = $this->backend->getCard($addressBookId, $cardId); if ($card === false) { $vCard = $this->converter->createCardFromUser($user); @@ -251,7 +251,7 @@ class SyncService { */ public function syncInstance(?\Closure $progressCallback = null) { $systemAddressBook = $this->getLocalSystemAddressBook(); - $this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback) { + $this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback): void { $this->updateUser($user); if (!is_null($progressCallback)) { $progressCallback(); diff --git a/apps/dav/lib/Command/FixCalendarSyncCommand.php b/apps/dav/lib/Command/FixCalendarSyncCommand.php index c10ee7e3da6..bb269c92e15 100644 --- a/apps/dav/lib/Command/FixCalendarSyncCommand.php +++ b/apps/dav/lib/Command/FixCalendarSyncCommand.php @@ -49,7 +49,7 @@ class FixCalendarSyncCommand extends Command { $this->fixUserCalendars($user); } else { $progress = new ProgressBar($output); - $this->userManager->callForSeenUsers(function (IUser $user) use ($progress) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($progress): void { $this->fixUserCalendars($user, $progress); }); $progress->finish(); diff --git a/apps/dav/lib/Command/SyncBirthdayCalendar.php b/apps/dav/lib/Command/SyncBirthdayCalendar.php index de63a8572bb..db1ebb6ecb5 100644 --- a/apps/dav/lib/Command/SyncBirthdayCalendar.php +++ b/apps/dav/lib/Command/SyncBirthdayCalendar.php @@ -58,7 +58,7 @@ class SyncBirthdayCalendar extends Command { $output->writeln('Start birthday calendar sync for all users ...'); $p = new ProgressBar($output); $p->start(); - $this->userManager->callForSeenUsers(function ($user) use ($p) { + $this->userManager->callForSeenUsers(function ($user) use ($p): void { $p->advance(); $userId = $user->getUID(); diff --git a/apps/dav/lib/Command/SyncSystemAddressBook.php b/apps/dav/lib/Command/SyncSystemAddressBook.php index 715d3d65f87..54edba01e05 100644 --- a/apps/dav/lib/Command/SyncSystemAddressBook.php +++ b/apps/dav/lib/Command/SyncSystemAddressBook.php @@ -32,7 +32,7 @@ class SyncSystemAddressBook extends Command { $output->writeln('Syncing users ...'); $progress = new ProgressBar($output); $progress->start(); - $this->syncService->syncInstance(function () use ($progress) { + $this->syncService->syncInstance(function () use ($progress): void { $progress->advance(); }); diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 52e48ec0ed1..ef0de057ebb 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -73,7 +73,7 @@ class CommentsPlugin extends ServerPlugin { $this->server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; - $this->server->xml->classMap['DateTime'] = function (Writer $writer, \DateTime $value) { + $this->server->xml->classMap['DateTime'] = function (Writer $writer, \DateTime $value): void { $writer->write(\Sabre\HTTP\toDate($value)); }; diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 34cc2b77b37..d1769ce6b81 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -181,19 +181,19 @@ class File extends Node implements IFile { if ($this->request->getHeader('X-HASH') !== '') { $hash = $this->request->getHeader('X-HASH'); if ($hash === 'all' || $hash === 'md5') { - $data = HashWrapper::wrap($data, 'md5', function ($hash) { + $data = HashWrapper::wrap($data, 'md5', function ($hash): void { $this->header('X-Hash-MD5: ' . $hash); }); } if ($hash === 'all' || $hash === 'sha1') { - $data = HashWrapper::wrap($data, 'sha1', function ($hash) { + $data = HashWrapper::wrap($data, 'sha1', function ($hash): void { $this->header('X-Hash-SHA1: ' . $hash); }); } if ($hash === 'all' || $hash === 'sha256') { - $data = HashWrapper::wrap($data, 'sha256', function ($hash) { + $data = HashWrapper::wrap($data, 'sha256', function ($hash): void { $this->header('X-Hash-SHA256: ' . $hash); }); } @@ -201,7 +201,7 @@ class File extends Node implements IFile { if ($partStorage->instanceOfStorage(IWriteStreamStorage::class)) { $isEOF = false; - $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function ($stream) use (&$isEOF) { + $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function ($stream) use (&$isEOF): void { $isEOF = feof($stream); }); diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 60da92e3bdf..07308d4e805 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -131,7 +131,7 @@ class FilesPlugin extends ServerPlugin { $this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']); $this->server->on('afterMethod:GET', [$this,'httpGet']); $this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']); - $this->server->on('afterResponse', function ($request, ResponseInterface $response) { + $this->server->on('afterResponse', function ($request, ResponseInterface $response): void { $body = $response->getBody(); if (is_resource($body)) { fclose($body); diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index 106b425b121..53ce0ec3eee 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -105,7 +105,7 @@ class ServerFactory { $server->addPlugin(new ErrorPagePlugin($this->request, $this->config)); // wait with registering these until auth is handled and the filesystem is setup - $server->on('beforeMethod:*', function () use ($server, $objectTree, $viewCallBack) { + $server->on('beforeMethod:*', function () use ($server, $objectTree, $viewCallBack): void { // ensure the skeleton is copied $userFolder = \OC::$server->getUserFolder(); diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php index e82c4ad534c..9e18b5111a8 100644 --- a/apps/dav/lib/Controller/BirthdayCalendarController.php +++ b/apps/dav/lib/Controller/BirthdayCalendarController.php @@ -78,7 +78,7 @@ class BirthdayCalendarController extends Controller { $this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes'); // add background job for each user - $this->userManager->callForSeenUsers(function (IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user): void { $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ 'userId' => $user->getUID(), ]); diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index e3f18febb80..f717752038a 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -62,7 +62,7 @@ class HookManager { 'post_createUser', $this, 'postCreateUser'); - \OC::$server->getUserManager()->listen('\OC\User', 'assignedUserId', function ($uid) { + \OC::$server->getUserManager()->listen('\OC\User', 'assignedUserId', function ($uid): void { $this->postCreateUser(['uid' => $uid]); }); Util::connectHook('OC_User', @@ -74,7 +74,7 @@ class HookManager { 'post_deleteUser', $this, 'postDeleteUser'); - \OC::$server->getUserManager()->listen('\OC\User', 'postUnassignedUserId', function ($uid) { + \OC::$server->getUserManager()->listen('\OC\User', 'postUnassignedUserId', function ($uid): void { $this->postDeleteUser(['uid' => $uid]); }); \OC::$server->getUserManager()->listen('\OC\User', 'postUnassignedUserId', [$this, 'postUnassignedUserId']); diff --git a/apps/dav/lib/Migration/ChunkCleanup.php b/apps/dav/lib/Migration/ChunkCleanup.php index b4d5f48897e..96e84984700 100644 --- a/apps/dav/lib/Migration/ChunkCleanup.php +++ b/apps/dav/lib/Migration/ChunkCleanup.php @@ -52,7 +52,7 @@ class ChunkCleanup implements IRepairStep { $output->startProgress(); // Loop over all seen users - $this->userManager->callForSeenUsers(function (IUser $user) use ($output) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($output): void { try { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $userRoot = $userFolder->getParent(); diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 2784e99b5f7..daf180aec83 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -231,7 +231,7 @@ class Server { $this->server->addPlugin(new SearchPlugin($lazySearchBackend)); // wait with registering these until auth is handled and the filesystem is setup - $this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend, $logger) { + $this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend, $logger): void { // Allow view-only plugin for webdav requests $this->server->addPlugin(new ViewOnlyPlugin( \OC::$server->getUserFolder(), |