Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions apps/admin_audit/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function sharingLegacyHooks(IAuditLogger $logger): void {

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

$eventDispatcher->addListener(
BeforeNodeRenamedEvent::class,
function (BeforeNodeRenamedEvent $event) use ($fileActions) {
function (BeforeNodeRenamedEvent $event) use ($fileActions): void {
$fileActions->beforeRename($event);
}
);

$eventDispatcher->addListener(
NodeRenamedEvent::class,
function (NodeRenamedEvent $event) use ($fileActions) {
function (NodeRenamedEvent $event) use ($fileActions): void {
$fileActions->afterRename($event);
}
);

$eventDispatcher->addListener(
NodeCreatedEvent::class,
function (NodeCreatedEvent $event) use ($fileActions) {
function (NodeCreatedEvent $event) use ($fileActions): void {
$fileActions->create($event);
}
);

$eventDispatcher->addListener(
NodeCopiedEvent::class,
function (NodeCopiedEvent $event) use ($fileActions) {
function (NodeCopiedEvent $event) use ($fileActions): void {
$fileActions->copy($event);
}
);

$eventDispatcher->addListener(
BeforeNodeWrittenEvent::class,
function (BeforeNodeWrittenEvent $event) use ($fileActions) {
function (BeforeNodeWrittenEvent $event) use ($fileActions): void {
$fileActions->write($event);
}
);

$eventDispatcher->addListener(
NodeWrittenEvent::class,
function (NodeWrittenEvent $event) use ($fileActions) {
function (NodeWrittenEvent $event) use ($fileActions): void {
$fileActions->update($event);
}
);

$eventDispatcher->addListener(
BeforeNodeReadEvent::class,
function (BeforeNodeReadEvent $event) use ($fileActions) {
function (BeforeNodeReadEvent $event) use ($fileActions): void {
$fileActions->read($event);
}
);

$eventDispatcher->addListener(
NodeDeletedEvent::class,
function (NodeDeletedEvent $event) use ($fileActions) {
function (NodeDeletedEvent $event) use ($fileActions): void {
$fileActions->delete($event);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function handle(Event $event): void {
return;
}

$this->atomic(function () use ($event) {
$this->atomic(function () use ($event): void {
$uid = $event->getUid();
$email = $event->getEmail();
$federatedCloudId = $event->getFederatedCloudId();
Expand Down
8 changes: 4 additions & 4 deletions apps/dav/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,20 @@ public function registerHooks(HookManager $hm,
$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(
Expand Down Expand Up @@ -272,7 +272,7 @@ private function setupSystemContactsProvider(IContactsManager $contactsManager,

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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(ITimeFactory $time,
* @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
Expand Down
24 changes: 12 additions & 12 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ public function updateCalendar($calendarId, PropPatch $propPatch) {
* @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.
Expand Down Expand Up @@ -926,7 +926,7 @@ public function deleteCalendar($calendarId, bool $forceDeletePermanently = false
}

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))
Expand Down Expand Up @@ -1471,7 +1471,7 @@ public function setClassification($calendarObjectId, $classification) {
*/
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) {
Expand Down Expand Up @@ -1553,7 +1553,7 @@ public function deleteCalendarObject($calendarId, $objectUri, $calendarType = se
*/
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(
Expand Down Expand Up @@ -2697,7 +2697,7 @@ public function updateSubscription($subscriptionId, PropPatch $propPatch) {
* @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();
Expand Down Expand Up @@ -2889,7 +2889,7 @@ protected function addChanges(int $calendarId, array $objectUris, int $operation
$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)
Expand Down Expand Up @@ -2924,7 +2924,7 @@ protected function addChanges(int $calendarId, array $objectUris, int $operation
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')
Expand Down Expand Up @@ -3090,7 +3090,7 @@ private function readBlob($cardData) {
* @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) {
Expand Down Expand Up @@ -3188,7 +3188,7 @@ public function applyShareAcl(int $resourceId, array $acl): array {
*/
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 {
Expand Down Expand Up @@ -3260,7 +3260,7 @@ public function updateProperties($calendarId, $objectUri, $calendarData, $calend
* 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)))
Expand All @@ -3280,7 +3280,7 @@ public function deleteAllBirthdayCalendars() {
* @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')
Expand Down Expand Up @@ -3326,7 +3326,7 @@ public function purgeCachedEventsForSubscription(int $subscriptionId, array $cal
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)
Expand Down
8 changes: 4 additions & 4 deletions apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public function createAddressBook($principalUri, $url, array $properties) {
* @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);
Expand Down Expand Up @@ -939,7 +939,7 @@ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel,
* @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')
Expand Down Expand Up @@ -1014,7 +1014,7 @@ private function readBlob($cardData, &$modified = false) {
* @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);
Expand Down Expand Up @@ -1292,7 +1292,7 @@ public function getShares(int $addressBookId): array {
* @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);

Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/CardDAV/SyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function syncRemoteAddressBook(string $url, string $userName, string $add
$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);
Expand Down Expand Up @@ -200,7 +200,7 @@ public function updateUser(IUser $user): void {

$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);
Expand Down Expand Up @@ -251,7 +251,7 @@ public function getLocalSystemAddressBook() {
*/
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();
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Command/FixCalendarSyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$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();
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Command/SyncBirthdayCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$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();
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Command/SyncSystemAddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$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();
});

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Comments/CommentsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function initialize(Server $server) {

$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));
};

Expand Down
8 changes: 4 additions & 4 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,27 @@ public function put($data) {
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);
});
}
}

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);
});

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function initialize(Server $server) {
$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);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function createServer(string $baseUri,
$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();

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Controller/BirthdayCalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function enable() {
$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(),
]);
Expand Down
Loading