Skip to content

Commit 8927510

Browse files
authored
Merge pull request #48223 from nextcloud/feat/add-rector-config
Add rector config
2 parents d4839b9 + 98efa3b commit 8927510

73 files changed

Lines changed: 393 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/admin_audit/lib/AppInfo/Application.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private function sharingLegacyHooks(IAuditLogger $logger): void {
157157

158158
private function tagHooks(IAuditLogger $logger,
159159
IEventDispatcher $eventDispatcher): void {
160-
$eventDispatcher->addListener(\OCP\SystemTag\ManagerEvent::EVENT_CREATE, function (\OCP\SystemTag\ManagerEvent $event) use ($logger) {
160+
$eventDispatcher->addListener(\OCP\SystemTag\ManagerEvent::EVENT_CREATE, function (\OCP\SystemTag\ManagerEvent $event) use ($logger): void {
161161
$tagActions = new TagManagement($logger);
162162
$tagActions->createTag($event->getTag());
163163
});
@@ -168,56 +168,56 @@ private function fileHooks(IAuditLogger $logger, IEventDispatcher $eventDispatch
168168

169169
$eventDispatcher->addListener(
170170
BeforeNodeRenamedEvent::class,
171-
function (BeforeNodeRenamedEvent $event) use ($fileActions) {
171+
function (BeforeNodeRenamedEvent $event) use ($fileActions): void {
172172
$fileActions->beforeRename($event);
173173
}
174174
);
175175

176176
$eventDispatcher->addListener(
177177
NodeRenamedEvent::class,
178-
function (NodeRenamedEvent $event) use ($fileActions) {
178+
function (NodeRenamedEvent $event) use ($fileActions): void {
179179
$fileActions->afterRename($event);
180180
}
181181
);
182182

183183
$eventDispatcher->addListener(
184184
NodeCreatedEvent::class,
185-
function (NodeCreatedEvent $event) use ($fileActions) {
185+
function (NodeCreatedEvent $event) use ($fileActions): void {
186186
$fileActions->create($event);
187187
}
188188
);
189189

190190
$eventDispatcher->addListener(
191191
NodeCopiedEvent::class,
192-
function (NodeCopiedEvent $event) use ($fileActions) {
192+
function (NodeCopiedEvent $event) use ($fileActions): void {
193193
$fileActions->copy($event);
194194
}
195195
);
196196

197197
$eventDispatcher->addListener(
198198
BeforeNodeWrittenEvent::class,
199-
function (BeforeNodeWrittenEvent $event) use ($fileActions) {
199+
function (BeforeNodeWrittenEvent $event) use ($fileActions): void {
200200
$fileActions->write($event);
201201
}
202202
);
203203

204204
$eventDispatcher->addListener(
205205
NodeWrittenEvent::class,
206-
function (NodeWrittenEvent $event) use ($fileActions) {
206+
function (NodeWrittenEvent $event) use ($fileActions): void {
207207
$fileActions->update($event);
208208
}
209209
);
210210

211211
$eventDispatcher->addListener(
212212
BeforeNodeReadEvent::class,
213-
function (BeforeNodeReadEvent $event) use ($fileActions) {
213+
function (BeforeNodeReadEvent $event) use ($fileActions): void {
214214
$fileActions->read($event);
215215
}
216216
);
217217

218218
$eventDispatcher->addListener(
219219
NodeDeletedEvent::class,
220-
function (NodeDeletedEvent $event) use ($fileActions) {
220+
function (NodeDeletedEvent $event) use ($fileActions): void {
221221
$fileActions->delete($event);
222222
}
223223
);

apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function handle(Event $event): void {
5454
return;
5555
}
5656

57-
$this->atomic(function () use ($event) {
57+
$this->atomic(function () use ($event): void {
5858
$uid = $event->getUid();
5959
$email = $event->getEmail();
6060
$federatedCloudId = $event->getFederatedCloudId();

apps/dav/lib/AppInfo/Application.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,20 @@ public function registerHooks(HookManager $hm,
214214
$hm->setup();
215215

216216
// first time login event setup
217-
$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
217+
$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm): void {
218218
if ($event instanceof GenericEvent) {
219219
$hm->firstLogin($event->getSubject());
220220
}
221221
});
222222

223-
$dispatcher->addListener(UserUpdatedEvent::class, function (UserUpdatedEvent $event) use ($container) {
223+
$dispatcher->addListener(UserUpdatedEvent::class, function (UserUpdatedEvent $event) use ($container): void {
224224
/** @var SyncService $syncService */
225225
$syncService = \OCP\Server::get(SyncService::class);
226226
$syncService->updateUser($event->getUser());
227227
});
228228

229229

230-
$dispatcher->addListener(CalendarShareUpdatedEvent::class, function (CalendarShareUpdatedEvent $event) use ($container) {
230+
$dispatcher->addListener(CalendarShareUpdatedEvent::class, function (CalendarShareUpdatedEvent $event) use ($container): void {
231231
/** @var Backend $backend */
232232
$backend = $container->query(Backend::class);
233233
$backend->onCalendarUpdateShares(
@@ -272,7 +272,7 @@ private function setupSystemContactsProvider(IContactsManager $contactsManager,
272272

273273
public function registerCalendarManager(ICalendarManager $calendarManager,
274274
IAppContainer $container): void {
275-
$calendarManager->register(function () use ($container, $calendarManager) {
275+
$calendarManager->register(function () use ($container, $calendarManager): void {
276276
$user = \OC::$server->getUserSession()->getUser();
277277
if ($user !== null) {
278278
$this->setupCalendarProvider($calendarManager, $container, $user->getUID());

apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(ITimeFactory $time,
4141
* @inheritDoc
4242
*/
4343
public function run($argument) {
44-
$this->userManager->callForSeenUsers(function (IUser $user) {
44+
$this->userManager->callForSeenUsers(function (IUser $user): void {
4545
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
4646
'userId' => $user->getUID(),
4747
'purgeBeforeGenerating' => true

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ public function updateCalendar($calendarId, PropPatch $propPatch) {
865865
* @return void
866866
*/
867867
public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) {
868-
$this->atomic(function () use ($calendarId, $forceDeletePermanently) {
868+
$this->atomic(function () use ($calendarId, $forceDeletePermanently): void {
869869
// The calendar is deleted right away if this is either enforced by the caller
870870
// or the special contacts birthday calendar or when the preference of an empty
871871
// retention (0 seconds) is set, which signals a disabled trashbin.
@@ -926,7 +926,7 @@ public function deleteCalendar($calendarId, bool $forceDeletePermanently = false
926926
}
927927

928928
public function restoreCalendar(int $id): void {
929-
$this->atomic(function () use ($id) {
929+
$this->atomic(function () use ($id): void {
930930
$qb = $this->db->getQueryBuilder();
931931
$update = $qb->update('calendars')
932932
->set('deleted_at', $qb->createNamedParameter(null))
@@ -1471,7 +1471,7 @@ public function setClassification($calendarObjectId, $classification) {
14711471
*/
14721472
public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) {
14731473
$this->cachedObjects = [];
1474-
$this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently) {
1474+
$this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void {
14751475
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
14761476

14771477
if ($data === null) {
@@ -1553,7 +1553,7 @@ public function deleteCalendarObject($calendarId, $objectUri, $calendarType = se
15531553
*/
15541554
public function restoreCalendarObject(array $objectData): void {
15551555
$this->cachedObjects = [];
1556-
$this->atomic(function () use ($objectData) {
1556+
$this->atomic(function () use ($objectData): void {
15571557
$id = (int)$objectData['id'];
15581558
$restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']);
15591559
$targetObject = $this->getCalendarObject(
@@ -2697,7 +2697,7 @@ public function updateSubscription($subscriptionId, PropPatch $propPatch) {
26972697
* @return void
26982698
*/
26992699
public function deleteSubscription($subscriptionId) {
2700-
$this->atomic(function () use ($subscriptionId) {
2700+
$this->atomic(function () use ($subscriptionId): void {
27012701
$subscriptionRow = $this->getSubscriptionById($subscriptionId);
27022702

27032703
$query = $this->db->getQueryBuilder();
@@ -2889,7 +2889,7 @@ protected function addChanges(int $calendarId, array $objectUris, int $operation
28892889
$this->cachedObjects = [];
28902890
$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
28912891

2892-
$this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table) {
2892+
$this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void {
28932893
$query = $this->db->getQueryBuilder();
28942894
$query->select('synctoken')
28952895
->from($table)
@@ -2924,7 +2924,7 @@ protected function addChanges(int $calendarId, array $objectUris, int $operation
29242924
public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void {
29252925
$this->cachedObjects = [];
29262926

2927-
$this->atomic(function () use ($calendarId, $calendarType) {
2927+
$this->atomic(function () use ($calendarId, $calendarType): void {
29282928
$qbAdded = $this->db->getQueryBuilder();
29292929
$qbAdded->select('uri')
29302930
->from('calendarobjects')
@@ -3090,7 +3090,7 @@ private function readBlob($cardData) {
30903090
* @param list<string> $remove
30913091
*/
30923092
public function updateShares(IShareable $shareable, array $add, array $remove): void {
3093-
$this->atomic(function () use ($shareable, $add, $remove) {
3093+
$this->atomic(function () use ($shareable, $add, $remove): void {
30943094
$calendarId = $shareable->getResourceId();
30953095
$calendarRow = $this->getCalendarById($calendarId);
30963096
if ($calendarRow === null) {
@@ -3188,7 +3188,7 @@ public function applyShareAcl(int $resourceId, array $acl): array {
31883188
*/
31893189
public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
31903190
$this->cachedObjects = [];
3191-
$this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType) {
3191+
$this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void {
31923192
$objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
31933193

31943194
try {
@@ -3260,7 +3260,7 @@ public function updateProperties($calendarId, $objectUri, $calendarData, $calend
32603260
* deletes all birthday calendars
32613261
*/
32623262
public function deleteAllBirthdayCalendars() {
3263-
$this->atomic(function () {
3263+
$this->atomic(function (): void {
32643264
$query = $this->db->getQueryBuilder();
32653265
$result = $query->select(['id'])->from('calendars')
32663266
->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
@@ -3280,7 +3280,7 @@ public function deleteAllBirthdayCalendars() {
32803280
* @param $subscriptionId
32813281
*/
32823282
public function purgeAllCachedEventsForSubscription($subscriptionId) {
3283-
$this->atomic(function () use ($subscriptionId) {
3283+
$this->atomic(function () use ($subscriptionId): void {
32843284
$query = $this->db->getQueryBuilder();
32853285
$query->select('uri')
32863286
->from('calendarobjects')
@@ -3326,7 +3326,7 @@ public function purgeCachedEventsForSubscription(int $subscriptionId, array $cal
33263326
return;
33273327
}
33283328

3329-
$this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris) {
3329+
$this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void {
33303330
foreach (array_chunk($calendarObjectIds, 1000) as $chunk) {
33313331
$query = $this->db->getQueryBuilder();
33323332
$query->delete($this->dbObjectPropertiesTable)

apps/dav/lib/CardDAV/CardDavBackend.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public function createAddressBook($principalUri, $url, array $properties) {
416416
* @return void
417417
*/
418418
public function deleteAddressBook($addressBookId) {
419-
$this->atomic(function () use ($addressBookId) {
419+
$this->atomic(function () use ($addressBookId): void {
420420
$addressBookId = (int)$addressBookId;
421421
$addressBookData = $this->getAddressBookById($addressBookId);
422422
$shares = $this->getShares($addressBookId);
@@ -939,7 +939,7 @@ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel,
939939
* @return void
940940
*/
941941
protected function addChange(int $addressBookId, string $objectUri, int $operation): void {
942-
$this->atomic(function () use ($addressBookId, $objectUri, $operation) {
942+
$this->atomic(function () use ($addressBookId, $objectUri, $operation): void {
943943
$query = $this->db->getQueryBuilder();
944944
$query->select('synctoken')
945945
->from('addressbooks')
@@ -1014,7 +1014,7 @@ private function readBlob($cardData, &$modified = false) {
10141014
* @param list<string> $remove
10151015
*/
10161016
public function updateShares(IShareable $shareable, array $add, array $remove): void {
1017-
$this->atomic(function () use ($shareable, $add, $remove) {
1017+
$this->atomic(function () use ($shareable, $add, $remove): void {
10181018
$addressBookId = $shareable->getResourceId();
10191019
$addressBookData = $this->getAddressBookById($addressBookId);
10201020
$oldShares = $this->getShares($addressBookId);
@@ -1292,7 +1292,7 @@ public function getShares(int $addressBookId): array {
12921292
* @param string $vCardSerialized
12931293
*/
12941294
protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) {
1295-
$this->atomic(function () use ($addressBookId, $cardUri, $vCardSerialized) {
1295+
$this->atomic(function () use ($addressBookId, $cardUri, $vCardSerialized): void {
12961296
$cardId = $this->getCardId($addressBookId, $cardUri);
12971297
$vCard = $this->readCard($vCardSerialized);
12981298

apps/dav/lib/CardDAV/SyncService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function syncRemoteAddressBook(string $url, string $userName, string $add
7777
$cardUri = basename($resource);
7878
if (isset($status[200])) {
7979
$vCard = $this->download($url, $userName, $sharedSecret, $resource);
80-
$this->atomic(function () use ($addressBookId, $cardUri, $vCard) {
80+
$this->atomic(function () use ($addressBookId, $cardUri, $vCard): void {
8181
$existingCard = $this->backend->getCard($addressBookId, $cardUri);
8282
if ($existingCard === false) {
8383
$this->backend->createCard($addressBookId, $cardUri, $vCard);
@@ -200,7 +200,7 @@ public function updateUser(IUser $user): void {
200200

201201
$cardId = self::getCardUri($user);
202202
if ($user->isEnabled()) {
203-
$this->atomic(function () use ($addressBookId, $cardId, $user) {
203+
$this->atomic(function () use ($addressBookId, $cardId, $user): void {
204204
$card = $this->backend->getCard($addressBookId, $cardId);
205205
if ($card === false) {
206206
$vCard = $this->converter->createCardFromUser($user);
@@ -251,7 +251,7 @@ public function getLocalSystemAddressBook() {
251251
*/
252252
public function syncInstance(?\Closure $progressCallback = null) {
253253
$systemAddressBook = $this->getLocalSystemAddressBook();
254-
$this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback) {
254+
$this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback): void {
255255
$this->updateUser($user);
256256
if (!is_null($progressCallback)) {
257257
$progressCallback();

apps/dav/lib/Command/FixCalendarSyncCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
4949
$this->fixUserCalendars($user);
5050
} else {
5151
$progress = new ProgressBar($output);
52-
$this->userManager->callForSeenUsers(function (IUser $user) use ($progress) {
52+
$this->userManager->callForSeenUsers(function (IUser $user) use ($progress): void {
5353
$this->fixUserCalendars($user, $progress);
5454
});
5555
$progress->finish();

apps/dav/lib/Command/SyncBirthdayCalendar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5858
$output->writeln('Start birthday calendar sync for all users ...');
5959
$p = new ProgressBar($output);
6060
$p->start();
61-
$this->userManager->callForSeenUsers(function ($user) use ($p) {
61+
$this->userManager->callForSeenUsers(function ($user) use ($p): void {
6262
$p->advance();
6363

6464
$userId = $user->getUID();

apps/dav/lib/Command/SyncSystemAddressBook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3232
$output->writeln('Syncing users ...');
3333
$progress = new ProgressBar($output);
3434
$progress->start();
35-
$this->syncService->syncInstance(function () use ($progress) {
35+
$this->syncService->syncInstance(function () use ($progress): void {
3636
$progress->advance();
3737
});
3838

0 commit comments

Comments
 (0)