diff options
48 files changed, 159 insertions, 160 deletions
diff --git a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php index 1593be49a5d..f9c4d8dcd74 100644 --- a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php +++ b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php @@ -55,14 +55,14 @@ class UserStatusAutomation extends TimedJob { $userId = $argument['userId']; $user = $this->userManager->get($userId); - if($user === null) { + if ($user === null) { return; } $ooo = $this->coordinator->getCurrentOutOfOfficeData($user); $continue = $this->processOutOfOfficeData($user, $ooo); - if($continue === false) { + if ($continue === false) { return; } @@ -196,7 +196,7 @@ class UserStatusAutomation extends TimedJob { return; } - if(!$hasDndForOfficeHours) { + if (!$hasDndForOfficeHours) { // Office hours are not set to DND, so there is nothing to do. return; } @@ -207,7 +207,7 @@ class UserStatusAutomation extends TimedJob { } private function processOutOfOfficeData(IUser $user, ?IOutOfOfficeData $ooo): bool { - if(empty($ooo)) { + if (empty($ooo)) { // Reset the user status if the absence doesn't exist $this->logger->debug('User has no OOO period in effect, reverting DND status if applicable'); $this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); @@ -215,12 +215,12 @@ class UserStatusAutomation extends TimedJob { return true; } - if(!$this->coordinator->isInEffect($ooo)) { + if (!$this->coordinator->isInEffect($ooo)) { // Reset the user status if the absence is (no longer) in effect $this->logger->debug('User has no OOO period in effect, reverting DND status if applicable'); $this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); - if($ooo->getStartDate() > $this->time->getTime()) { + if ($ooo->getStartDate() > $this->time->getTime()) { // Set the next run to take place at the start of the ooo period if it is in the future // This might be overwritten if there is an availability setting, but we can't determine // if this is the case here diff --git a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php index 733e8079111..de5b1139880 100644 --- a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php +++ b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php @@ -115,7 +115,7 @@ class EnablePlugin extends ServerPlugin { } $owner = substr($node->getOwner(), 17); - if($owner !== $this->user->getUID()) { + if ($owner !== $this->user->getUID()) { $this->server->httpResponse->setStatus(403); return false; } diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index e35604e8497..43a22651747 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -2815,7 +2815,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->setMaxResults($limit); $result = $query->executeQuery(); $count = $result->rowCount(); - if($count === 0) { + if ($count === 0) { return; } $ids = array_map(static function (array $id) { @@ -2827,12 +2827,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $deleteQuery = $this->db->getQueryBuilder(); $deleteQuery->delete('schedulingobjects') ->where($deleteQuery->expr()->in('id', $deleteQuery->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY)); - foreach(array_chunk($ids, 1000) as $chunk) { + foreach (array_chunk($ids, 1000) as $chunk) { $deleteQuery->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY); $numDeleted += $deleteQuery->executeStatement(); } - if($numDeleted === $limit) { + if ($numDeleted === $limit) { $this->logger->info("Deleted $limit scheduling objects, continuing with next batch"); $this->deleteOutdatedSchedulingObjects($modifiedBefore, $limit); } @@ -3307,7 +3307,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param array<string> $calendarObjectUris */ public function purgeCachedEventsForSubscription(int $subscriptionId, array $calendarObjectIds, array $calendarObjectUris): void { - if(empty($calendarObjectUris)) { + if (empty($calendarObjectUris)) { return; } diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index d01c2affbc8..59a976ca6bc 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -149,9 +149,9 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { // Calendar - this covers all "regular" calendars, but not shared // only check if the method is available - if($this->caldavBackend instanceof CalDavBackend) { + if ($this->caldavBackend instanceof CalDavBackend) { $calendar = $this->caldavBackend->getCalendarByUri($this->principalInfo['uri'], $name); - if(!empty($calendar)) { + if (!empty($calendar)) { return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger); } } diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index bba1603c325..ea2ac0e9a62 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -84,7 +84,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { /** @var VCalendar $vobj */ $vobj = Reader::read($timezoneProp); $components = $vobj->getComponents(); - if(empty($components)) { + if (empty($components)) { return null; } /** @var VTimeZone $vtimezone */ diff --git a/apps/dav/lib/CalDAV/EventComparisonService.php b/apps/dav/lib/CalDAV/EventComparisonService.php index e3c7749a772..63395e7ce1c 100644 --- a/apps/dav/lib/CalDAV/EventComparisonService.php +++ b/apps/dav/lib/CalDAV/EventComparisonService.php @@ -37,14 +37,14 @@ class EventComparisonService { */ private function removeIfUnchanged(VEvent $filterEvent, array &$eventsToFilter): bool { $filterEventData = []; - foreach(self::EVENT_DIFF as $eventDiff) { + foreach (self::EVENT_DIFF as $eventDiff) { $filterEventData[] = IMipService::readPropertyWithDefault($filterEvent, $eventDiff, ''); } /** @var VEvent $component */ foreach ($eventsToFilter as $k => $eventToFilter) { $eventToFilterData = []; - foreach(self::EVENT_DIFF as $eventDiff) { + foreach (self::EVENT_DIFF as $eventDiff) { $eventToFilterData[] = IMipService::readPropertyWithDefault($eventToFilter, $eventDiff, ''); } // events are identical and can be removed @@ -73,23 +73,23 @@ class EventComparisonService { $newEventComponents = $new->getComponents(); foreach ($newEventComponents as $k => $event) { - if(!$event instanceof VEvent) { + if (!$event instanceof VEvent) { unset($newEventComponents[$k]); } } - if(empty($old)) { + if (empty($old)) { return ['old' => null, 'new' => $newEventComponents]; } $oldEventComponents = $old->getComponents(); - if(is_array($oldEventComponents) && !empty($oldEventComponents)) { + if (is_array($oldEventComponents) && !empty($oldEventComponents)) { foreach ($oldEventComponents as $k => $event) { - if(!$event instanceof VEvent) { + if (!$event instanceof VEvent) { unset($oldEventComponents[$k]); continue; } - if($this->removeIfUnchanged($event, $newEventComponents)) { + if ($this->removeIfUnchanged($event, $newEventComponents)) { unset($oldEventComponents[$k]); } } diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index 4ac9e83ef08..b6032e733d9 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -447,7 +447,7 @@ class ReminderService { $uniqueReminders = []; foreach ($reminders as $reminder) { $key = $reminder['notification_date']. $reminder['event_hash'].$reminder['type']; - if(!isset($uniqueReminders[$key])) { + if (!isset($uniqueReminders[$key])) { $uniqueReminders[$key] = $reminder; } } diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 1958531630a..e46cd039fd5 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -94,7 +94,7 @@ class IMipPlugin extends SabreIMipPlugin { * @param bool $modified modified */ public function beforeWriteContent($uri, INode $node, $data, $modified): void { - if(!$node instanceof CalendarObject) { + if (!$node instanceof CalendarObject) { return; } /** @var VCalendar $vCalendar */ @@ -151,7 +151,7 @@ class IMipPlugin extends SabreIMipPlugin { // No changed events after all - this shouldn't happen if there is significant change yet here we are // The scheduling status is debatable - if(empty($vEvent)) { + if (empty($vEvent)) { $this->logger->warning('iTip message said the change was significant but comparison did not detect any updated VEvents'); $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email'; return; @@ -163,14 +163,14 @@ class IMipPlugin extends SabreIMipPlugin { // we also might not have an old event as this could be a new // invitation, or a new recurrence exception $attendee = $this->imipService->getCurrentAttendee($iTipMessage); - if($attendee === null) { + if ($attendee === null) { $uid = $vEvent->UID ?? 'no UID found'; $this->logger->debug('Could not find recipient ' . $recipient . ' as attendee for event with UID ' . $uid); $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; return; } // Don't send emails to things - if($this->imipService->isRoomOrResource($attendee)) { + if ($this->imipService->isRoomOrResource($attendee)) { $this->logger->debug('No invitation sent as recipient is room or resource', [ 'attendee' => $recipient, ]); diff --git a/apps/dav/lib/CalDAV/Schedule/IMipService.php b/apps/dav/lib/CalDAV/Schedule/IMipService.php index 3d6317e6968..a101cb05db3 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipService.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipService.php @@ -88,7 +88,7 @@ class IMipService { return $default; } $newstring = $vevent->$property->getValue(); - if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) { + if (isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) { $oldstring = $oldVEvent->$property->getValue(); return sprintf($strikethrough, $oldstring, $newstring); } @@ -143,7 +143,7 @@ class IMipService { $data = []; $data['meeting_when'] = $this->generateWhenString($eventReaderCurrent); - foreach(self::STRING_DIFF as $key => $property) { + foreach (self::STRING_DIFF as $key => $property) { $data[$key] = self::readPropertyWithDefault($vEvent, $property, $defaultVal); } @@ -153,7 +153,7 @@ class IMipService { $data['meeting_location_html'] = $locationHtml; } - if(!empty($oldVEvent)) { + if (!empty($oldVEvent)) { $oldMeetingWhen = $this->generateWhenString($eventReaderPrevious); $data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']); $data['meeting_description_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'DESCRIPTION', $data['meeting_description']); @@ -638,7 +638,7 @@ class IMipService { return $dtEnd->getDateTime()->getTimeStamp(); } - if(isset($component->DURATION)) { + if (isset($component->DURATION)) { /** @var \DateTime $endDate */ $endDate = clone $dtStart->getDateTime(); // $component->DTEND->getDateTime() returns DateTimeImmutable @@ -646,7 +646,7 @@ class IMipService { return $endDate->getTimestamp(); } - if(!$dtStart->hasTime()) { + if (!$dtStart->hasTime()) { /** @var \DateTime $endDate */ // $component->DTSTART->getDateTime() returns DateTimeImmutable $endDate = clone $dtStart->getDateTime(); @@ -662,7 +662,7 @@ class IMipService { * @param Property|null $attendee */ public function setL10n(?Property $attendee = null) { - if($attendee === null) { + if ($attendee === null) { return; } @@ -678,7 +678,7 @@ class IMipService { * @return bool */ public function getAttendeeRsvpOrReqForParticipant(?Property $attendee = null) { - if($attendee === null) { + if ($attendee === null) { return false; } @@ -786,10 +786,10 @@ class IMipService { htmlspecialchars($organizer->getNormalizedValue()), htmlspecialchars($organizerName ?: $organizerEmail)); $organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail); - if(isset($organizer['PARTSTAT'])) { + if (isset($organizer['PARTSTAT'])) { /** @var Parameter $partstat */ $partstat = $organizer['PARTSTAT']; - if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) { + if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) { $organizerHTML .= ' ✔︎'; $organizerText .= ' ✔︎'; } @@ -961,7 +961,7 @@ class IMipService { public function isRoomOrResource(Property $attendee): bool { $cuType = $attendee->offsetGet('CUTYPE'); - if(!$cuType instanceof Parameter) { + if (!$cuType instanceof Parameter) { return false; } $type = $cuType->getValue() ?? 'INDIVIDUAL'; diff --git a/apps/dav/lib/CalDAV/Status/StatusService.php b/apps/dav/lib/CalDAV/Status/StatusService.php index 382621f1ba0..56eec5007b8 100644 --- a/apps/dav/lib/CalDAV/Status/StatusService.php +++ b/apps/dav/lib/CalDAV/Status/StatusService.php @@ -39,23 +39,23 @@ class StatusService { public function processCalendarStatus(string $userId): void { $user = $this->userManager->get($userId); - if($user === null) { + if ($user === null) { return; } $availability = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user); - if($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) { + if ($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) { $this->logger->debug('An Absence is in effect, skipping calendar status check', ['user' => $userId]); return; } $calendarEvents = $this->cache->get($userId); - if($calendarEvents === null) { + if ($calendarEvents === null) { $calendarEvents = $this->getCalendarEvents($user); $this->cache->set($userId, $calendarEvents, 300); } - if(empty($calendarEvents)) { + if (empty($calendarEvents)) { try { $this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY); } catch (Exception $e) { @@ -81,7 +81,7 @@ class StatusService { $currentStatus = null; } - if(($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL) + if (($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL) || ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::DND) || ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::INVISIBLE)) { // We don't overwrite the call status, DND status or Invisible status @@ -101,7 +101,7 @@ class StatusService { if (isset($component['DTSTART']) && $userStatusTimestamp !== null) { /** @var DateTimeImmutable $dateTime */ $dateTime = $component['DTSTART'][0]; - if($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) { + if ($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) { return false; } } @@ -112,7 +112,7 @@ class StatusService { return true; }); - if(empty($applicableEvents)) { + if (empty($applicableEvents)) { try { $this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY); } catch (Exception $e) { @@ -130,7 +130,7 @@ class StatusService { } // Only update the status if it's neccesary otherwise we mess up the timestamp - if($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) { + if ($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) { // One event that fulfills all status conditions is enough // 1. Not an OOO event // 2. Current user status (that is not a calendar status) was not set after the start of this event @@ -148,7 +148,7 @@ class StatusService { private function getCalendarEvents(User $user): array { $calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $user->getUID()); - if(empty($calendars)) { + if (empty($calendars)) { return []; } @@ -172,7 +172,7 @@ class StatusService { $dtEnd = DateTimeImmutable::createFromMutable($this->timeFactory->getDateTime('+5 minutes')); // Only query the calendars when there's any to search - if($query instanceof CalendarQuery && !empty($query->getCalendarUris())) { + if ($query instanceof CalendarQuery && !empty($query->getCalendarUris())) { // Query the next hour $query->setTimerangeStart($dtStart); $query->setTimerangeEnd($dtEnd); diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index 1f2c006cdfe..47fd785d632 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -44,12 +44,12 @@ class RefreshWebcalService { } // Check the refresh rate if there is any - if(!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) { + if (!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) { // add the refresh interval to the lastmodified timestamp $refreshInterval = new \DateInterval($subscription['{http://apple.com/ns/ical/}refreshrate']); $updateTime = $this->time->getDateTime(); $updateTime->setTimestamp($subscription['lastmodified'])->add($refreshInterval); - if($updateTime->getTimestamp() > $this->time->getTime()) { + if ($updateTime->getTimestamp() > $this->time->getTime()) { return; } } @@ -136,7 +136,7 @@ class RefreshWebcalService { return $dataSet['uri']; }, $localData); - if(!empty($ids) && !empty($uris)) { + if (!empty($ids) && !empty($uris)) { // Clean up on aisle 5 // The only events left over in the $localData array should be those that don't exist upstream // All deleted VObjects from upstream are removed diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 2e1a84b6bc8..3dac1cf18be 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -58,7 +58,7 @@ abstract class Backend { } // Don't add share for owner - if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { + if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { continue; } @@ -83,7 +83,7 @@ abstract class Backend { } // Don't add unshare for owner - if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { + if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { continue; } @@ -92,7 +92,7 @@ abstract class Backend { // Check if a user has a groupshare that they're trying to free themselves from // If so we need to add a self::ACCESS_UNSHARED row - if(!str_contains($principal, 'group') + if (!str_contains($principal, 'group') && $this->service->hasGroupShare($oldShares) ) { $this->service->unshare($shareable->getResourceId(), $principal); @@ -130,7 +130,7 @@ abstract class Backend { $rows = $this->service->getShares($resourceId); $shares = []; - foreach($rows as $row) { + foreach ($rows as $row) { $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $shares[] = [ 'href' => "principal:{$row['principaluri']}", @@ -155,7 +155,7 @@ abstract class Backend { $rows = $this->service->getSharesForIds($resourceIds); $sharesByResource = array_fill_keys($resourceIds, []); - foreach($rows as $row) { + foreach ($rows as $row) { $resourceId = (int)$row['resourceid']; $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $sharesByResource[$resourceId][] = [ diff --git a/apps/dav/lib/Migration/Version1027Date20230504122946.php b/apps/dav/lib/Migration/Version1027Date20230504122946.php index 7b49c64453e..9e1d1701934 100644 --- a/apps/dav/lib/Migration/Version1027Date20230504122946.php +++ b/apps/dav/lib/Migration/Version1027Date20230504122946.php @@ -31,7 +31,7 @@ class Version1027Date20230504122946 extends SimpleMigrationStep { * @param array $options */ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { - if($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) { + if ($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) { $this->config->setAppValue('dav', 'needs_system_address_book_sync', 'yes'); $output->info('Could not sync system address books during update - too many user records have been found. Please call occ dav:sync-system-addressbook manually.'); return; diff --git a/apps/dav/lib/Migration/Version1029Date20221114151721.php b/apps/dav/lib/Migration/Version1029Date20221114151721.php index 05b04486c88..dba5e0b1a48 100644 --- a/apps/dav/lib/Migration/Version1029Date20221114151721.php +++ b/apps/dav/lib/Migration/Version1029Date20221114151721.php @@ -28,7 +28,7 @@ class Version1029Date20221114151721 extends SimpleMigrationStep { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); $calendarObjectsTable = $schema->getTable('calendarobjects'); - if(!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) { + if (!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) { $calendarObjectsTable->addIndex(['classification'], 'calobj_clssfction_index'); return $schema; } diff --git a/apps/files/lib/Command/Delete.php b/apps/files/lib/Command/Delete.php index f59b636079b..d984f839c91 100644 --- a/apps/files/lib/Command/Delete.php +++ b/apps/files/lib/Command/Delete.php @@ -70,7 +70,7 @@ class Delete extends Command { $output->writeln(''); foreach ($filesByUsers as $user => $filesByUser) { $output->writeln($user . ':'); - foreach($filesByUser as $file) { + foreach ($filesByUser as $file) { $output->writeln(' - ' . $file->getPath()); } } diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index e3d4c0a6aa0..c402a4c5bed 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -166,7 +166,7 @@ class ViewController extends Controller { try { // If view is files, we use the directory, otherwise we use the root storage $storageInfo = $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/'); - } catch(\Exception $e) { + } catch (\Exception $e) { $storageInfo = $this->getStorageInfo(); } diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index 1040158cf19..437ef9a1cdf 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -75,7 +75,7 @@ class SmbTest extends \Test\Files\Storage\Storage { public function testNotifyGetChanges() { $lastError = null; - for($i = 0; $i < 5; $i++) { + for ($i = 0; $i < 5; $i++) { try { $this->tryTestNotifyGetChanges(); return; diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 6808cf48ce1..ea2bb3fa668 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -2108,7 +2108,7 @@ class ShareAPIController extends OCSController { $provider->sendMailNotification($share); return new DataResponse(); - } catch(OCSBadRequestException $e) { + } catch (OCSBadRequestException $e) { throw $e; } catch (Exception $e) { throw new OCSException($this->l->t('Error while sending mail notification')); diff --git a/apps/files_trashbin/lib/Command/RestoreAllFiles.php b/apps/files_trashbin/lib/Command/RestoreAllFiles.php index cd86ede93cb..969791379c1 100644 --- a/apps/files_trashbin/lib/Command/RestoreAllFiles.php +++ b/apps/files_trashbin/lib/Command/RestoreAllFiles.php @@ -173,7 +173,7 @@ class RestoreAllFiles extends Base { $prepMsg = $dryRun ? 'Would restore' : 'Preparing to restore'; $output->writeln("$prepMsg <info>$trashCount</info> files..."); $count = 0; - foreach($userTrashItems as $trashItem) { + foreach ($userTrashItems as $trashItem) { $filename = $trashItem->getName(); $humanTime = $this->l10n->l('datetime', $trashItem->getDeletedTime()); // We use getTitle() here instead of getOriginalLocation() because diff --git a/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php b/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php index 222e49e9712..db9a43be6fc 100644 --- a/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php +++ b/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php @@ -112,7 +112,7 @@ class SyncLivePhotosListener implements IEventListener { * TODO: This should be replaced by a proper method in the TrashManager. */ private function getTrashItem(array $trashFolder, string $path): ?ITrashItem { - foreach($trashFolder as $trashItem) { + foreach ($trashFolder as $trashItem) { if (str_starts_with($path, 'files_trashbin/files'.$trashItem->getTrashPath())) { if ($path === 'files_trashbin/files'.$trashItem->getTrashPath()) { return $trashItem; diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php index 31945e3830b..4092acecab8 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -141,7 +141,7 @@ class ArtificialIntelligence implements IDelegatedSettings { $json = $this->config->getAppValue('core', $key, ''); if ($json !== '') { $value = json_decode($json, true); - switch($key) { + switch ($key) { case 'ai.taskprocessing_provider_preferences': case 'ai.textprocessing_provider_preferences': // fill $value with $defaultValue values diff --git a/apps/theming/lib/Service/ThemeInjectionService.php b/apps/theming/lib/Service/ThemeInjectionService.php index f65dde076bc..3c7bf1ce544 100644 --- a/apps/theming/lib/Service/ThemeInjectionService.php +++ b/apps/theming/lib/Service/ThemeInjectionService.php @@ -52,12 +52,12 @@ class ThemeInjectionService { $this->addThemeHeaders($defaultTheme); // Themes applied by media queries - foreach($mediaThemes as $theme) { + foreach ($mediaThemes as $theme) { $this->addThemeHeaders($theme, true, $theme->getMediaQuery()); } // Themes - foreach($this->themesService->getThemes() as $theme) { + foreach ($this->themesService->getThemes() as $theme) { // Ignore default theme as already processed first if ($theme->getId() === $this->defaultTheme->getId()) { continue; @@ -99,9 +99,9 @@ class ThemeInjectionService { $metaHeaders = []; // Meta headers - foreach($this->themesService->getThemes() as $theme) { + foreach ($this->themesService->getThemes() as $theme) { if (!empty($theme->getMeta())) { - foreach($theme->getMeta() as $meta) { + foreach ($theme->getMeta() as $meta) { if (!isset($meta['name']) || !isset($meta['content'])) { continue; } @@ -114,7 +114,7 @@ class ThemeInjectionService { } } - foreach($metaHeaders as $name => $content) { + foreach ($metaHeaders as $name => $content) { \OCP\Util::addHeader('meta', [ 'name' => $name, 'content' => join(' ', array_unique($content)), diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index d0ec1e447cc..54dba6d858a 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -397,8 +397,7 @@ class Connection extends LDAPUtility { } foreach (['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', - 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] - as $expertSetting => $effectiveSetting) { + 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) { $uuidOverride = $this->configuration->$expertSetting; if (!empty($uuidOverride)) { $this->configuration->$effectiveSetting = $uuidOverride; diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index 048dba732d5..dcf2e6f62e1 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -293,7 +293,7 @@ class LDAP implements ILDAPWrapper { private function preFunctionCall(string $functionName, array $args): void { $this->curArgs = $args; - if(strcasecmp($functionName, 'ldap_bind') === 0 || strcasecmp($functionName, 'ldap_exop_passwd') === 0) { + if (strcasecmp($functionName, 'ldap_bind') === 0 || strcasecmp($functionName, 'ldap_exop_passwd') === 0) { // The arguments are not key value pairs // \OCA\User_LDAP\LDAP::bind passes 3 arguments, the 3rd being the pw // Remove it via direct array access for now, although a better solution could be found mebbe? diff --git a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php index 7fe08e9719b..23dec452928 100644 --- a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php +++ b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php @@ -37,7 +37,7 @@ class OutOfOfficeStatusListener implements IEventListener { * @inheritDoc */ public function handle(Event $event): void { - if($event instanceof OutOfOfficeClearedEvent) { + if ($event instanceof OutOfOfficeClearedEvent) { $this->manager->revertUserStatus($event->getData()->getUser()->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); $this->jobsList->scheduleAfter(UserStatusAutomation::class, $this->time->getTime(), ['userId' => $event->getData()->getUser()->getUID()]); return; diff --git a/apps/user_status/lib/Listener/UserLiveStatusListener.php b/apps/user_status/lib/Listener/UserLiveStatusListener.php index fa4ff8e4aba..ea8d995b8a3 100644 --- a/apps/user_status/lib/Listener/UserLiveStatusListener.php +++ b/apps/user_status/lib/Listener/UserLiveStatusListener.php @@ -72,7 +72,7 @@ class UserLiveStatusListener implements IEventListener { } // Don't overwrite the "away" calendar status if it's set - if($userStatus->getMessageId() === IUserStatus::MESSAGE_CALENDAR_BUSY) { + if ($userStatus->getMessageId() === IUserStatus::MESSAGE_CALENDAR_BUSY) { $event->setUserStatus(new ConnectorUserStatus($userStatus)); return; } diff --git a/apps/user_status/lib/Service/StatusService.php b/apps/user_status/lib/Service/StatusService.php index 2a761a0f304..9adc13e4dbf 100644 --- a/apps/user_status/lib/Service/StatusService.php +++ b/apps/user_status/lib/Service/StatusService.php @@ -499,10 +499,10 @@ class StatusService { return; } // If there is a custom message, don't overwrite it - if(empty($status->getCustomMessage())) { + if (empty($status->getCustomMessage())) { $status->setCustomMessage($predefinedMessage['message']); } - if(empty($status->getCustomIcon())) { + if (empty($status->getCustomIcon())) { $status->setCustomIcon($predefinedMessage['icon']); } } diff --git a/apps/webhook_listeners/lib/Service/PHPMongoQuery.php b/apps/webhook_listeners/lib/Service/PHPMongoQuery.php index 451488ea22b..43429ce9393 100644 --- a/apps/webhook_listeners/lib/Service/PHPMongoQuery.php +++ b/apps/webhook_listeners/lib/Service/PHPMongoQuery.php @@ -28,14 +28,14 @@ abstract class PHPMongoQuery { * @throws Exception */ public static function find(array $query, array $documents, array $options = []): array { - if(empty($documents) || empty($query)) { + if (empty($documents) || empty($query)) { return []; } $ret = []; $options['_shouldLog'] = !empty($options['logger']) && $options['logger'] instanceof \Psr\Log\LoggerInterface; $options['_debug'] = !empty($options['debug']); foreach ($documents as $doc) { - if(static::_executeQuery($query, $doc, $options)) { + if (static::_executeQuery($query, $doc, $options)) { $ret[] = $doc; } } @@ -56,11 +56,11 @@ abstract class PHPMongoQuery { public static function executeQuery($query, array &$document, array $options = []): bool { $options['_shouldLog'] = !empty($options['logger']) && $options['logger'] instanceof \Psr\Log\LoggerInterface; $options['_debug'] = !empty($options['debug']); - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('executeQuery called', ['query' => $query, 'document' => $document, 'options' => $options]); } - if(!is_array($query)) { + if (!is_array($query)) { return (bool)$query; } @@ -75,10 +75,10 @@ abstract class PHPMongoQuery { * @throws Exception */ private static function _executeQuery(array $query, array &$document, array $options = [], string $logicalOperator = '$and'): bool { - if($logicalOperator !== '$and' && (!count($query) || !isset($query[0]))) { + if ($logicalOperator !== '$and' && (!count($query) || !isset($query[0]))) { throw new Exception($logicalOperator.' requires nonempty array'); } - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('_executeQuery called', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]); } @@ -87,19 +87,19 @@ abstract class PHPMongoQuery { // to detect an array of key->vals that have numeric IDs vs an array of queries (where keys were not specified) $queryIsIndexedArray = !empty($query) && array_is_list($query); - foreach($query as $k => $q) { + foreach ($query as $k => $q) { $pass = true; - if(is_string($k) && substr($k, 0, 1) === '$') { + if (is_string($k) && substr($k, 0, 1) === '$') { // key is an operator at this level, except $not, which can be at any level - if($k === '$not') { + if ($k === '$not') { $pass = !self::_executeQuery($q, $document, $options); } else { $pass = self::_executeQuery($q, $document, $options, $k); } - } elseif($logicalOperator === '$and') { // special case for $and - if($queryIsIndexedArray) { // $q is an array of query objects + } elseif ($logicalOperator === '$and') { // special case for $and + if ($queryIsIndexedArray) { // $q is an array of query objects $pass = self::_executeQuery($q, $document, $options); - } elseif(is_array($q)) { // query is array, run all queries on field. All queries must match. e.g { 'age': { $gt: 24, $lt: 52 } } + } elseif (is_array($q)) { // query is array, run all queries on field. All queries must match. e.g { 'age': { $gt: 24, $lt: 52 } } $pass = self::_executeQueryOnElement($q, $k, $document, $options); } else { // key value means equality @@ -108,30 +108,30 @@ abstract class PHPMongoQuery { } else { // $q is array of query objects e.g '$or' => [{'fullName' => 'Nick'}] $pass = self::_executeQuery($q, $document, $options, '$and'); } - switch($logicalOperator) { + switch ($logicalOperator) { case '$and': // if any fail, query fails - if(!$pass) { + if (!$pass) { return false; } break; case '$or': // if one succeeds, query succeeds - if($pass) { + if ($pass) { return true; } break; case '$nor': // if one succeeds, query fails - if($pass) { + if ($pass) { return false; } break; default: - if($options['_shouldLog']) { + if ($options['_shouldLog']) { $options['logger']->warning('_executeQuery could not find logical operator', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]); } return false; } } - switch($logicalOperator) { + switch ($logicalOperator) { case '$and': // all succeeded, query succeeds return true; case '$or': // all failed, query fails @@ -139,7 +139,7 @@ abstract class PHPMongoQuery { case '$nor': // all failed, query succeeded return true; default: - if($options['_shouldLog']) { + if ($options['_shouldLog']) { $options['logger']->warning('_executeQuery could not find logical operator', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]); } return false; @@ -152,12 +152,12 @@ abstract class PHPMongoQuery { * @throws Exception */ private static function _executeQueryOnElement(array $query, string $element, array &$document, array $options = []): bool { - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('_executeQueryOnElement called', ['query' => $query, 'element' => $element, 'document' => $document]); } // iterate through query operators - foreach($query as $op => $opVal) { - if(!self::_executeOperatorOnElement($op, $opVal, $element, $document, $options)) { + foreach ($query as $op => $opVal) { + if (!self::_executeOperatorOnElement($op, $opVal, $element, $document, $options)) { return false; } } @@ -176,10 +176,10 @@ abstract class PHPMongoQuery { if (is_array($v) && is_array($operatorValue)) { return $v == $operatorValue; } - if(is_array($v)) { + if (is_array($v)) { return in_array($operatorValue, $v); } - if(is_string($operatorValue) && preg_match('/^\/(.*?)\/([a-z]*)$/i', $operatorValue, $matches)) { + if (is_string($operatorValue) && preg_match('/^\/(.*?)\/([a-z]*)$/i', $operatorValue, $matches)) { return (bool)preg_match('/'.$matches[1].'/'.$matches[2], $v); } return $operatorValue === $v; @@ -196,34 +196,34 @@ abstract class PHPMongoQuery { * @throws Exception Exceptions on invalid operators, invalid unknown operator callback, and invalid operator values */ private static function _executeOperatorOnElement(string $operator, $operatorValue, string $element, array &$document, array $options = []): bool { - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('_executeOperatorOnElement called', ['operator' => $operator, 'operatorValue' => $operatorValue, 'element' => $element, 'document' => $document]); } - if($operator === '$not') { + if ($operator === '$not') { return !self::_executeQueryOnElement($operatorValue, $element, $document, $options); } $elementSpecifier = explode('.', $element); $v = & $document; $exists = true; - foreach($elementSpecifier as $index => $es) { - if(empty($v)) { + foreach ($elementSpecifier as $index => $es) { + if (empty($v)) { $exists = false; break; } - if(isset($v[0])) { + if (isset($v[0])) { // value from document is an array, so we need to iterate through array and test the query on all elements of the array // if any elements match, then return true $newSpecifier = implode('.', array_slice($elementSpecifier, $index)); - foreach($v as $item) { - if(self::_executeOperatorOnElement($operator, $operatorValue, $newSpecifier, $item, $options)) { + foreach ($v as $item) { + if (self::_executeOperatorOnElement($operator, $operatorValue, $newSpecifier, $item, $options)) { return true; } } return false; } - if(isset($v[$es])) { + if (isset($v[$es])) { $v = & $v[$es]; } else { $exists = false; @@ -231,40 +231,40 @@ abstract class PHPMongoQuery { } } - switch($operator) { + switch ($operator) { case '$all': - if(!$exists) { + if (!$exists) { return false; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$all requires array'); } - if(count($operatorValue) === 0) { + if (count($operatorValue) === 0) { return false; } - if(!is_array($v)) { - if(count($operatorValue) === 1) { + if (!is_array($v)) { + if (count($operatorValue) === 1) { return $v === $operatorValue[0]; } return false; } return count(array_intersect($v, $operatorValue)) === count($operatorValue); case '$e': - if(!$exists) { + if (!$exists) { return false; } return self::_isEqual($v, $operatorValue); case '$in': - if(!$exists) { + if (!$exists) { return false; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$in requires array'); } - if(count($operatorValue) === 0) { + if (count($operatorValue) === 0) { return false; } - if(is_array($v)) { + if (is_array($v)) { return count(array_intersect($v, $operatorValue)) > 0; } return in_array($v, $operatorValue); @@ -274,43 +274,43 @@ abstract class PHPMongoQuery { case '$gte': return $exists && $v >= $operatorValue; case '$ne': return (!$exists && $operatorValue !== null) || ($exists && !self::_isEqual($v, $operatorValue)); case '$nin': - if(!$exists) { + if (!$exists) { return true; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$nin requires array'); } - if(count($operatorValue) === 0) { + if (count($operatorValue) === 0) { return true; } - if(is_array($v)) { + if (is_array($v)) { return count(array_intersect($v, $operatorValue)) === 0; } return !in_array($v, $operatorValue); case '$exists': return ($operatorValue && $exists) || (!$operatorValue && !$exists); case '$mod': - if(!$exists) { + if (!$exists) { return false; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$mod requires array'); } - if(count($operatorValue) !== 2) { + if (count($operatorValue) !== 2) { throw new Exception('$mod requires two parameters in array: divisor and remainder'); } return $v % $operatorValue[0] === $operatorValue[1]; default: - if(empty($options['unknownOperatorCallback']) || !is_callable($options['unknownOperatorCallback'])) { + if (empty($options['unknownOperatorCallback']) || !is_callable($options['unknownOperatorCallback'])) { throw new Exception('Operator '.$operator.' is unknown'); } $res = call_user_func($options['unknownOperatorCallback'], $operator, $operatorValue, $element, $document); - if($res === null) { + if ($res === null) { throw new Exception('Operator '.$operator.' is unknown'); } - if(!is_bool($res)) { + if (!is_bool($res)) { throw new Exception('Return value of unknownOperatorCallback must be boolean, actual value '.$res); } return $res; @@ -326,11 +326,11 @@ abstract class PHPMongoQuery { */ public static function getDependentFields(array $query) { $fields = []; - foreach($query as $k => $v) { - if(is_array($v)) { + foreach ($query as $k => $v) { + if (is_array($v)) { $fields = array_merge($fields, static::getDependentFields($v)); } - if(is_int($k) || $k[0] === '$') { + if (is_int($k) || $k[0] === '$') { continue; } $fields[] = $k; diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 9862982931f..a58a1b4fda3 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -303,7 +303,7 @@ trait Sharing { public function isFieldInResponse($field, $contentExpected) { $data = simplexml_load_string($this->response->getBody())->data[0]; if ((string)$field == 'expiration') { - if(!empty($contentExpected)) { + if (!empty($contentExpected)) { $contentExpected = date('Y-m-d', strtotime($contentExpected)) . ' 00:00:00'; } } diff --git a/core/Command/Db/Migrations/PreviewCommand.php b/core/Command/Db/Migrations/PreviewCommand.php index b15f89765b9..f5b850fff76 100644 --- a/core/Command/Db/Migrations/PreviewCommand.php +++ b/core/Command/Db/Migrations/PreviewCommand.php @@ -94,12 +94,12 @@ class PreviewCommand extends Command { )->addRow(new TableSeparator()); /** @var MigrationAttribute[] $attributes */ - foreach($data as $migration => $attributes) { + foreach ($data as $migration => $attributes) { $attributesStr = []; if (empty($attributes)) { $attributesStr[] = '<comment>(metadata not set)</comment>'; } - foreach($attributes as $attribute) { + foreach ($attributes as $attribute) { $definition = '<info>' . $attribute->definition() . '</info>'; $definition .= empty($attribute->getDescription()) ? '' : "\n " . $attribute->getDescription(); $definition .= empty($attribute->getNotes()) ? '' : "\n <comment>" . implode("</comment>\n <comment>", $attribute->getNotes()) . '</comment>'; diff --git a/core/Controller/TextProcessingApiController.php b/core/Controller/TextProcessingApiController.php index 82cd088d29d..e62389dee11 100644 --- a/core/Controller/TextProcessingApiController.php +++ b/core/Controller/TextProcessingApiController.php @@ -109,7 +109,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController { try { try { $this->textProcessingManager->runOrScheduleTask($task); - } catch(TaskFailureException) { + } catch (TaskFailureException) { // noop, because the task object has the failure status set already, we just return the task json } diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index c8528c19cc2..241c752ea01 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -150,7 +150,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController { $task = $this->textToImageManager->getUserTask($id, $this->userId); try { $folder = $this->appData->getFolder('text2image'); - } catch(NotFoundException) { + } catch (NotFoundException) { $res = new DataResponse(['message' => $this->l->t('Image not found')], Http::STATUS_NOT_FOUND); $res->throttle(['action' => 'text2image']); return $res; diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index c27150a67dc..f6361ff2ac6 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -1378,7 +1378,7 @@ class AppConfig implements IAppConfig { * @return array<string, string|int|float|bool|array> */ private function formatAppValues(string $app, array $values, ?bool $lazy = null): array { - foreach($values as $key => $value) { + foreach ($values as $key => $value) { try { $type = $this->getValueType($app, $key, $lazy); } catch (AppConfigUnknownKeyException $e) { diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 9237c884691..8b7f43c03a2 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -132,7 +132,7 @@ class Manager implements ICommentsManager { try { $comment->getCreationDateTime(); - } catch(\LogicException $e) { + } catch (\LogicException $e) { $comment->setCreationDateTime(new \DateTime()); } diff --git a/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php b/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php index d40934669d7..c3ce28376e3 100644 --- a/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php +++ b/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php @@ -34,7 +34,7 @@ class AutoIncrementHandler { } private function getCache(): IMemcache { - if(is_null($this->cache)) { + if (is_null($this->cache)) { $cache = $this->cacheFactory->createDistributed('shared_autoincrement'); if ($cache instanceof IMemcache) { $this->cache = $cache; @@ -118,7 +118,7 @@ class AutoIncrementHandler { $next = $cache->inc($shardDefinition->table); if (is_int($next) && $next >= self::MIN_VALID_KEY) { return $next; - } elseif(is_int($next)) { + } elseif (is_int($next)) { // key got cleared, invalidate and retry $cache->cas($shardDefinition->table, $next, 'empty-placeholder'); return null; diff --git a/lib/private/Files/Cache/SearchBuilder.php b/lib/private/Files/Cache/SearchBuilder.php index 32502cb8258..748844b9e1b 100644 --- a/lib/private/Files/Cache/SearchBuilder.php +++ b/lib/private/Files/Cache/SearchBuilder.php @@ -290,7 +290,7 @@ class SearchBuilder { $value = $operator->getValue(); $type = $operator->getType(); - switch($operator->getExtra()) { + switch ($operator->getExtra()) { case IMetadataQuery::EXTRA: $metadataQuery->joinIndex($field); // join index table if not joined yet $field = $metadataQuery->getMetadataValueField($field); diff --git a/lib/private/Migration/MetadataManager.php b/lib/private/Migration/MetadataManager.php index 324c169c626..cdaa604ce5a 100644 --- a/lib/private/Migration/MetadataManager.php +++ b/lib/private/Migration/MetadataManager.php @@ -43,7 +43,7 @@ class MetadataManager { $ms = new MigrationService($appId, $this->connection); $metadata = []; - foreach($ms->getAvailableVersions() as $version) { + foreach ($ms->getAvailableVersions() as $version) { $metadata[$version] = []; $class = new ReflectionClass($ms->createInstance($version)); $attributes = $class->getAttributes(); diff --git a/lib/private/Search/SearchQuery.php b/lib/private/Search/SearchQuery.php index a78443922ae..791edb7a0f7 100644 --- a/lib/private/Search/SearchQuery.php +++ b/lib/private/Search/SearchQuery.php @@ -25,7 +25,7 @@ class SearchQuery implements ISearchQuery { private int $limit = self::LIMIT_DEFAULT, private int|string|null $cursor = null, private string $route = '', - private array $routeParameters = [], + private array $routeParameters = [], ) { } diff --git a/lib/private/Security/Ip/Address.php b/lib/private/Security/Ip/Address.php index b4f12a7e295..1df94e0a9c7 100644 --- a/lib/private/Security/Ip/Address.php +++ b/lib/private/Security/Ip/Address.php @@ -33,7 +33,7 @@ class Address implements IAddress { } public function matches(IRange... $ranges): bool { - foreach($ranges as $range) { + foreach ($ranges as $range) { if ($range->contains($this)) { return true; } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 391b77171a9..bb34468db6e 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -275,7 +275,7 @@ class Manager implements IManager { // If $expirationDate is falsy, noExpirationDate is true and expiration not enforced // Then skip expiration date validation as null is accepted - if(!$share->getNoExpirationDate() || $isEnforced) { + if (!$share->getNoExpirationDate() || $isEnforced) { if ($expirationDate !== null) { $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); @@ -353,7 +353,7 @@ class Manager implements IManager { // If $expirationDate is falsy, noExpirationDate is true and expiration not enforced // Then skip expiration date validation as null is accepted - if(!($share->getNoExpirationDate() && !$isEnforced)) { + if (!($share->getNoExpirationDate() && !$isEnforced)) { if ($expirationDate !== null) { $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index fb0a4da4c4e..1b170a03ec2 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -175,7 +175,7 @@ class Manager implements IManager { } try { return ['output' => $this->provider->process($input['input'])]; - } catch(\RuntimeException $e) { + } catch (\RuntimeException $e) { throw new ProcessingException($e->getMessage(), 0, $e); } } @@ -306,7 +306,7 @@ class Manager implements IManager { public function process(?string $userId, array $input, callable $reportProgress): array { try { $folder = $this->appData->getFolder('text2image'); - } catch(\OCP\Files\NotFoundException) { + } catch (\OCP\Files\NotFoundException) { $folder = $this->appData->newFolder('text2image'); } $resources = []; @@ -994,7 +994,7 @@ class Manager implements IManager { } $newInputOutput = []; $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); - foreach($spec as $key => $descriptor) { + foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($input[$key])) { continue; @@ -1086,7 +1086,7 @@ class Manager implements IManager { $folder = $this->appData->newFolder('TaskProcessing'); } $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); - foreach($spec as $key => $descriptor) { + foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($output[$key])) { continue; @@ -1231,7 +1231,7 @@ class Manager implements IManager { private function validateOutputFileIds(array $output, ...$specs): array { $newOutput = []; $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); - foreach($spec as $key => $descriptor) { + foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($output[$key])) { continue; diff --git a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php index 823ea09a622..acec2f46c05 100644 --- a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php @@ -65,7 +65,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { * @return void */ private function clearFilesOlderThan(ISimpleFolder $folder, int $ageInSeconds): void { - foreach($folder->getDirectoryListing() as $file) { + foreach ($folder->getDirectoryListing() as $file) { if ($file->getMTime() < time() - $ageInSeconds) { try { $file->delete(); diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 55fb348f01b..a4984eaf930 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -281,7 +281,7 @@ class JSConfigHelper { $result = ''; // Echo it - foreach ($array as $setting => $value) { + foreach ($array as $setting => $value) { $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; } diff --git a/lib/private/TextToImage/Manager.php b/lib/private/TextToImage/Manager.php index 2d6cc6450a1..88dc108f380 100644 --- a/lib/private/TextToImage/Manager.php +++ b/lib/private/TextToImage/Manager.php @@ -119,13 +119,13 @@ class Manager implements IManager { } try { $folder = $this->appData->getFolder('text2image'); - } catch(NotFoundException) { + } catch (NotFoundException) { $this->logger->debug('Creating folder in appdata for Text2Image results'); $folder = $this->appData->newFolder('text2image'); } try { $folder = $folder->getFolder((string)$task->getId()); - } catch(NotFoundException) { + } catch (NotFoundException) { $this->logger->debug('Creating new folder in appdata Text2Image results folder'); $folder = $folder->newFolder((string)$task->getId()); } @@ -162,7 +162,7 @@ class Manager implements IManager { if (isset($files, $files[$i])) { try { $files[$i]->delete(); - } catch(NotPermittedException $e) { + } catch (NotPermittedException $e) { $this->logger->warning('Failed to clean up Text2Image result file after error', ['exception' => $e]); } } diff --git a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php index 525d68df22b..7d9170090b7 100644 --- a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php @@ -55,7 +55,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { } } catch (Exception $e) { $this->logger->warning('Failed to delete stale text to image tasks', ['exception' => $e]); - } catch(NotFoundException) { + } catch (NotFoundException) { // noop } } diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 96be58a84a2..9a84b102a99 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -751,7 +751,7 @@ class Manager extends PublicEmitter implements IUserManager { $queryBuilder->expr()->eq('p.appid', $queryBuilder->expr()->literal('login')), $queryBuilder->expr()->eq('p.configkey', $queryBuilder->expr()->literal('lastLogin'))) ); - if($search !== '') { + if ($search !== '') { $queryBuilder->leftJoin('u', 'preferences', 'p1', $queryBuilder->expr()->andX( $queryBuilder->expr()->eq('p1.userid', 'uid'), $queryBuilder->expr()->eq('p1.appid', $queryBuilder->expr()->literal('settings')), diff --git a/tests/lib/Files/Search/SearchIntegrationTest.php b/tests/lib/Files/Search/SearchIntegrationTest.php index 141eaca238c..c1017537a0c 100644 --- a/tests/lib/Files/Search/SearchIntegrationTest.php +++ b/tests/lib/Files/Search/SearchIntegrationTest.php @@ -33,7 +33,7 @@ class SearchIntegrationTest extends TestCase { $id = $this->cache->put('file10', ['size' => 1, 'mtime' => 50, 'mimetype' => 'foo/folder']); $comparisons = []; - for($i = 1; $i <= 1001; $i++) { + for ($i = 1; $i <= 1001; $i++) { $comparisons[] = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', "file$i"); } $operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, $comparisons); diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 0fb281a0533..624f09ae2d8 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -351,7 +351,7 @@ class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider { public function generate(string $prompt, array $resources): void { $this->ran = true; - foreach($resources as $resource) { + foreach ($resources as $resource) { fwrite($resource, 'test'); } } |