diff options
Diffstat (limited to 'apps/dav')
135 files changed, 558 insertions, 558 deletions
diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index d908cd3ae82..c214f8950cb 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -53,8 +53,8 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { } public function run($argument) { - $offset = (int) $argument['offset']; - $stopAt = (int) $argument['stopAt']; + $offset = (int)$argument['offset']; + $stopAt = (int)$argument['stopAt']; $this->logger->info('Building calendar reminder index (' . $offset .'/' . $stopAt . ')'); @@ -88,7 +88,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { $result = $query->executeQuery(); while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { - $offset = (int) $row['id']; + $offset = (int)$row['id']; if (is_resource($row['calendardata'])) { $row['calendardata'] = stream_get_contents($row['calendardata']); } diff --git a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php index 1479cd363b3..6fe10c576bb 100644 --- a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php @@ -14,7 +14,7 @@ use OCP\IDBConnection; class CleanupInvitationTokenJob extends TimedJob { - /** @var IDBConnection */ + /** @var IDBConnection */ private $db; public function __construct(IDBConnection $db, ITimeFactory $time) { diff --git a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php index fa53a8be4f0..bc306d58fe1 100644 --- a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php +++ b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php @@ -30,6 +30,6 @@ class DeleteOutdatedSchedulingObjects extends TimedJob { protected function run($argument): void { $time = $this->time->getTime() - (60 * 60); $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000); - $this->logger->info("Removed outdated scheduling objects"); + $this->logger->info('Removed outdated scheduling objects'); } } diff --git a/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php b/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php index 8293b370996..cc4fd5dce9d 100644 --- a/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php +++ b/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php @@ -41,7 +41,7 @@ class OutOfOfficeEventDispatcherJob extends QueuedJob { try { $absence = $this->absenceMapper->findById($id); - } catch (DoesNotExistException | \OCP\DB\Exception $e) { + } catch (DoesNotExistException|\OCP\DB\Exception $e) { $this->logger->error('Failed to dispatch out-of-office event: ' . $e->getMessage(), [ 'exception' => $e, 'argument' => $argument, diff --git a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php index 1ef33410f4f..15fe439beef 100644 --- a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php +++ b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php @@ -34,8 +34,8 @@ class PruneOutdatedSyncTokensJob extends TimedJob { } public function run($argument) { - $limit = max(1, (int) $this->config->getAppValue(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000')); - $retention = max(7, (int) $this->config->getAppValue(Application::APP_ID, 'syncTokensRetentionDays', '60')) * 24 * 3600; + $limit = max(1, (int)$this->config->getAppValue(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000')); + $retention = max(7, (int)$this->config->getAppValue(Application::APP_ID, 'syncTokensRetentionDays', '60')) * 24 * 3600; $prunedCalendarSyncTokens = $this->calDavBackend->pruneOutdatedSyncTokens($limit, $retention); $prunedAddressBookSyncTokens = $this->cardDavBackend->pruneOutdatedSyncTokens($limit, $retention); diff --git a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php index 982d6040fd7..f9d6de9db59 100644 --- a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php +++ b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php @@ -104,7 +104,7 @@ class RefreshWebcalJob extends Job { foreach ($forceInt as $column) { if (isset($row[$column])) { - $row[$column] = (int) $row[$column]; + $row[$column] = (int)$row[$column]; } } } diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index 59a28626ecd..6d5eca6920c 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -45,7 +45,7 @@ class UploadCleanup extends TimedJob { /** @var Folder $uploads */ $uploads = $userRoot->get('uploads'); $uploadFolder = $uploads->get($folder); - } catch (NotFoundException | NoUserException $e) { + } catch (NotFoundException|NoUserException $e) { $this->jobList->remove(self::class, $argument); return; } @@ -54,7 +54,7 @@ class UploadCleanup extends TimedJob { $time = $this->time->getTime() - 60 * 60 * 24; if (!($uploadFolder instanceof Folder)) { - $this->logger->error("Found a file inside the uploads folder. Uid: " . $uid . ' folder: ' . $folder); + $this->logger->error('Found a file inside the uploads folder. Uid: ' . $uid . ' folder: ' . $folder); if ($uploadFolder->getMTime() < $time) { $uploadFolder->delete(); } diff --git a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php index ae7f55d7107..8a99beaec6a 100644 --- a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php +++ b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php @@ -44,7 +44,7 @@ class BulkUploadPlugin extends ServerPlugin { */ public function httpPost(RequestInterface $request, ResponseInterface $response): bool { // Limit bulk upload to the /dav/bulk endpoint - if ($request->getPath() !== "bulk") { + if ($request->getPath() !== 'bulk') { return true; } @@ -77,16 +77,16 @@ class BulkUploadPlugin extends ServerPlugin { $node = $this->userFolder->getFirstNodeById($node->getId()); $writtenFiles[$headers['x-file-path']] = [ - "error" => false, - "etag" => $node->getETag(), - "fileid" => DavUtil::getDavFileId($node->getId()), - "permissions" => DavUtil::getDavPermissions($node), + 'error' => false, + 'etag' => $node->getETag(), + 'fileid' => DavUtil::getDavFileId($node->getId()), + 'permissions' => DavUtil::getDavPermissions($node), ]; } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['path' => $headers['x-file-path']]); $writtenFiles[$headers['x-file-path']] = [ - "error" => true, - "message" => $e->getMessage(), + 'error' => true, + 'message' => $e->getMessage(), ]; } } diff --git a/apps/dav/lib/BulkUpload/MultipartRequestParser.php b/apps/dav/lib/BulkUpload/MultipartRequestParser.php index 2d3cf7d421c..b6c4fbcc1be 100644 --- a/apps/dav/lib/BulkUpload/MultipartRequestParser.php +++ b/apps/dav/lib/BulkUpload/MultipartRequestParser.php @@ -19,10 +19,10 @@ class MultipartRequestParser { private $stream; /** @var string */ - private $boundary = ""; + private $boundary = ''; /** @var string */ - private $lastBoundary = ""; + private $lastBoundary = ''; /** * @throws BadRequest @@ -39,7 +39,7 @@ class MultipartRequestParser { } if ($contentType === null) { - throw new BadRequest("Content-Type can not be null"); + throw new BadRequest('Content-Type can not be null'); } $this->stream = $stream; @@ -60,7 +60,7 @@ class MultipartRequestParser { [$mimeType, $boundary] = explode(';', $contentType); [$boundaryKey, $boundaryValue] = explode('=', $boundary); } catch (\Exception $e) { - throw new BadRequest("Error while parsing boundary in Content-Type header.", Http::STATUS_BAD_REQUEST, $e); + throw new BadRequest('Error while parsing boundary in Content-Type header.', Http::STATUS_BAD_REQUEST, $e); } $boundaryValue = trim($boundaryValue); @@ -96,7 +96,7 @@ class MultipartRequestParser { $seekBackResult = fseek($this->stream, -$expectedContentLength, SEEK_CUR); if ($seekBackResult === -1) { - throw new Exception("Unknown error while seeking content", Http::STATUS_INTERNAL_SERVER_ERROR); + throw new Exception('Unknown error while seeking content', Http::STATUS_INTERNAL_SERVER_ERROR); } return $expectedContent === $content; @@ -134,7 +134,7 @@ class MultipartRequestParser { $headers = $this->readPartHeaders(); - $content = $this->readPartContent($headers["content-length"], $headers["x-file-md5"]); + $content = $this->readPartContent($headers['content-length'], $headers['x-file-md5']); return [$headers, $content]; } @@ -146,7 +146,7 @@ class MultipartRequestParser { */ private function readBoundary(): string { if (!$this->isAtBoundary()) { - throw new BadRequest("Boundary not found where it should be."); + throw new BadRequest('Boundary not found where it should be.'); } return fread($this->stream, strlen($this->boundary)); @@ -180,12 +180,12 @@ class MultipartRequestParser { } } - if (!isset($headers["content-length"])) { - throw new LengthRequired("The Content-Length header must not be null."); + if (!isset($headers['content-length'])) { + throw new LengthRequired('The Content-Length header must not be null.'); } - if (!isset($headers["x-file-md5"])) { - throw new BadRequest("The X-File-MD5 header must not be null."); + if (!isset($headers['x-file-md5'])) { + throw new BadRequest('The X-File-MD5 header must not be null.'); } return $headers; @@ -201,7 +201,7 @@ class MultipartRequestParser { $computedMd5 = $this->computeMd5Hash($length); if ($md5 !== $computedMd5) { - throw new BadRequest("Computed md5 hash is incorrect."); + throw new BadRequest('Computed md5 hash is incorrect.'); } if ($length === 0) { @@ -215,7 +215,7 @@ class MultipartRequestParser { } if ($length !== 0 && feof($this->stream)) { - throw new Exception("Unexpected EOF while reading stream."); + throw new Exception('Unexpected EOF while reading stream.'); } // Read '\r\n'. diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php index c2018baab92..56b481097cf 100644 --- a/apps/dav/lib/CalDAV/Activity/Backend.php +++ b/apps/dav/lib/CalDAV/Activity/Backend.php @@ -133,7 +133,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('calendar', (int) $calendarData['id']) + ->setObject('calendar', (int)$calendarData['id']) ->setType('calendar') ->setAuthor($currentUser); @@ -161,7 +161,7 @@ class Backend { [ 'actor' => $currentUser, 'calendar' => [ - 'id' => (int) $calendarData['id'], + 'id' => (int)$calendarData['id'], 'uri' => $calendarData['uri'], 'name' => $calendarData['{DAV:}displayname'], ], @@ -192,7 +192,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('calendar', (int) $calendarData['id']) + ->setObject('calendar', (int)$calendarData['id']) ->setType('calendar') ->setAuthor($currentUser); @@ -217,7 +217,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'calendar' => [ - 'id' => (int) $calendarData['id'], + 'id' => (int)$calendarData['id'], 'uri' => $calendarData['uri'], 'name' => $calendarData['{DAV:}displayname'], ], @@ -246,7 +246,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'calendar' => [ - 'id' => (int) $calendarData['id'], + 'id' => (int)$calendarData['id'], 'uri' => $calendarData['uri'], 'name' => $calendarData['{DAV:}displayname'], ], @@ -288,7 +288,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'calendar' => [ - 'id' => (int) $calendarData['id'], + 'id' => (int)$calendarData['id'], 'uri' => $calendarData['uri'], 'name' => $calendarData['{DAV:}displayname'], ], @@ -315,7 +315,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'calendar' => [ - 'id' => (int) $calendarData['id'], + 'id' => (int)$calendarData['id'], 'uri' => $calendarData['uri'], 'name' => $calendarData['{DAV:}displayname'], ], @@ -393,7 +393,7 @@ class Backend { [ 'actor' => $event->getAuthor(), 'calendar' => [ - 'id' => (int) $properties['id'], + 'id' => (int)$properties['id'], 'uri' => $properties['uri'], 'name' => $properties['{DAV:}displayname'], ], @@ -443,7 +443,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('calendar', (int) $calendarData['id']) + ->setObject('calendar', (int)$calendarData['id']) ->setType($object['type'] === 'event' ? 'calendar_event' : 'calendar_todo') ->setAuthor($currentUser); @@ -460,7 +460,7 @@ class Backend { $params = [ 'actor' => $event->getAuthor(), 'calendar' => [ - 'id' => (int) $calendarData['id'], + 'id' => (int)$calendarData['id'], 'uri' => $calendarData['uri'], 'name' => $calendarData['{DAV:}displayname'], ], @@ -534,7 +534,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('calendar', (int) $targetCalendarData['id']) + ->setObject('calendar', (int)$targetCalendarData['id']) ->setType($object['type'] === 'event' ? 'calendar_event' : 'calendar_todo') ->setAuthor($currentUser); @@ -551,12 +551,12 @@ class Backend { $params = [ 'actor' => $event->getAuthor(), 'sourceCalendar' => [ - 'id' => (int) $sourceCalendarData['id'], + 'id' => (int)$sourceCalendarData['id'], 'uri' => $sourceCalendarData['uri'], 'name' => $sourceCalendarData['{DAV:}displayname'], ], 'targetCalendar' => [ - 'id' => (int) $targetCalendarData['id'], + 'id' => (int)$targetCalendarData['id'], 'uri' => $targetCalendarData['uri'], 'name' => $targetCalendarData['{DAV:}displayname'], ], @@ -603,9 +603,9 @@ class Backend { } if ($componentType === 'VEVENT') { - return ['id' => (string) $component->UID, 'name' => (string) $component->SUMMARY, 'type' => 'event']; + return ['id' => (string)$component->UID, 'name' => (string)$component->SUMMARY, 'type' => 'event']; } - return ['id' => (string) $component->UID, 'name' => (string) $component->SUMMARY, 'type' => 'todo', 'status' => (string) $component->STATUS]; + return ['id' => (string)$component->UID, 'name' => (string)$component->SUMMARY, 'type' => 'todo', 'status' => (string)$component->STATUS]; } /** diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php index 6ac161a0a2c..e5c25fd8ae6 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php @@ -40,8 +40,8 @@ class Calendar implements IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php index dfa05ae9099..6ca31f1688c 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php @@ -40,8 +40,8 @@ class Todo implements IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php index 4e1fdc0fe97..a201213f784 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php @@ -24,8 +24,8 @@ class Calendar extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Event.php b/apps/dav/lib/CalDAV/Activity/Setting/Event.php index a177d27d2e3..ea049738251 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Event.php @@ -24,8 +24,8 @@ class Event extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php index ecd3634ee12..7ac3b1e0f76 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php @@ -25,8 +25,8 @@ class Todo extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 0990cd674dd..a10d73c4aa0 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -87,7 +87,7 @@ class BirthdayService { return; } foreach ($datesToSync as $type) { - $this->updateCalendar($cardUri, $cardData, $book, (int) $calendar['id'], $type, $reminderOffset); + $this->updateCalendar($cardUri, $cardData, $book, (int)$calendar['id'], $type, $reminderOffset); } } } @@ -247,7 +247,7 @@ class BirthdayService { $vEvent->{'X-NEXTCLOUD-BC-FIELD-TYPE'} = $dateField; $vEvent->{'X-NEXTCLOUD-BC-UNKNOWN-YEAR'} = $dateParts['year'] === null ? '1' : '0'; if ($originalYear !== null) { - $vEvent->{'X-NEXTCLOUD-BC-YEAR'} = (string) $originalYear; + $vEvent->{'X-NEXTCLOUD-BC-YEAR'} = (string)$originalYear; } if ($reminderOffset) { $alarm = $vCal->createComponent('VALARM'); @@ -287,7 +287,7 @@ class BirthdayService { foreach ($books as $book) { $cards = $this->cardDavBackEnd->getCards($book['id']); foreach ($cards as $card) { - $this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']); + $this->onCardChanged((int)$book['id'], $card['uri'], $card['carddata']); } } } diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php index 3f6eff4e1f4..17e6f4389cc 100644 --- a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php +++ b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php @@ -32,7 +32,7 @@ class CachedSubscriptionImpl implements ICalendar { * @since 13.0.0 */ public function getKey(): string { - return (string) $this->calendarInfo['id']; + return (string)$this->calendarInfo['id']; } /** @@ -62,7 +62,7 @@ class CachedSubscriptionImpl implements ICalendar { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param int|null $limit - limit number of search results * @param int|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of key-value-pairs diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 70895ac2c43..e35604e8497 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -258,8 +258,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendars = []; while (($row = $result->fetch()) !== false) { $calendars[] = [ - 'id' => (int) $row['id'], - 'deleted_at' => (int) $row['deleted_at'], + 'id' => (int)$row['id'], + 'deleted_at' => (int)$row['deleted_at'], ]; } $result->closeCursor(); @@ -319,7 +319,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendars = []; while ($row = $result->fetch()) { - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; $components = []; if ($row['components']) { $components = explode(',', $row['components']); @@ -382,12 +382,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; while ($row = $results->fetch()) { - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; if ($row['principaluri'] === $principalUri) { continue; } - $readOnly = (int) $row['access'] === Backend::ACCESS_READ; + $readOnly = (int)$row['access'] === Backend::ACCESS_READ; if (isset($calendars[$row['id']])) { if ($readOnly) { // New share can not have more permissions than the old one. @@ -452,7 +452,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $calendars = []; while ($row = $stmt->fetch()) { - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; $components = []; if ($row['components']) { $components = explode(',', $row['components']); @@ -502,7 +502,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->executeQuery(); while ($row = $result->fetch()) { - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; [, $name] = Uri\split($row['principaluri']); $row['displayname'] = $row['displayname'] . "($name)"; $components = []; @@ -567,7 +567,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription throw new NotFound('Node with name \'' . $uri . '\' could not be found'); } - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; [, $name] = Uri\split($row['principaluri']); $row['displayname'] = $row['displayname'] . ' ' . "($name)"; $components = []; @@ -622,7 +622,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return null; } - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; $components = []; if ($row['components']) { $components = explode(',', $row['components']); @@ -670,7 +670,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return null; } - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; $components = []; if ($row['components']) { $components = explode(',', $row['components']); @@ -718,7 +718,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return null; } - $row['principaluri'] = (string) $row['principaluri']; + $row['principaluri'] = (string)$row['principaluri']; $subscription = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -774,7 +774,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; if (isset($properties[$transp])) { - $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); + $values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent'); } foreach ($this->propertyMap as $xmlName => [$dbName, $type]) { @@ -827,7 +827,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription switch ($propertyName) { case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': $fieldName = 'transparent'; - $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); + $newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent'); break; default: $fieldName = $this->propertyMap[$propertyName][0]; @@ -844,7 +844,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); $query->executeStatement(); - $this->addChanges($calendarId, [""], 2); + $this->addChanges($calendarId, [''], 2); $calendarData = $this->getCalendarById($calendarId); $shares = $this->getShares($calendarId); @@ -1067,12 +1067,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'uri' => $row['uri'], 'lastmodified' => $row['lastmodified'], 'etag' => '"' . $row['etag'] . '"', - 'calendarid' => (int) $row['calendarid'], - 'calendartype' => (int) $row['calendartype'], - 'size' => (int) $row['size'], + 'calendarid' => (int)$row['calendarid'], + 'calendartype' => (int)$row['calendartype'], + 'size' => (int)$row['size'], 'component' => strtolower($row['componenttype']), - 'classification' => (int) $row['classification'], - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], + 'classification' => (int)$row['classification'], + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], ]; } $stmt->closeCursor(); @@ -1111,7 +1111,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'size' => (int)$row['size'], 'component' => strtolower($row['componenttype']), 'classification' => (int)$row['classification'], - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], ]; } $stmt->closeCursor(); @@ -1171,7 +1171,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'calendardata' => $this->readBlob($row['calendardata']), 'component' => strtolower($row['componenttype']), 'classification' => (int)$row['classification'], - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], ]; } @@ -1260,7 +1260,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))) ->andWhere($qb->expr()->isNull('deleted_at')); $result = $qb->executeQuery(); - $count = (int) $result->fetchOne(); + $count = (int)$result->fetchOne(); $result->closeCursor(); if ($count !== 0) { @@ -1348,15 +1348,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { $query = $this->db->getQueryBuilder(); $query->update('calendarobjects') - ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) - ->set('lastmodified', $query->createNamedParameter(time())) - ->set('etag', $query->createNamedParameter($extraData['etag'])) - ->set('size', $query->createNamedParameter($extraData['size'])) - ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) - ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) - ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) - ->set('classification', $query->createNamedParameter($extraData['classification'])) - ->set('uid', $query->createNamedParameter($extraData['uid'])) + ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) + ->set('lastmodified', $query->createNamedParameter(time())) + ->set('etag', $query->createNamedParameter($extraData['etag'])) + ->set('size', $query->createNamedParameter($extraData['size'])) + ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) + ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) + ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) + ->set('classification', $query->createNamedParameter($extraData['classification'])) + ->set('uid', $query->createNamedParameter($extraData['uid'])) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) @@ -1499,13 +1499,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription if (!empty($pathInfo['extension'])) { // Append a suffix to "free" the old URI for recreation $newUri = sprintf( - "%s-deleted.%s", + '%s-deleted.%s', $pathInfo['filename'], $pathInfo['extension'] ); } else { $newUri = sprintf( - "%s-deleted", + '%s-deleted', $pathInfo['filename'] ); } @@ -1553,8 +1553,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription public function restoreCalendarObject(array $objectData): void { $this->cachedObjects = []; $this->atomic(function () use ($objectData) { - $id = (int) $objectData['id']; - $restoreUri = str_replace("-deleted.ics", ".ics", $objectData['uri']); + $id = (int)$objectData['id']; + $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); $targetObject = $this->getCalendarObject( $objectData['calendarid'], $restoreUri @@ -1583,17 +1583,17 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription // Welp, this should possibly not have happened, but let's ignore return; } - $this->addChanges($row['calendarid'], [$row['uri']], 1, (int) $row['calendartype']); + $this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']); - $calendarRow = $this->getCalendarById((int) $row['calendarid']); + $calendarRow = $this->getCalendarById((int)$row['calendarid']); if ($calendarRow === null) { throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.'); } $this->dispatcher->dispatchTyped( new CalendarObjectRestoredEvent( - (int) $objectData['calendarid'], + (int)$objectData['calendarid'], $calendarRow, - $this->getShares((int) $row['calendarid']), + $this->getShares((int)$row['calendarid']), $row ) ); @@ -2286,7 +2286,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $calendarObjectIdQuery->executeQuery(); $matches = []; while (($row = $result->fetch()) !== false) { - $matches[] = (int) $row['objectid']; + $matches[] = (int)$row['objectid']; } $result->closeCursor(); @@ -2373,7 +2373,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'calendardata' => $this->readBlob($row['calendardata']), 'component' => strtolower($row['componenttype']), 'classification' => (int)$row['classification'], - 'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null, + 'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null, ]; } @@ -2765,9 +2765,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription public function getSchedulingObjects($principalUri) { $query = $this->db->getQueryBuilder(); $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) - ->from('schedulingobjects') - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) - ->executeQuery(); + ->from('schedulingobjects') + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) + ->executeQuery(); $results = []; while (($row = $stmt->fetch()) !== false) { @@ -2795,9 +2795,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $this->cachedObjects = []; $query = $this->db->getQueryBuilder(); $query->delete('schedulingobjects') - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) - ->executeStatement(); + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) + ->executeStatement(); } /** @@ -2940,7 +2940,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ); $resultDeleted = $qbDeleted->executeQuery(); $deletedUris = array_map(function (string $uri) { - return str_replace("-deleted.ics", ".ics", $uri); + return str_replace('-deleted.ics', '.ics', $uri); }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN)); $resultDeleted->closeCursor(); $this->addChanges($calendarId, $deletedUris, 3, $calendarType); @@ -3423,7 +3423,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->from('calendarchanges'); $result = $query->executeQuery(); - $maxId = (int) $result->fetchOne(); + $maxId = (int)$result->fetchOne(); $result->closeCursor(); if (!$maxId || $maxId < $keep) { return 0; diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 2781dbafa67..28267921a6f 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -376,7 +376,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable * @inheritDoc */ public function restore(): void { - $this->caldavBackend->restoreCalendar((int) $this->calendarInfo['id']); + $this->caldavBackend->restoreCalendar((int)$this->calendarInfo['id']); } public function disableTrashbin(): void { diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index cac9bad0d89..bba1603c325 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -43,7 +43,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { * @since 13.0.0 */ public function getKey(): string { - return (string) $this->calendarInfo['id']; + return (string)$this->calendarInfo['id']; } /** @@ -96,7 +96,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param int|null $limit - limit number of search results * @param int|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of key-value-pairs diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index f7af3ce8b4b..0dd9bee9ce4 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -62,7 +62,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { } public function getId(): int { - return (int) $this->objectData['id']; + return (int)$this->objectData['id']; } protected function isShared() { diff --git a/apps/dav/lib/CalDAV/EventReader.php b/apps/dav/lib/CalDAV/EventReader.php index 99e5677d432..bdceb184fb0 100644 --- a/apps/dav/lib/CalDAV/EventReader.php +++ b/apps/dav/lib/CalDAV/EventReader.php @@ -66,8 +66,8 @@ class EventReader { * @since 30.0.0 * * @param VCalendar|VEvent|Array|String $input - * @param string|null $uid - * @param DateTimeZone|null $timeZone reference timezone for floating dates and times + * @param string|null $uid + * @param DateTimeZone|null $timeZone reference timezone for floating dates and times */ public function __construct(VCalendar|VEvent|array|string $input, ?string $uid = null, ?DateTimeZone $timeZone = null) { @@ -295,9 +295,9 @@ class EventReader { * * @since 30.0.0 * - * @return string|null R - Relative or A - Absolute + * @return string|null R - Relative or A - Absolute */ - public function recurringPattern(): string | null { + public function recurringPattern(): string|null { if ($this->rruleIterator === null && $this->rdateIterator === null) { return null; } @@ -312,9 +312,9 @@ class EventReader { * * @since 30.0.0 * - * @return string|null daily, weekly, monthly, yearly, fixed + * @return string|null daily, weekly, monthly, yearly, fixed */ - public function recurringPrecision(): string | null { + public function recurringPrecision(): string|null { if ($this->rruleIterator !== null) { return $this->rruleIterator->precision(); } @@ -331,7 +331,7 @@ class EventReader { * * @return int|null */ - public function recurringInterval(): int | null { + public function recurringInterval(): int|null { return $this->rruleIterator?->interval(); } @@ -374,14 +374,14 @@ class EventReader { * * @return int|null */ - public function recurringConcludesAfter(): int | null { + public function recurringConcludesAfter(): int|null { // construct count place holder $count = 0; // retrieve and add RRULE iterations count - $count += (int) $this->rruleIterator?->concludesAfter(); + $count += (int)$this->rruleIterator?->concludesAfter(); // retrieve and add RDATE iterations count - $count += (int) $this->rdateIterator?->concludesAfter(); + $count += (int)$this->rdateIterator?->concludesAfter(); // return count return !empty($count) ? $count : null; @@ -399,7 +399,7 @@ class EventReader { * * @return DateTime|null */ - public function recurringConcludesOn(): DateTime | null { + public function recurringConcludesOn(): DateTime|null { if ($this->rruleIterator !== null) { // retrieve rrule conclusion date @@ -626,7 +626,7 @@ class EventReader { * * @return DateTime */ - public function recurrenceDate(): DateTime | null { + public function recurrenceDate(): DateTime|null { if ($this->recurrenceCurrentDate !== null) { return DateTime::createFromInterface($this->recurrenceCurrentDate); } else { @@ -745,7 +745,7 @@ class EventReader { * * @since 30.0.0 * - * @param DateTimeInterface $dt date and time to advance + * @param DateTimeInterface $dt date and time to advance * * @return void */ diff --git a/apps/dav/lib/CalDAV/EventReaderRDate.php b/apps/dav/lib/CalDAV/EventReaderRDate.php index 65362be4b07..9d9669dc0f3 100644 --- a/apps/dav/lib/CalDAV/EventReaderRDate.php +++ b/apps/dav/lib/CalDAV/EventReaderRDate.php @@ -13,15 +13,15 @@ use DateTime; class EventReaderRDate extends \Sabre\VObject\Recur\RDateIterator { - public function concludes(): DateTime | null { + public function concludes(): DateTime|null { return $this->concludesOn(); } - public function concludesAfter(): int | null { + public function concludesAfter(): int|null { return !empty($this->dates) ? count($this->dates) : null; } - public function concludesOn(): DateTime | null { + public function concludesOn(): DateTime|null { if (count($this->dates) > 0) { return new DateTime( $this->dates[array_key_last($this->dates)], diff --git a/apps/dav/lib/CalDAV/EventReaderRRule.php b/apps/dav/lib/CalDAV/EventReaderRRule.php index fa47930caa8..fc229ddcd44 100644 --- a/apps/dav/lib/CalDAV/EventReaderRRule.php +++ b/apps/dav/lib/CalDAV/EventReaderRRule.php @@ -22,7 +22,7 @@ class EventReaderRRule extends \Sabre\VObject\Recur\RRuleIterator { return $this->interval; } - public function concludes(): DateTime | null { + public function concludes(): DateTime|null { // evaluate if until value is a date if ($this->until instanceof DateTimeInterface) { return DateTime::createFromInterface($this->until); @@ -48,11 +48,11 @@ class EventReaderRRule extends \Sabre\VObject\Recur\RRuleIterator { return null; } - public function concludesAfter(): int | null { + public function concludesAfter(): int|null { return !empty($this->count) ? $this->count : null; } - public function concludesOn(): DateTime | null { + public function concludesOn(): DateTime|null { return isset($this->until) ? DateTime::createFromInterface($this->until) : null; } diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 94c5b7d1f52..1b30884cf12 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -133,7 +133,7 @@ class PublishPlugin extends ServerPlugin { $path = $request->getPath(); // Only handling xml - $contentType = (string) $request->getHeader('Content-Type'); + $contentType = (string)$request->getHeader('Content-Type'); if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) { return; } diff --git a/apps/dav/lib/CalDAV/Reminder/Backend.php b/apps/dav/lib/CalDAV/Reminder/Backend.php index a4f3c7c6e12..1fa30f2538b 100644 --- a/apps/dav/lib/CalDAV/Reminder/Backend.php +++ b/apps/dav/lib/CalDAV/Reminder/Backend.php @@ -188,15 +188,15 @@ class Backend { * @return array */ private function fixRowTyping(array $row): array { - $row['id'] = (int) $row['id']; - $row['calendar_id'] = (int) $row['calendar_id']; - $row['object_id'] = (int) $row['object_id']; - $row['is_recurring'] = (bool) $row['is_recurring']; - $row['recurrence_id'] = (int) $row['recurrence_id']; - $row['is_recurrence_exception'] = (bool) $row['is_recurrence_exception']; - $row['is_relative'] = (bool) $row['is_relative']; - $row['notification_date'] = (int) $row['notification_date']; - $row['is_repeat_based'] = (bool) $row['is_repeat_based']; + $row['id'] = (int)$row['id']; + $row['calendar_id'] = (int)$row['calendar_id']; + $row['object_id'] = (int)$row['object_id']; + $row['is_recurring'] = (bool)$row['is_recurring']; + $row['recurrence_id'] = (int)$row['recurrence_id']; + $row['is_recurrence_exception'] = (bool)$row['is_recurrence_exception']; + $row['is_relative'] = (bool)$row['is_relative']; + $row['notification_date'] = (int)$row['notification_date']; + $row['is_repeat_based'] = (bool)$row['is_repeat_based']; return $row; } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php index 4d087f58d2b..33e7ae9c09f 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php @@ -113,7 +113,7 @@ abstract class AbstractProvider implements INotificationProvider { */ private function getStatusOfEvent(VEvent $vevent):string { if ($vevent->STATUS) { - return (string) $vevent->STATUS; + return (string)$vevent->STATUS; } // Doesn't say so in the standard, diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 947d286643c..59f412c0a7b 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -149,11 +149,11 @@ class EmailProvider extends AbstractProvider { $this->getAbsoluteImagePath('places/calendar.png')); if (isset($vevent->LOCATION)) { - $template->addBodyListItem((string) $vevent->LOCATION, $l10n->t('Where:'), + $template->addBodyListItem((string)$vevent->LOCATION, $l10n->t('Where:'), $this->getAbsoluteImagePath('actions/address.png')); } if (isset($vevent->DESCRIPTION)) { - $template->addBodyListItem((string) $vevent->DESCRIPTION, $l10n->t('Description:'), + $template->addBodyListItem((string)$vevent->DESCRIPTION, $l10n->t('Description:'), $this->getAbsoluteImagePath('actions/more.png')); } } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index 5b0ba28a6c1..d8abbc39631 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -65,7 +65,7 @@ class PushProvider extends AbstractProvider { } $eventDetails = $this->extractEventDetails($vevent); - $eventUUID = (string) $vevent->UID; + $eventUUID = (string)$vevent->UID; if (!$eventUUID) { return; }; @@ -100,13 +100,13 @@ class PushProvider extends AbstractProvider { return [ 'title' => isset($vevent->SUMMARY) - ? ((string) $vevent->SUMMARY) + ? ((string)$vevent->SUMMARY) : null, 'description' => isset($vevent->DESCRIPTION) - ? ((string) $vevent->DESCRIPTION) + ? ((string)$vevent->DESCRIPTION) : null, 'location' => isset($vevent->LOCATION) - ? ((string) $vevent->LOCATION) + ? ((string)$vevent->LOCATION) : null, 'all_day' => $start instanceof Property\ICalendar\Date, 'start_atom' => $start->getDateTime()->format(\DateTimeInterface::ATOM), diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index be81e534dd3..4ac9e83ef08 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -206,14 +206,14 @@ class ReminderService { if (!$vcalendar) { return; } - $calendarTimeZone = $this->getCalendarTimeZone((int) $objectData['calendarid']); + $calendarTimeZone = $this->getCalendarTimeZone((int)$objectData['calendarid']); $vevents = $this->getAllVEventsFromVCalendar($vcalendar); if (count($vevents) === 0) { return; } - $uid = (string) $vevents[0]->UID; + $uid = (string)$vevents[0]->UID; $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); $masterItem = $this->getMasterItemFromListOfVEvents($vevents); $now = $this->timeFactory->getDateTime(); @@ -283,7 +283,7 @@ class ReminderService { continue; } - if (!\in_array((string) $valarm->ACTION, self::REMINDER_TYPES, true)) { + if (!\in_array((string)$valarm->ACTION, self::REMINDER_TYPES, true)) { // Action allows x-name, we don't insert reminders // into the database if they are not standard $processedAlarms[] = $alarmHash; @@ -353,7 +353,7 @@ class ReminderService { return; } - $this->backend->cleanRemindersForEvent((int) $objectData['id']); + $this->backend->cleanRemindersForEvent((int)$objectData['id']); } /** @@ -402,19 +402,19 @@ class ReminderService { $alarms[] = [ 'calendar_id' => $objectData['calendarid'], 'object_id' => $objectData['id'], - 'uid' => (string) $valarm->parent->UID, + 'uid' => (string)$valarm->parent->UID, 'is_recurring' => $isRecurring, 'recurrence_id' => $recurrenceId, 'is_recurrence_exception' => $isRecurrenceException, 'event_hash' => $eventHash, 'alarm_hash' => $alarmHash, - 'type' => (string) $valarm->ACTION, + 'type' => (string)$valarm->ACTION, 'is_relative' => $isRelative, 'notification_date' => $notificationDate->getTimestamp(), 'is_repeat_based' => false, ]; - $repeat = isset($valarm->REPEAT) ? (int) $valarm->REPEAT->getValue() : 0; + $repeat = isset($valarm->REPEAT) ? (int)$valarm->REPEAT->getValue() : 0; for ($i = 0; $i < $repeat; $i++) { if ($valarm->DURATION === null) { continue; @@ -424,13 +424,13 @@ class ReminderService { $alarms[] = [ 'calendar_id' => $objectData['calendarid'], 'object_id' => $objectData['id'], - 'uid' => (string) $valarm->parent->UID, + 'uid' => (string)$valarm->parent->UID, 'is_recurring' => $isRecurring, 'recurrence_id' => $recurrenceId, 'is_recurrence_exception' => $isRecurrenceException, 'event_hash' => $eventHash, 'alarm_hash' => $alarmHash, - 'type' => (string) $valarm->ACTION, + 'type' => (string)$valarm->ACTION, 'is_relative' => $isRelative, 'notification_date' => $clonedNotificationDate->getTimestamp(), 'is_repeat_based' => true, @@ -453,17 +453,17 @@ class ReminderService { } foreach (array_values($uniqueReminders) as $reminder) { $this->backend->insertReminder( - (int) $reminder['calendar_id'], - (int) $reminder['object_id'], + (int)$reminder['calendar_id'], + (int)$reminder['object_id'], $reminder['uid'], $reminder['is_recurring'], - (int) $reminder['recurrence_id'], + (int)$reminder['recurrence_id'], $reminder['is_recurrence_exception'], $reminder['event_hash'], $reminder['alarm_hash'], $reminder['type'], $reminder['is_relative'], - (int) $reminder['notification_date'], + (int)$reminder['notification_date'], $reminder['is_repeat_based'] ); } @@ -486,7 +486,7 @@ class ReminderService { $vevents = $this->getAllVEventsFromVCalendar($vevent->parent); $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); $now = $this->timeFactory->getDateTime(); - $calendarTimeZone = $this->getCalendarTimeZone((int) $reminder['calendar_id']); + $calendarTimeZone = $this->getCalendarTimeZone((int)$reminder['calendar_id']); try { $iterator = new EventIterator($vevents, $reminder['uid']); @@ -602,26 +602,26 @@ class ReminderService { */ private function getEventHash(VEvent $vevent):string { $properties = [ - (string) $vevent->DTSTART->serialize(), + (string)$vevent->DTSTART->serialize(), ]; if ($vevent->DTEND) { - $properties[] = (string) $vevent->DTEND->serialize(); + $properties[] = (string)$vevent->DTEND->serialize(); } if ($vevent->DURATION) { - $properties[] = (string) $vevent->DURATION->serialize(); + $properties[] = (string)$vevent->DURATION->serialize(); } if ($vevent->{'RECURRENCE-ID'}) { - $properties[] = (string) $vevent->{'RECURRENCE-ID'}->serialize(); + $properties[] = (string)$vevent->{'RECURRENCE-ID'}->serialize(); } if ($vevent->RRULE) { - $properties[] = (string) $vevent->RRULE->serialize(); + $properties[] = (string)$vevent->RRULE->serialize(); } if ($vevent->EXDATE) { - $properties[] = (string) $vevent->EXDATE->serialize(); + $properties[] = (string)$vevent->EXDATE->serialize(); } if ($vevent->RDATE) { - $properties[] = (string) $vevent->RDATE->serialize(); + $properties[] = (string)$vevent->RDATE->serialize(); } return md5(implode('::', $properties)); @@ -636,15 +636,15 @@ class ReminderService { */ private function getAlarmHash(VAlarm $valarm):string { $properties = [ - (string) $valarm->ACTION->serialize(), - (string) $valarm->TRIGGER->serialize(), + (string)$valarm->ACTION->serialize(), + (string)$valarm->TRIGGER->serialize(), ]; if ($valarm->DURATION) { - $properties[] = (string) $valarm->DURATION->serialize(); + $properties[] = (string)$valarm->DURATION->serialize(); } if ($valarm->REPEAT) { - $properties[] = (string) $valarm->REPEAT->serialize(); + $properties[] = (string)$valarm->REPEAT->serialize(); } return md5(implode('::', $properties)); @@ -664,7 +664,7 @@ class ReminderService { return null; } - $uid = (string) $vevents[0]->UID; + $uid = (string)$vevents[0]->UID; $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); $masterItem = $this->getMasterItemFromListOfVEvents($vevents); @@ -715,7 +715,7 @@ class ReminderService { */ private function getStatusOfEvent(VEvent $vevent):string { if ($vevent->STATUS) { - return (string) $vevent->STATUS; + return (string)$vevent->STATUS; } // Doesn't say so in the standard, diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 2eb8ebfc84e..83e2935a46e 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -386,7 +386,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { try { $stmt = $query->executeQuery(); } catch (Exception $e) { - $this->logger->error("Could not search resources: " . $e->getMessage(), ['exception' => $e]); + $this->logger->error('Could not search resources: ' . $e->getMessage(), ['exception' => $e]); } $rows = []; diff --git a/apps/dav/lib/CalDAV/RetentionService.php b/apps/dav/lib/CalDAV/RetentionService.php index 72301927f2b..a41aa12bb66 100644 --- a/apps/dav/lib/CalDAV/RetentionService.php +++ b/apps/dav/lib/CalDAV/RetentionService.php @@ -36,10 +36,10 @@ class RetentionService { public function getDuration(): int { return max( - (int) $this->config->getAppValue( + (int)$this->config->getAppValue( Application::APP_ID, self::RETENTION_CONFIG_KEY, - (string) self::DEFAULT_RETENTION_SECONDS + (string)self::DEFAULT_RETENTION_SECONDS ), 0 // Just making sure we don't delete things in the future when a negative number is passed ); diff --git a/apps/dav/lib/CalDAV/Schedule/IMipService.php b/apps/dav/lib/CalDAV/Schedule/IMipService.php index 14272cb5206..3d6317e6968 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipService.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipService.php @@ -256,7 +256,7 @@ class IMipService { public function generateWhenStringRecurringDaily(EventReader $er): string { // initialize - $interval = (int) $er->recurringInterval(); + $interval = (int)$er->recurringInterval(); $startTime = ''; $endTime = ''; $conclusion = ''; @@ -308,7 +308,7 @@ class IMipService { public function generateWhenStringRecurringWeekly(EventReader $er): string { // initialize - $interval = (int) $er->recurringInterval(); + $interval = (int)$er->recurringInterval(); $startTime = ''; $endTime = ''; $conclusion = ''; @@ -362,7 +362,7 @@ class IMipService { public function generateWhenStringRecurringMonthly(EventReader $er): string { // initialize - $interval = (int) $er->recurringInterval(); + $interval = (int)$er->recurringInterval(); $startTime = ''; $endTime = ''; $conclusion = ''; @@ -428,7 +428,7 @@ class IMipService { public function generateWhenStringRecurringYearly(EventReader $er): string { // initialize - $interval = (int) $er->recurringInterval(); + $interval = (int)$er->recurringInterval(); $startTime = ''; $endTime = ''; $conclusion = ''; diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php index 3ef147fe200..1326a42399b 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php @@ -83,7 +83,7 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { } public function getSize() { - return (int) $this->objectData['size']; + return (int)$this->objectData['size']; } public function restore(): void { @@ -91,7 +91,7 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { } public function getDeletedAt(): ?int { - return $this->objectData['deleted_at'] ? (int) $this->objectData['deleted_at'] : null; + return $this->objectData['deleted_at'] ? (int)$this->objectData['deleted_at'] : null; } public function getCalendarUri(): string { diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php index abf5f001e71..c9db04f7d32 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php @@ -51,7 +51,7 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL $data = $this->caldavBackend->getCalendarObjectById( $this->principalInfo['uri'], - (int) $matches[1], + (int)$matches[1], ); // If the object hasn't been deleted yet then we don't want to find it here diff --git a/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php b/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php index 680e5a1f02a..4a9721d00ec 100644 --- a/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php +++ b/apps/dav/lib/CalDAV/Validation/CalDavValidatePlugin.php @@ -30,7 +30,7 @@ class CalDavValidatePlugin extends ServerPlugin { public function beforePut(RequestInterface $request, ResponseInterface $response): bool { // evaluate if card size exceeds defined limit $eventSizeLimit = $this->config->getValueInt(Application::APP_ID, 'event_size_limit', 10485760); - if ((int) $request->getRawServerValue('CONTENT_LENGTH') > $eventSizeLimit) { + if ((int)$request->getRawServerValue('CONTENT_LENGTH') > $eventSizeLimit) { throw new Forbidden("VEvent or VTodo object exceeds $eventSizeLimit bytes"); } // all tests passed return true diff --git a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php index ea1bf7d4f0f..e07be39c7b4 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php @@ -28,9 +28,9 @@ class Plugin extends ServerPlugin { * @var string[] */ public const ENABLE_FOR_CLIENTS = [ - "/^MSFT-WIN-3/", - "/Evolution/", - "/KIO/" + '/^MSFT-WIN-3/', + '/Evolution/', + '/KIO/' ]; /** diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index 102571c8ef9..1f2c006cdfe 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -60,7 +60,7 @@ class RefreshWebcalService { return; } - $localData = $this->calDavBackend->getLimitedCalendarObjects((int) $subscription['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); + $localData = $this->calDavBackend->getLimitedCalendarObjects((int)$subscription['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); $stripTodos = ($subscription[self::STRIP_TODOS] ?? 1) === 1; $stripAlarms = ($subscription[self::STRIP_ALARMS] ?? 1) === 1; @@ -124,13 +124,13 @@ class RefreshWebcalService { try { $objectUri = $this->getRandomCalendarObjectUri(); $this->calDavBackend->createCalendarObject($subscription['id'], $objectUri, $vObject->serialize(), CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); - } catch (NoInstancesException | BadRequest $ex) { + } catch (NoInstancesException|BadRequest $ex) { $this->logger->error('Unable to create calendar object from subscription {subscriptionId}', ['exception' => $ex, 'subscriptionId' => $subscription['id'], 'source' => $subscription['source']]); } } $ids = array_map(static function ($dataSet): int { - return (int) $dataSet['id']; + return (int)$dataSet['id']; }, $localData); $uris = array_map(static function ($dataSet): string { return $dataSet['uri']; @@ -150,7 +150,7 @@ class RefreshWebcalService { $this->updateSubscription($subscription, $mutations); } catch (ParseException $ex) { - $this->logger->error("Subscription {subscriptionId} could not be refreshed due to a parsing error", ['exception' => $ex, 'subscriptionId' => $subscription['id']]); + $this->logger->error('Subscription {subscriptionId} could not be refreshed due to a parsing error', ['exception' => $ex, 'subscriptionId' => $subscription['id']]); } } diff --git a/apps/dav/lib/CardDAV/Activity/Backend.php b/apps/dav/lib/CardDAV/Activity/Backend.php index 34cf429022d..d2466e34f9d 100644 --- a/apps/dav/lib/CardDAV/Activity/Backend.php +++ b/apps/dav/lib/CardDAV/Activity/Backend.php @@ -111,7 +111,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('addressbook', (int) $addressbookData['id']) + ->setObject('addressbook', (int)$addressbookData['id']) ->setType('contacts') ->setAuthor($currentUser); @@ -139,7 +139,7 @@ class Backend { [ 'actor' => $currentUser, 'addressbook' => [ - 'id' => (int) $addressbookData['id'], + 'id' => (int)$addressbookData['id'], 'uri' => $addressbookData['uri'], 'name' => $addressbookData['{DAV:}displayname'], ], @@ -170,7 +170,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('addressbook', (int) $addressbookData['id']) + ->setObject('addressbook', (int)$addressbookData['id']) ->setType('contacts') ->setAuthor($currentUser); @@ -195,7 +195,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'addressbook' => [ - 'id' => (int) $addressbookData['id'], + 'id' => (int)$addressbookData['id'], 'uri' => $addressbookData['uri'], 'name' => $addressbookData['{DAV:}displayname'], ], @@ -224,7 +224,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'addressbook' => [ - 'id' => (int) $addressbookData['id'], + 'id' => (int)$addressbookData['id'], 'uri' => $addressbookData['uri'], 'name' => $addressbookData['{DAV:}displayname'], ], @@ -266,7 +266,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'addressbook' => [ - 'id' => (int) $addressbookData['id'], + 'id' => (int)$addressbookData['id'], 'uri' => $addressbookData['uri'], 'name' => $addressbookData['{DAV:}displayname'], ], @@ -293,7 +293,7 @@ class Backend { $parameters = [ 'actor' => $event->getAuthor(), 'addressbook' => [ - 'id' => (int) $addressbookData['id'], + 'id' => (int)$addressbookData['id'], 'uri' => $addressbookData['uri'], 'name' => $addressbookData['{DAV:}displayname'], ], @@ -371,7 +371,7 @@ class Backend { [ 'actor' => $event->getAuthor(), 'addressbook' => [ - 'id' => (int) $properties['id'], + 'id' => (int)$properties['id'], 'uri' => $properties['uri'], 'name' => $properties['{DAV:}displayname'], ], @@ -415,7 +415,7 @@ class Backend { $event = $this->activityManager->generateEvent(); $event->setApp('dav') - ->setObject('addressbook', (int) $addressbookData['id']) + ->setObject('addressbook', (int)$addressbookData['id']) ->setType('contacts') ->setAuthor($currentUser); @@ -427,7 +427,7 @@ class Backend { $params = [ 'actor' => $event->getAuthor(), 'addressbook' => [ - 'id' => (int) $addressbookData['id'], + 'id' => (int)$addressbookData['id'], 'uri' => $addressbookData['uri'], 'name' => $addressbookData['{DAV:}displayname'], ], @@ -454,7 +454,7 @@ class Backend { */ protected function getCardNameAndId(array $cardData): array { $vObject = Reader::read($cardData['carddata']); - return ['id' => (string) $vObject->UID, 'name' => (string) ($vObject->FN ?? '')]; + return ['id' => (string)$vObject->UID, 'name' => (string)($vObject->FN ?? '')]; } /** diff --git a/apps/dav/lib/CardDAV/Activity/Filter.php b/apps/dav/lib/CardDAV/Activity/Filter.php index 84e933fec7c..2003189ab5c 100644 --- a/apps/dav/lib/CardDAV/Activity/Filter.php +++ b/apps/dav/lib/CardDAV/Activity/Filter.php @@ -38,8 +38,8 @@ class Filter implements IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. */ public function getPriority(): int { return 40; diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Base.php b/apps/dav/lib/CardDAV/Activity/Provider/Base.php index 0a1b55efb08..95b4d52b242 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Base.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Base.php @@ -21,7 +21,7 @@ abstract class Base implements IProvider { /** @var IUserManager */ protected $userManager; - /** @var string[] */ + /** @var string[] */ protected $userDisplayNames = []; /** @var IGroupManager */ diff --git a/apps/dav/lib/CardDAV/Activity/Setting.php b/apps/dav/lib/CardDAV/Activity/Setting.php index aa25898065f..cc68cf87c83 100644 --- a/apps/dav/lib/CardDAV/Activity/Setting.php +++ b/apps/dav/lib/CardDAV/Activity/Setting.php @@ -27,8 +27,8 @@ class Setting extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. */ public function getPriority(): int { return 50; diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 55f7f3b7639..5dfb22141e8 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -78,19 +78,19 @@ class AddressBookImpl implements IAddressBook { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options Options to define the output format and search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'wildcard' - Whether the search should use wildcards + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'wildcard' - Whether the search should use wildcards * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs - * example result: - * [ - * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'], - * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']] - * ] + * example result: + * [ + * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'], + * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']] + * ] * @since 5.0.0 */ public function search($pattern, $searchProperties, $options) { @@ -131,13 +131,13 @@ class AddressBookImpl implements IAddressBook { if (is_string($entry)) { $property = $vCard->createProperty($key, $entry); } else { - if (($key === "ADR" || $key === "PHOTO") && is_string($entry["value"])) { - $entry["value"] = stripslashes($entry["value"]); - $entry["value"] = explode(';', $entry["value"]); + if (($key === 'ADR' || $key === 'PHOTO') && is_string($entry['value'])) { + $entry['value'] = stripslashes($entry['value']); + $entry['value'] = explode(';', $entry['value']); } - $property = $vCard->createProperty($key, $entry["value"]); - if (isset($entry["type"])) { - $property->add('TYPE', $entry["type"]); + $property = $vCard->createProperty($key, $entry['value']); + if (isset($entry['type'])) { + $property->add('TYPE', $entry['type']); } } $vCard->add($property); diff --git a/apps/dav/lib/CardDAV/Card.php b/apps/dav/lib/CardDAV/Card.php index 67f605d2fb4..8cd4fd7e5ee 100644 --- a/apps/dav/lib/CardDAV/Card.php +++ b/apps/dav/lib/CardDAV/Card.php @@ -10,7 +10,7 @@ namespace OCA\DAV\CardDAV; class Card extends \Sabre\CardDAV\Card { public function getId(): int { - return (int) $this->cardData['id']; + return (int)$this->cardData['id']; } public function getUri(): string { diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 9d787c917d3..9dee61638a5 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -76,7 +76,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); $result = $query->executeQuery(); - $column = (int) $result->fetchOne(); + $column = (int)$result->fetchOne(); $result->closeCursor(); return $column; } @@ -330,7 +330,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) ->executeStatement(); - $this->addChange($addressBookId, "", 2); + $this->addChange($addressBookId, '', 2); $addressBookRow = $this->getAddressBookById((int)$addressBookId); $shares = $this->getShares((int)$addressBookId); @@ -1032,11 +1032,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options = array() to define the search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'wildcard' - Whether the search should use wildcards + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'wildcard' - Whether the search should use wildcards * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs */ @@ -1061,7 +1061,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { array $options = []): array { return $this->atomic(function () use ($principalUri, $pattern, $searchProperties, $options) { $addressBookIds = array_map(static function ($row):int { - return (int) $row['id']; + return (int)$row['id']; }, $this->getAddressBooksForUser($principalUri)); return $this->searchByAddressBookIds($addressBookIds, $pattern, $searchProperties, $options); @@ -1186,7 +1186,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { } return array_map(function ($array) { - $array['addressbookid'] = (int) $array['addressbookid']; + $array['addressbookid'] = (int)$array['addressbookid']; $modified = false; $array['carddata'] = $this->readBlob($array['carddata'], $modified); if ($modified) { @@ -1398,7 +1398,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->from('addressbookchanges'); $result = $query->executeQuery(); - $maxId = (int) $result->fetchOne(); + $maxId = (int)$result->fetchOne(); $result->closeCursor(); if (!$maxId || $maxId < $keep) { return 0; diff --git a/apps/dav/lib/CardDAV/ContactsManager.php b/apps/dav/lib/CardDAV/ContactsManager.php index 6126ebc10ee..30af37481ab 100644 --- a/apps/dav/lib/CardDAV/ContactsManager.php +++ b/apps/dav/lib/CardDAV/ContactsManager.php @@ -12,10 +12,10 @@ use OCP\IL10N; use OCP\IURLGenerator; class ContactsManager { - /** @var CardDavBackend */ + /** @var CardDavBackend */ private $backend; - /** @var IL10N */ + /** @var IL10N */ private $l10n; /** @@ -45,7 +45,7 @@ class ContactsManager { * @param IURLGenerator $urlGenerator */ public function setupSystemContactsProvider(IManager $cm, IURLGenerator $urlGenerator) { - $addressBooks = $this->backend->getAddressBooksForUser("principals/system/system"); + $addressBooks = $this->backend->getAddressBooksForUser('principals/system/system'); $this->register($cm, $addressBooks, $urlGenerator); } diff --git a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php index 62ab16721b1..524ed4d433c 100644 --- a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php +++ b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php @@ -43,7 +43,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin { } // Only handling xml - $contentType = (string) $response->getHeader('Content-Type'); + $contentType = (string)$response->getHeader('Content-Type'); if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) { return; } diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php index 3ea99c29a51..00989386df7 100644 --- a/apps/dav/lib/CardDAV/PhotoCache.php +++ b/apps/dav/lib/CardDAV/PhotoCache.php @@ -19,7 +19,7 @@ use Sabre\VObject\Reader; class PhotoCache { - /** @var array */ + /** @var array */ public const ALLOWED_CONTENT_TYPES = [ 'image/png' => 'png', 'image/jpeg' => 'jpg', @@ -119,7 +119,7 @@ class PhotoCache { $ratio = 1 / $ratio; } - $size = (int) ($size * $ratio); + $size = (int)($size * $ratio); if ($size !== -1) { $photo->resize($size); } @@ -240,7 +240,7 @@ class PhotoCache { if (isset($params['TYPE']) || isset($params['MEDIATYPE'])) { /** @var Parameter $typeParam */ $typeParam = isset($params['TYPE']) ? $params['TYPE'] : $params['MEDIATYPE']; - $type = (string) $typeParam->getValue(); + $type = (string)$typeParam->getValue(); if (str_starts_with($type, 'image/')) { return $type; diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index 56cbe5255f4..02b862f1930 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -237,7 +237,7 @@ class SyncService { */ public function getLocalSystemAddressBook() { if (is_null($this->localSystemAddressBook)) { - $systemPrincipal = "principals/system/system"; + $systemPrincipal = 'principals/system/system'; $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [ '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' ]); diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php index 4ba06d0fc9c..aff51ac5b9b 100644 --- a/apps/dav/lib/CardDAV/SystemAddressbook.php +++ b/apps/dav/lib/CardDAV/SystemAddressbook.php @@ -254,7 +254,7 @@ class SystemAddressbook extends AddressBook { try { $this->getChild($uri); $added[] = $uri; - } catch (NotFound | Forbidden $e) { + } catch (NotFound|Forbidden $e) { $deleted[] = $uri; } } @@ -262,7 +262,7 @@ class SystemAddressbook extends AddressBook { try { $this->getChild($uri); $modified[] = $uri; - } catch (NotFound | Forbidden $e) { + } catch (NotFound|Forbidden $e) { $deleted[] = $uri; } } diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index d0719e02492..e2d3fe4d8c8 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -89,7 +89,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { try { $trustedServers = \OC::$server->get(TrustedServers::class); $request = \OC::$server->get(IRequest::class); - } catch (QueryException | NotFoundExceptionInterface | ContainerExceptionInterface $e) { + } catch (QueryException|NotFoundExceptionInterface|ContainerExceptionInterface $e) { // nothing to do, the request / trusted servers don't exist } if ($addressBook['principaluri'] === 'principals/system/system') { diff --git a/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php b/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php index 635ab6fcc78..7e76b9dac92 100644 --- a/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php +++ b/apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php @@ -30,7 +30,7 @@ class CardDavValidatePlugin extends ServerPlugin { public function beforePut(RequestInterface $request, ResponseInterface $response): bool { // evaluate if card size exceeds defined limit $cardSizeLimit = $this->config->getValueInt(Application::APP_ID, 'card_size_limit', 5242880); - if ((int) $request->getRawServerValue('CONTENT_LENGTH') > $cardSizeLimit) { + if ((int)$request->getRawServerValue('CONTENT_LENGTH') > $cardSizeLimit) { throw new Forbidden("VCard object exceeds $cardSizeLimit bytes"); } // all tests passed return true diff --git a/apps/dav/lib/Command/CreateAddressBook.php b/apps/dav/lib/Command/CreateAddressBook.php index e7d7824d1b6..9626edeba26 100644 --- a/apps/dav/lib/Command/CreateAddressBook.php +++ b/apps/dav/lib/Command/CreateAddressBook.php @@ -24,14 +24,14 @@ class CreateAddressBook extends Command { protected function configure(): void { $this - ->setName('dav:create-addressbook') - ->setDescription('Create a dav addressbook') - ->addArgument('user', - InputArgument::REQUIRED, - 'User for whom the addressbook will be created') - ->addArgument('name', - InputArgument::REQUIRED, - 'Name of the addressbook'); + ->setName('dav:create-addressbook') + ->setDescription('Create a dav addressbook') + ->addArgument('user', + InputArgument::REQUIRED, + 'User for whom the addressbook will be created') + ->addArgument('name', + InputArgument::REQUIRED, + 'Name of the addressbook'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/apps/dav/lib/Command/DeleteCalendar.php b/apps/dav/lib/Command/DeleteCalendar.php index 423a9b03434..53cabcfc5ce 100644 --- a/apps/dav/lib/Command/DeleteCalendar.php +++ b/apps/dav/lib/Command/DeleteCalendar.php @@ -56,7 +56,7 @@ class DeleteCalendar extends Command { InputInterface $input, OutputInterface $output ): int { - /** @var string $user **/ + /** @var string $user */ $user = $input->getArgument('uid'); if (!$this->userManager->userExists($user)) { throw new \InvalidArgumentException( @@ -67,7 +67,7 @@ class DeleteCalendar extends Command { if ($birthday !== false) { $name = BirthdayService::BIRTHDAY_CALENDAR_URI; } else { - /** @var string $name **/ + /** @var string $name */ $name = $input->getArgument('name'); if (!$name) { throw new \InvalidArgumentException( diff --git a/apps/dav/lib/Command/FixCalendarSyncCommand.php b/apps/dav/lib/Command/FixCalendarSyncCommand.php index 5e92b3270d2..e94e1dc9c4a 100644 --- a/apps/dav/lib/Command/FixCalendarSyncCommand.php +++ b/apps/dav/lib/Command/FixCalendarSyncCommand.php @@ -56,7 +56,7 @@ class FixCalendarSyncCommand extends Command { } private function fixUserCalendars(IUser $user, ?ProgressBar $progress = null): void { - $calendars = $this->calDavBackend->getCalendarsForUser("principals/users/" . $user->getUID()); + $calendars = $this->calDavBackend->getCalendarsForUser('principals/users/' . $user->getUID()); foreach ($calendars as $calendar) { $this->calDavBackend->restoreChanges($calendar['id']); diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php index b8adc75338a..36f20e5b547 100644 --- a/apps/dav/lib/Command/MoveCalendar.php +++ b/apps/dav/lib/Command/MoveCalendar.php @@ -50,7 +50,7 @@ class MoveCalendar extends Command { ->addArgument('destinationuid', InputArgument::REQUIRED, 'User who will receive the calendar') - ->addOption('force', 'f', InputOption::VALUE_NONE, "Force the migration by removing existing shares and renaming calendars in case of conflicts"); + ->addOption('force', 'f', InputOption::VALUE_NONE, 'Force the migration by removing existing shares and renaming calendars in case of conflicts'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -97,8 +97,8 @@ class MoveCalendar extends Command { * Warn that share links have changed if there are shares */ $this->io->note([ - "Please note that moving calendar " . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.", - "Sharees will need to change \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $newName ?: $calendar['uri'] . "_shared_by_$userDestination\"" + 'Please note that moving calendar ' . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.", + 'Sharees will need to change "example.com/remote.php/dav/calendars/uid/' . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $newName ?: $calendar['uri'] . "_shared_by_$userDestination\"" ]); } @@ -155,7 +155,7 @@ class MoveCalendar extends Command { if ($force) { $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['principal:principals/groups/' . $userOrGroup]); } else { - throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <" . $calendar['uri'] . "> was shared. You may use -f to move the calendar while deleting this share."); + throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <" . $calendar['uri'] . '> was shared. You may use -f to move the calendar while deleting this share.'); } } @@ -166,7 +166,7 @@ class MoveCalendar extends Command { if ($force) { $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['principal:principals/users/' . $userOrGroup]); } else { - throw new \InvalidArgumentException("The calendar <" . $calendar['uri'] . "> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share."); + throw new \InvalidArgumentException('The calendar <' . $calendar['uri'] . "> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share."); } } } diff --git a/apps/dav/lib/Command/SyncBirthdayCalendar.php b/apps/dav/lib/Command/SyncBirthdayCalendar.php index 5c8ac913af4..de63a8572bb 100644 --- a/apps/dav/lib/Command/SyncBirthdayCalendar.php +++ b/apps/dav/lib/Command/SyncBirthdayCalendar.php @@ -55,7 +55,7 @@ class SyncBirthdayCalendar extends Command { $this->birthdayService->syncUser($user); return self::SUCCESS; } - $output->writeln("Start birthday calendar sync for all users ..."); + $output->writeln('Start birthday calendar sync for all users ...'); $p = new ProgressBar($output); $p->start(); $this->userManager->callForSeenUsers(function ($user) use ($p) { diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index 3a9e5362528..a257611dd15 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -30,7 +30,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { public const PROPERTY_NAME_MENTION_ID = '{http://owncloud.org/ns}mentionId'; public const PROPERTY_NAME_MENTION_DISPLAYNAME = '{http://owncloud.org/ns}mentionDisplayName'; - /** @var IComment */ + /** @var IComment */ public $comment; /** @var ICommentsManager */ diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 7db64313121..3be87460d21 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -34,13 +34,13 @@ class CommentsPlugin extends ServerPlugin { public const REPORT_PARAM_OFFSET = '{http://owncloud.org/ns}offset'; public const REPORT_PARAM_TIMESTAMP = '{http://owncloud.org/ns}datetime'; - /** @var ICommentsManager */ + /** @var ICommentsManager */ protected $commentsManager; /** @var \Sabre\DAV\Server $server */ private $server; - /** @var \OCP\IUserSession */ + /** @var \OCP\IUserSession */ protected $userSession; /** diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index 367dab54c5e..19af2d9c234 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -27,7 +27,7 @@ use Sabre\DAV\PropPatch; class EntityCollection extends RootCollection implements IProperties { public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; - /** @var string */ + /** @var string */ protected $id; protected LoggerInterface $logger; diff --git a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php index 8f5195e926b..88fff5e6a5a 100644 --- a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php @@ -58,8 +58,8 @@ class AppleQuirksPlugin extends ServerPlugin { * This method handles HTTP REPORT requests. * * @param string $reportName - * @param mixed $report - * @param mixed $path + * @param mixed $report + * @param mixed $path * * @return bool */ diff --git a/apps/dav/lib/Connector/Sabre/CachingTree.php b/apps/dav/lib/Connector/Sabre/CachingTree.php index a715991fcf6..86e102677c1 100644 --- a/apps/dav/lib/Connector/Sabre/CachingTree.php +++ b/apps/dav/lib/Connector/Sabre/CachingTree.php @@ -27,7 +27,7 @@ class CachingTree extends Tree { // flushing the entire cache $path = trim($path, '/'); foreach ($this->cache as $nodePath => $node) { - $nodePath = (string) $nodePath; + $nodePath = (string)$nodePath; if ($path === '' || $nodePath == $path || str_starts_with($nodePath, $path . '/')) { unset($this->cache[$nodePath]); } diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index 71514016bda..f2da3782def 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -62,7 +62,7 @@ class CommentPropertiesPlugin extends ServerPlugin { $ids[] = (string)$id; } - $ids[] = (string) $directory->getId(); + $ids[] = (string)$directory->getId(); $unread = $this->commentsManager->getNumberOfUnreadCommentsForObjects('files', $ids, $this->userSession->getUser()); foreach ($unread as $id => $count) { diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php index 336930cf17d..7846896182f 100644 --- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php +++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php @@ -52,7 +52,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { } if ($this->getCurrentUserPrincipal() === $node->getOwner()) { - throw new Forbidden("Access denied"); + throw new Forbidden('Access denied'); } else { throw new NotFound( sprintf( diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 427ec59bc31..503acf8dae5 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -294,7 +294,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol } $relativePath = $this->fileView->getRelativePath($this->info->getPath()); if ($relativePath === null) { - $this->getLogger()->warning("error while getting quota as the relative path cannot be found"); + $this->getLogger()->warning('error while getting quota as the relative path cannot be found'); return [0, 0]; } @@ -311,13 +311,13 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol ]; return $this->quotaInfo; } catch (\OCP\Files\NotFoundException $e) { - $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning('error while getting quota into', ['exception' => $e]); return [0, 0]; } catch (\OCP\Files\StorageNotAvailableException $e) { - $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning('error while getting quota into', ['exception' => $e]); return [0, 0]; } catch (NotPermittedException $e) { - $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning('error while getting quota into', ['exception' => $e]); return [0, 0]; } } diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php index 5c39e6a437a..bad4bfa12ab 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php +++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php @@ -14,7 +14,7 @@ class FileLocked extends \Sabre\DAV\Exception { * @param string $message * @param int $code */ - public function __construct($message = "", $code = 0, ?Exception $previous = null) { + public function __construct($message = '', $code = 0, ?Exception $previous = null) { if ($previous instanceof \OCP\Files\LockNotAcquiredException) { $message = sprintf('Target file %s is locked by another process.', $previous->path); } diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index bca0d15709f..d4c996df145 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -167,7 +167,7 @@ class FilesPlugin extends ServerPlugin { } if (!$sourceNodeFileInfo->isDeletable()) { - throw new Forbidden($source . " cannot be deleted"); + throw new Forbidden($source . ' cannot be deleted'); } } } @@ -507,7 +507,7 @@ class FilesPlugin extends ServerPlugin { if (empty($time)) { return false; } - $node->setCreationTime((int) $time); + $node->setCreationTime((int)$time); return true; }); diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 0a978e099dc..52e84145b17 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -363,7 +363,7 @@ class FilesReportPlugin extends ServerPlugin { * Prepare propfind response for the given nodes * * @param string $filesUri $filesUri URI leading to root of the files URI, - * with a leading slash but no trailing slash + * with a leading slash but no trailing slash * @param string[] $requestedProps requested properties * @param Node[] nodes nodes for which to fetch and prepare responses * @return Response[] diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index 7ac5b476154..94098b4aca3 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -25,7 +25,7 @@ class ObjectTree extends CachingTree { protected $fileView; /** - * @var \OCP\Files\Mount\IMountManager + * @var \OCP\Files\Mount\IMountManager */ protected $mountManager; @@ -38,7 +38,7 @@ class ObjectTree extends CachingTree { /** * @param \Sabre\DAV\INode $rootNode * @param \OC\Files\View $view - * @param \OCP\Files\Mount\IMountManager $mountManager + * @param \OCP\Files\Mount\IMountManager $mountManager */ public function init(\Sabre\DAV\INode $rootNode, \OC\Files\View $view, \OCP\Files\Mount\IMountManager $mountManager) { $this->rootNode = $rootNode; diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index f09ff4def64..029061694ea 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -180,7 +180,7 @@ class Principal implements BackendInterface { } elseif ($prefix === 'principals/system') { return [ 'uri' => 'principals/system/' . $name, - '{DAV:}displayname' => $this->languageFactory->get('dav')->t("Accounts"), + '{DAV:}displayname' => $this->languageFactory->get('dav')->t('Accounts'), ]; } return null; diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index d7572c46ed3..3f5268f5137 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -117,7 +117,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { * * @param integer $fileId file id * @return array list($tags, $favorite) with $tags as tag array - * and $favorite is a boolean whether the file was favorited + * and $favorite is a boolean whether the file was favorited */ private function getTagsAndFav($fileId) { $isFav = false; diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index 678d0d47b28..cf4e24e8f1c 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -156,7 +156,7 @@ class InvitationResponseController extends Controller { } $currentTime = $this->timeFactory->getTime(); - if (((int) $row['expiration']) < $currentTime) { + if (((int)$row['expiration']) < $currentTime) { return null; } diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php index 2142bd04753..c2b4ada173a 100644 --- a/apps/dav/lib/DAV/PublicAuth.php +++ b/apps/dav/lib/DAV/PublicAuth.php @@ -53,9 +53,9 @@ class PublicAuth implements BackendInterface { */ public function check(RequestInterface $request, ResponseInterface $response) { if ($this->isRequestPublic($request)) { - return [true, "principals/system/public"]; + return [true, 'principals/system/public']; } - return [false, "No public access to this resource."]; + return [false, 'No public access to this resource.']; } /** diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index cbae9ec1a37..2e1a84b6bc8 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -136,7 +136,7 @@ abstract class Backend { 'href' => "principal:{$row['principaluri']}", 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', 'status' => 1, - 'readOnly' => (int) $row['access'] === Backend::ACCESS_READ, + 'readOnly' => (int)$row['access'] === Backend::ACCESS_READ, '{http://owncloud.org/ns}principal' => (string)$row['principaluri'], '{http://owncloud.org/ns}group-share' => isset($p['uri']) && str_starts_with($p['uri'], 'principals/groups') ]; @@ -162,7 +162,7 @@ abstract class Backend { 'href' => "principal:{$row['principaluri']}", 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', 'status' => 1, - 'readOnly' => (int) $row['access'] === self::ACCESS_READ, + 'readOnly' => (int)$row['access'] === self::ACCESS_READ, '{http://owncloud.org/ns}principal' => (string)$row['principaluri'], '{http://owncloud.org/ns}group-share' => isset($p['uri']) && str_starts_with($p['uri'], 'principals/groups') ]; diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index 98d6883e826..c228d6993c2 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -110,7 +110,7 @@ class Plugin extends ServerPlugin { $path = $request->getPath(); // Only handling xml - $contentType = (string) $request->getHeader('Content-Type'); + $contentType = (string)$request->getHeader('Content-Type'); if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) { return; } diff --git a/apps/dav/lib/DAV/ViewOnlyPlugin.php b/apps/dav/lib/DAV/ViewOnlyPlugin.php index b6139638aa5..d8c8649b4b7 100644 --- a/apps/dav/lib/DAV/ViewOnlyPlugin.php +++ b/apps/dav/lib/DAV/ViewOnlyPlugin.php @@ -73,7 +73,7 @@ class ViewOnlyPlugin extends ServerPlugin { $nodes = $this->userFolder->getById($node->getId()); $node = array_pop($nodes); if (!$node) { - throw new NotFoundException("Version file not accessible by current user"); + throw new NotFoundException('Version file not accessible by current user'); } } } else { diff --git a/apps/dav/lib/Db/Absence.php b/apps/dav/lib/Db/Absence.php index 550958aaabd..d7cd46087c3 100644 --- a/apps/dav/lib/Db/Absence.php +++ b/apps/dav/lib/Db/Absence.php @@ -63,7 +63,7 @@ class Absence extends Entity implements JsonSerializable { public function toOutOufOfficeData(IUser $user, string $timezone): IOutOfOfficeData { if ($user->getUID() !== $this->getUserId()) { - throw new InvalidArgumentException("The user doesn't match the user id of this absence! Expected " . $this->getUserId() . ", got " . $user->getUID()); + throw new InvalidArgumentException("The user doesn't match the user id of this absence! Expected " . $this->getUserId() . ', got ' . $user->getUID()); } if ($this->getId() === null) { throw new Exception('Creating out-of-office data without ID'); diff --git a/apps/dav/lib/Direct/DirectFile.php b/apps/dav/lib/Direct/DirectFile.php index 45d86fcaeae..3c684b83ef2 100644 --- a/apps/dav/lib/Direct/DirectFile.php +++ b/apps/dav/lib/Direct/DirectFile.php @@ -96,7 +96,7 @@ class DirectFile implements IFile { throw new NotFound(); } if (!$file instanceof File) { - throw new Forbidden("direct download not allowed on directories"); + throw new Forbidden('direct download not allowed on directories'); } $this->file = $file; diff --git a/apps/dav/lib/Events/CalendarDeletedEvent.php b/apps/dav/lib/Events/CalendarDeletedEvent.php index 20c4b187246..326af0702ad 100644 --- a/apps/dav/lib/Events/CalendarDeletedEvent.php +++ b/apps/dav/lib/Events/CalendarDeletedEvent.php @@ -24,7 +24,7 @@ class CalendarDeletedEvent extends Event { /** @var array */ private $calendarData; - /** @var array */ + /** @var array */ private $shares; /** diff --git a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php index 02ea0182e0a..b2eb8e1f018 100644 --- a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php +++ b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php @@ -21,7 +21,7 @@ class CalendarMovedToTrashEvent extends Event { /** @var array */ private $calendarData; - /** @var array */ + /** @var array */ private $shares; /** diff --git a/apps/dav/lib/Events/CalendarRestoredEvent.php b/apps/dav/lib/Events/CalendarRestoredEvent.php index a4ba75755e3..5ea754ef200 100644 --- a/apps/dav/lib/Events/CalendarRestoredEvent.php +++ b/apps/dav/lib/Events/CalendarRestoredEvent.php @@ -21,7 +21,7 @@ class CalendarRestoredEvent extends Event { /** @var array */ private $calendarData; - /** @var array */ + /** @var array */ private $shares; /** diff --git a/apps/dav/lib/Listener/CalendarShareUpdateListener.php b/apps/dav/lib/Listener/CalendarShareUpdateListener.php index c2ce058825e..51a8968cac1 100644 --- a/apps/dav/lib/Listener/CalendarShareUpdateListener.php +++ b/apps/dav/lib/Listener/CalendarShareUpdateListener.php @@ -34,7 +34,7 @@ class CalendarShareUpdateListener implements IEventListener { return; } - $this->logger->debug("Creating activity for Calendar having its shares updated"); + $this->logger->debug('Creating activity for Calendar having its shares updated'); $this->activityBackend->onCalendarUpdateShares( $event->getCalendarData(), diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php index 222554a3732..592a6f85bdc 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php @@ -56,7 +56,7 @@ class BuildCalendarSearchIndex implements IRepairStep { $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) ->from('calendarobjects'); $result = $query->execute(); - $maxId = (int) $result->fetchOne(); + $maxId = (int)$result->fetchOne(); $result->closeCursor(); $output->info('Add background job'); diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php index 251d79033f3..4c87e25c698 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php @@ -27,8 +27,8 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { } public function run($arguments) { - $offset = (int) $arguments['offset']; - $stopAt = (int) $arguments['stopAt']; + $offset = (int)$arguments['offset']; + $stopAt = (int)$arguments['stopAt']; $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); diff --git a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php index d3705ee1552..f9a12ecbfae 100644 --- a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php @@ -68,7 +68,7 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep { $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) ->from('calendarobjects'); $result = $query->execute(); - $maxId = (int) $result->fetchOne(); + $maxId = (int)$result->fetchOne(); $result->closeCursor(); $output->info('Add background job'); diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php index 53e6deba1ca..0122ed37b06 100644 --- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php +++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php @@ -96,7 +96,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { while ($row = $result->fetch()) { $username = $this->getPrincipal($row['principaluri']); if (!$this->userManager->userExists($username)) { - $this->orphanSubscriptionIds[] = (int) $row['id']; + $this->orphanSubscriptionIds[] = (int)$row['id']; } } $result->closeCursor(); diff --git a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php index 41ae4faf4c4..798fbad4018 100644 --- a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php +++ b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php @@ -71,7 +71,7 @@ class RemoveOrphanEventsAndContacts implements IRepairStep { $orphanItems = []; while ($row = $result->fetch()) { - $orphanItems[] = (int) $row['id']; + $orphanItems[] = (int)$row['id']; } $result->closeCursor(); diff --git a/apps/dav/lib/Migration/Version1004Date20170926103422.php b/apps/dav/lib/Migration/Version1004Date20170926103422.php index 3bd5ba144c0..38506b0fc5d 100644 --- a/apps/dav/lib/Migration/Version1004Date20170926103422.php +++ b/apps/dav/lib/Migration/Version1004Date20170926103422.php @@ -14,7 +14,7 @@ class Version1004Date20170926103422 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ protected function getColumnsByTable() { diff --git a/apps/dav/lib/Migration/Version1025Date20240308063933.php b/apps/dav/lib/Migration/Version1025Date20240308063933.php index 55ab387b69c..3a68760762b 100644 --- a/apps/dav/lib/Migration/Version1025Date20240308063933.php +++ b/apps/dav/lib/Migration/Version1025Date20240308063933.php @@ -57,7 +57,7 @@ class Version1025Date20240308063933 extends SimpleMigrationStep { // The threshold is higher than the default of \OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob // but small enough to fit into a cluster transaction size. // For a 50k users instance that would still keep 10 changes on average. - $limit = max(1, (int) $this->appConfig->getAppValue('totalNumberOfSyncTokensToKeep', '500000')); + $limit = max(1, (int)$this->appConfig->getAppValue('totalNumberOfSyncTokensToKeep', '500000')); foreach (['addressbookchanges', 'calendarchanges'] as $tableName) { $thresholdSelect = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/Search/ACalendarSearchProvider.php b/apps/dav/lib/Search/ACalendarSearchProvider.php index d0c164822a4..04e97f80cb1 100644 --- a/apps/dav/lib/Search/ACalendarSearchProvider.php +++ b/apps/dav/lib/Search/ACalendarSearchProvider.php @@ -64,7 +64,7 @@ abstract class ACalendarSearchProvider implements IProvider { $calendars = $this->backend->getCalendarsForUser($principalUri); $calendarsById = []; foreach ($calendars as $calendar) { - $calendarsById[(int) $calendar['id']] = $calendar; + $calendarsById[(int)$calendar['id']] = $calendar; } return $calendarsById; @@ -81,7 +81,7 @@ abstract class ACalendarSearchProvider implements IProvider { $subscriptions = $this->backend->getSubscriptionsForUser($principalUri); $subscriptionsById = []; foreach ($subscriptions as $subscription) { - $subscriptionsById[(int) $subscription['id']] = $subscription; + $subscriptionsById[(int)$subscription['id']] = $subscription; } return $subscriptionsById; diff --git a/apps/dav/lib/Search/ContactsSearchProvider.php b/apps/dav/lib/Search/ContactsSearchProvider.php index b0f6f1a044c..158c0d0813e 100644 --- a/apps/dav/lib/Search/ContactsSearchProvider.php +++ b/apps/dav/lib/Search/ContactsSearchProvider.php @@ -81,7 +81,7 @@ class ContactsSearchProvider implements IFilteringProvider { $addressBooks = $this->backend->getAddressBooksForUser($principalUri); $addressBooksById = []; foreach ($addressBooks as $addressBook) { - $addressBooksById[(int) $addressBook['id']] = $addressBook; + $addressBooksById[(int)$addressBook['id']] = $addressBook; } $searchResults = $this->backend->searchPrincipalUri( @@ -109,12 +109,12 @@ class ContactsSearchProvider implements IFilteringProvider { $title = (string)$vCard->FN; $subline = $this->generateSubline($vCard); - $resourceUrl = $this->getDeepLinkToContactsApp($addressBook['uri'], (string) $vCard->UID); + $resourceUrl = $this->getDeepLinkToContactsApp($addressBook['uri'], (string)$vCard->UID); $result = new SearchResultEntry($thumbnailUrl, $title, $subline, $resourceUrl, 'icon-contacts-dark', true); - $result->addAttribute("displayName", $title); - $result->addAttribute("email", $subline); - $result->addAttribute("phoneNumber", (string)$vCard->TEL); + $result->addAttribute('displayName', $title); + $result->addAttribute('email', $subline); + $result->addAttribute('phoneNumber', (string)$vCard->TEL); return $result; }, $searchResults); diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 6c9fe5167c5..4747635bd7e 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -164,7 +164,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering if ($dtStart instanceof DateTime) { $startDateTime = $dtStart->getDateTime()->format('U'); - $result->addAttribute("createdAt", $startDateTime); + $result->addAttribute('createdAt', $startDateTime); } return $result; diff --git a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php index 12a0ff00d3b..fbe393a7d97 100644 --- a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php @@ -82,8 +82,8 @@ class SystemTagsInUseCollection extends SimpleCollection { $tag = new SystemTag((string)$tagData['id'], $tagData['name'], (bool)$tagData['visibility'], (bool)$tagData['editable']); // read only, so we can submit the isAdmin parameter as false generally $node = new SystemTagNode($tag, $user, false, $this->systemTagManager); - $node->setNumberOfFiles((int) $tagData['number_files']); - $node->setReferenceFileId((int) $tagData['ref_file_id']); + $node->setNumberOfFiles((int)$tagData['number_files']); + $node->setReferenceFileId((int)$tagData['ref_file_id']); $children[] = $node; } return $children; diff --git a/apps/dav/lib/Upload/UploadFile.php b/apps/dav/lib/Upload/UploadFile.php index ae64760e0ce..742eda78d08 100644 --- a/apps/dav/lib/Upload/UploadFile.php +++ b/apps/dav/lib/Upload/UploadFile.php @@ -12,7 +12,7 @@ use OCA\DAV\Connector\Sabre\File; use Sabre\DAV\IFile; class UploadFile implements IFile { - /** @var File */ + /** @var File */ private $file; public function __construct(File $file) { diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index 70f92379fe2..a14d3bc5e1c 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -251,7 +251,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { $vCard->serialize(), ); } catch (Throwable $e) { - $output->writeln("Error creating contact \"" . ($vCard->FN ?? 'null') . "\" from \"$filename\", skipping…"); + $output->writeln('Error creating contact "' . ($vCard->FN ?? 'null') . "\" from \"$filename\", skipping…"); } } diff --git a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php index 9cd75445232..d08d0fd4496 100644 --- a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php @@ -32,7 +32,7 @@ class PruneOutdatedSyncTokensJobTest extends TestCase { /** @var IConfig|MockObject */ private $config; - /** @var LoggerInterface|MockObject*/ + /** @var LoggerInterface|MockObject */ private $logger; private PruneOutdatedSyncTokensJob $backgroundJob; diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php index e7de7d0a55e..89ef73ec134 100644 --- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php +++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php @@ -24,7 +24,7 @@ class EnablePluginTest extends TestCase { /** @var BirthdayService |\PHPUnit\Framework\MockObject\MockObject */ protected $birthdayService; - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ protected $user; /** @var \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin $plugin */ diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 1656996408e..ac4045ea757 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -733,7 +733,7 @@ EOS; 'last occurrence before unix epoch starts' => [0, 'lastOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.3.0//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:19110324\r\nDTEND;VALUE=DATE:19110325\r\nDTSTAMP:20200927T180638Z\r\nUID:asdfasdfasdf@google.com\r\nCREATED:20200626T181848Z\r\nDESCRIPTION:Very old event\r\nLAST-MODIFIED:20200922T192707Z\r\nSUMMARY:Some old event\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"], - 'first occurrence is found when not first VEVENT in group' => [(new DateTime('2020-09-01T110000', new DateTimeZone("America/Los_Angeles")))->getTimestamp(), 'firstOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.3.0//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20201013T110000\r\nDTEND;TZID=America/Los_Angeles:20201013T120000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nRECURRENCE-ID;TZID=America/Los_Angeles:20201013T110000\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200925T042014Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20200901T110000\r\nDTEND;TZID=America/Los_Angeles:20200901T120000\r\nRRULE:FREQ=WEEKLY;BYDAY=TU\r\nEXDATE;TZID=America/Los_Angeles:20200922T110000\r\nEXDATE;TZID=America/Los_Angeles:20200915T110000\r\nEXDATE;TZID=America/Los_Angeles:20200908T110000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200915T162810Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"], + 'first occurrence is found when not first VEVENT in group' => [(new DateTime('2020-09-01T110000', new DateTimeZone('America/Los_Angeles')))->getTimestamp(), 'firstOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.3.0//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20201013T110000\r\nDTEND;TZID=America/Los_Angeles:20201013T120000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nRECURRENCE-ID;TZID=America/Los_Angeles:20201013T110000\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200925T042014Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20200901T110000\r\nDTEND;TZID=America/Los_Angeles:20200901T120000\r\nRRULE:FREQ=WEEKLY;BYDAY=TU\r\nEXDATE;TZID=America/Los_Angeles:20200922T110000\r\nEXDATE;TZID=America/Los_Angeles:20200915T110000\r\nEXDATE;TZID=America/Los_Angeles:20200908T110000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200915T162810Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"], 'CLASS:PRIVATE' => [CalDavBackend::CLASSIFICATION_PRIVATE, 'classification', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//dmfs.org//mimedir.icalendar//EN\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nX-LIC-LOCATION:Europe/Berlin\r\nBEGIN:DAYLIGHT\r\nTZOFFSETFROM:+0100\r\nTZOFFSETTO:+0200\r\nTZNAME:CEST\r\nDTSTART:19700329T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\nEND:DAYLIGHT\r\nBEGIN:STANDARD\r\nTZOFFSETFROM:+0200\r\nTZOFFSETTO:+0100\r\nTZNAME:CET\r\nDTSTART:19701025T030000\r\nRRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nDTSTART;TZID=Europe/Berlin:20160419T130000\r\nSUMMARY:Test\r\nCLASS:PRIVATE\r\nTRANSP:OPAQUE\r\nSTATUS:CONFIRMED\r\nDTEND;TZID=Europe/Berlin:20160419T140000\r\nLAST-MODIFIED:20160419T074202Z\r\nDTSTAMP:20160419T074202Z\r\nCREATED:20160419T074202Z\r\nUID:2e468c48-7860-492e-bc52-92fa0daeeccf.1461051722310\r\nEND:VEVENT\r\nEND:VCALENDAR"], diff --git a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php index 85545854918..a0b2965f223 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php @@ -138,13 +138,13 @@ EOF; ->method('setCurrentPrincipal') ->with($this->calendar->getPrincipalURI()); - /** @var \Sabre\DAVACL\Plugin|MockObject $aclPlugin*/ + /** @var \Sabre\DAVACL\Plugin|MockObject $aclPlugin */ $aclPlugin = $this->createMock(\Sabre\DAVACL\Plugin::class); /** @var Plugin|MockObject $schedulingPlugin */ $schedulingPlugin = $this->createMock(Plugin::class); $iTipMessage = $this->getITipMessage($message); - $iTipMessage->recipient = "mailto:lewis@stardew-tent-living.com"; + $iTipMessage->recipient = 'mailto:lewis@stardew-tent-living.com'; $server = $this->createMock(Server::class); $server->expects($this->any()) diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index ace2f808615..a2854823cbc 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -25,7 +25,7 @@ class CalendarTest extends TestCase { /** @var IConfig */ protected $config; - /** @var MockObject|LoggerInterface */ + /** @var MockObject|LoggerInterface */ protected $logger; protected function setUp(): void { @@ -418,7 +418,7 @@ EOD; $l10n->expects($this->once()) ->method('t') ->with('Busy') - ->willReturn("Translated busy"); + ->willReturn('Translated busy'); } else { $l10n->expects($this->never()) ->method('t'); diff --git a/apps/dav/tests/unit/CalDAV/EventReaderTest.php b/apps/dav/tests/unit/CalDAV/EventReaderTest.php index 23f0172131d..3c94147efb4 100644 --- a/apps/dav/tests/unit/CalDAV/EventReaderTest.php +++ b/apps/dav/tests/unit/CalDAV/EventReaderTest.php @@ -16,17 +16,17 @@ use Test\TestCase; class EventReaderTest extends TestCase { - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1a; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1b; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1c; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1d; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar2; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar3; protected function setUp(): void { diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php index 04b99b70124..0609892c279 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php @@ -46,7 +46,7 @@ class PublicCalendarTest extends CalendarTest { ]; /** @var MockObject | IConfig $config */ $config = $this->createMock(IConfig::class); - /** @var MockObject | LoggerInterface $logger */ + /** @var MockObject | LoggerInterface $logger */ $logger = $this->createMock(LoggerInterface::class); $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger); $children = $c->getChildren(); @@ -134,7 +134,7 @@ EOD; ]; /** @var MockObject | IConfig $config */ $config = $this->createMock(IConfig::class); - /** @var MockObject | LoggerInterface $logger */ + /** @var MockObject | LoggerInterface $logger */ $logger = $this->createMock(LoggerInterface::class); $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php index 9900c77bf54..75b058c0b84 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php @@ -95,7 +95,7 @@ class BackendTest extends TestCase { $this->assertCount(4, $rows); - $this->reminderBackend->removeReminder((int) $rows[3]['id']); + $this->reminderBackend->removeReminder((int)$rows[3]['id']); $query = self::$realDatabase->getQueryBuilder(); $rows = $query->select('*') @@ -240,7 +240,7 @@ class BackendTest extends TestCase { $this->assertEquals($rows[3]['notification_date'], 123600); - $reminderId = (int) $rows[3]['id']; + $reminderId = (int)$rows[3]['id']; $newNotificationDate = 123700; $this->reminderBackend->updateReminder($reminderId, $newNotificationDate); @@ -252,7 +252,7 @@ class BackendTest extends TestCase { ->execute() ->fetch(); - $this->assertEquals((int) $row['notification_date'], 123700); + $this->assertEquals((int)$row['notification_date'], 123700); } diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index d4594291d88..198c8d97b12 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -35,13 +35,13 @@ class ReminderServiceTest extends TestCase { /** @var IUserManager|MockObject */ private $userManager; - /** @var IGroupManager|MockObject*/ + /** @var IGroupManager|MockObject */ private $groupManager; /** @var CalDavBackend|MockObject */ private $caldavBackend; - /** @var ITimeFactory|MockObject */ + /** @var ITimeFactory|MockObject */ private $timeFactory; /** @var IConfig|MockObject */ diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php index 667604f9b3e..ef5a0b17c6e 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php @@ -47,13 +47,13 @@ class IMipServiceTest extends TestCase { /** @var IMipService */ private $service; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1a; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1b; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar2; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar3; /** @var DateTime DateTime object that will be returned by DateTime() or DateTime('now') */ public static $datetimeNow; @@ -156,9 +156,9 @@ class IMipServiceTest extends TestCase { } public function testGetFrom(): void { - $senderName = "Detective McQueen"; - $default = "Twin Lakes Police Department - Darkside Division"; - $expected = "Detective McQueen via Twin Lakes Police Department - Darkside Division"; + $senderName = 'Detective McQueen'; + $default = 'Twin Lakes Police Department - Darkside Division'; + $expected = 'Detective McQueen via Twin Lakes Police Department - Darkside Division'; $this->l10n->expects(self::once()) ->method('t') diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 853094e4de2..aa2903b519f 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -41,7 +41,7 @@ class PluginTest extends TestCase { /** @var Server|MockObject */ private $server; - /** @var IConfig|MockObject */ + /** @var IConfig|MockObject */ private $config; /** @var LoggerInterface&MockObject */ @@ -347,10 +347,10 @@ class PluginTest extends TestCase { if (!$exists || $deleted) { if (!$hasExistingCalendars) { $calendarBackend->expects($this->once()) - ->method('createCalendar') - ->with($principalUri, $calendarUri, [ - '{DAV:}displayname' => $displayName, - ]); + ->method('createCalendar') + ->with($principalUri, $calendarUri, [ + '{DAV:}displayname' => $displayName, + ]); $calendarHomeObject->expects($this->once()) ->method('getCalDAVBackend') diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php index 20f61120af7..ee903a5e0fa 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php @@ -67,7 +67,7 @@ class ConnectionTest extends TestCase { ->willThrowException($localServerException); $this->logger->expects(self::once()) ->method('warning') - ->with("Subscription 42 was not refreshed because it violates local access rules", ['exception' => $localServerException]); + ->with('Subscription 42 was not refreshed because it violates local access rules', ['exception' => $localServerException]); $this->connection->queryWebcalFeed($subscription, $mutation); } diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php index ed140fd76ff..b9b05be4471 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php @@ -20,9 +20,9 @@ use Sabre\VObject\Recur\NoInstancesException; use Test\TestCase; class RefreshWebcalServiceTest extends TestCase { - private CalDavBackend | MockObject $caldavBackend; - private Connection | MockObject $connection; - private LoggerInterface | MockObject $logger; + private CalDavBackend|MockObject $caldavBackend; + private Connection|MockObject $connection; + private LoggerInterface|MockObject $logger; private ITimeFactory|MockObject $time; protected function setUp(): void { @@ -248,7 +248,7 @@ class RefreshWebcalServiceTest extends TestCase { $noInstanceException = new NoInstancesException("can't add calendar object"); $this->caldavBackend->expects(self::once()) - ->method("createCalendarObject") + ->method('createCalendarObject') ->willThrowException($noInstanceException); $this->logger->expects(self::once()) @@ -298,7 +298,7 @@ class RefreshWebcalServiceTest extends TestCase { $badRequestException = new BadRequest("can't add reach calendar url"); $this->caldavBackend->expects(self::once()) - ->method("createCalendarObject") + ->method('createCalendarObject') ->willThrowException($badRequestException); $this->logger->expects(self::once()) diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index fb12b5b0884..dff368b923c 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -17,22 +17,22 @@ use Sabre\VObject\Property\Text; use Test\TestCase; class AddressBookImplTest extends TestCase { - /** @var AddressBookImpl */ + /** @var AddressBookImpl */ private $addressBookImpl; - /** @var array */ + /** @var array */ private $addressBookInfo; - /** @var AddressBook | \PHPUnit\Framework\MockObject\MockObject */ + /** @var AddressBook | \PHPUnit\Framework\MockObject\MockObject */ private $addressBook; /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ private $urlGenerator; - /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject */ + /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject */ private $backend; - /** @var VCard | \PHPUnit\Framework\MockObject\MockObject */ + /** @var VCard | \PHPUnit\Framework\MockObject\MockObject */ private $vCard; protected function setUp(): void { diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 0e9aed1caaf..91d7cc5f49e 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -59,7 +59,7 @@ class CardDavBackendTest extends TestCase { /** @var IEventDispatcher|MockObject */ private $dispatcher; private Backend $sharingBackend; - /** @var IDBConnection */ + /** @var IDBConnection */ private $db; /** @var string */ @@ -237,8 +237,8 @@ class CardDavBackendTest extends TestCase { public function testCardOperations(): void { /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */ $backend = $this->getMockBuilder(CardDavBackend::class) - ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->dispatcher, $this->sharingBackend]) - ->onlyMethods(['updateProperties', 'purgeProperties'])->getMock(); + ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->dispatcher, $this->sharingBackend]) + ->onlyMethods(['updateProperties', 'purgeProperties'])->getMock(); // create a new address book $backend->createAddressBook(self::UNIT_TEST_USER, 'Example', []); @@ -662,16 +662,16 @@ class CardDavBackendTest extends TestCase { $query = $this->db->getQueryBuilder(); for ($i = 0; $i < 3; $i++) { $query->insert($this->dbCardsTable) - ->values( - [ - 'addressbookid' => $query->createNamedParameter(0), - 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri' . $i), - 'lastmodified' => $query->createNamedParameter(time()), - 'etag' => $query->createNamedParameter('etag' . $i), - 'size' => $query->createNamedParameter(120), - ] - ); + ->values( + [ + 'addressbookid' => $query->createNamedParameter(0), + 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri' . $i), + 'lastmodified' => $query->createNamedParameter(time()), + 'etag' => $query->createNamedParameter('etag' . $i), + 'size' => $query->createNamedParameter(120), + ] + ); $query->execute(); $vCardIds[] = $query->getLastInsertId(); } @@ -771,16 +771,16 @@ class CardDavBackendTest extends TestCase { public function testGetCardUri(): void { $query = $this->db->getQueryBuilder(); $query->insert($this->dbCardsTable) - ->values( - [ - 'addressbookid' => $query->createNamedParameter(1), - 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri'), - 'lastmodified' => $query->createNamedParameter(5489543), - 'etag' => $query->createNamedParameter('etag'), - 'size' => $query->createNamedParameter(120), - ] - ); + ->values( + [ + 'addressbookid' => $query->createNamedParameter(1), + 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri'), + 'lastmodified' => $query->createNamedParameter(5489543), + 'etag' => $query->createNamedParameter('etag'), + 'size' => $query->createNamedParameter(120), + ] + ); $query->execute(); $id = $query->getLastInsertId(); @@ -799,16 +799,16 @@ class CardDavBackendTest extends TestCase { $query = $this->db->getQueryBuilder(); for ($i = 0; $i < 2; $i++) { $query->insert($this->dbCardsTable) - ->values( - [ - 'addressbookid' => $query->createNamedParameter($i), - 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri' . $i), - 'lastmodified' => $query->createNamedParameter(5489543), - 'etag' => $query->createNamedParameter('etag' . $i), - 'size' => $query->createNamedParameter(120), - ] - ); + ->values( + [ + 'addressbookid' => $query->createNamedParameter($i), + 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri' . $i), + 'lastmodified' => $query->createNamedParameter(5489543), + 'etag' => $query->createNamedParameter('etag' . $i), + 'size' => $query->createNamedParameter(120), + ] + ); $query->execute(); } @@ -842,7 +842,7 @@ class CardDavBackendTest extends TestCase { 'preferred' => $query->createNamedParameter(0) ] ) - ->execute(); + ->execute(); $result = $this->backend->collectCardProperties(666, 'FN'); $this->assertEquals(['John Doe'], $result); diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index df6489d5053..c29e0db5070 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -104,7 +104,7 @@ class ConverterTest extends TestCase { } public function testManagerProp(): void { - $user = $this->getUserMock("user", "user@domain.tld", "user@cloud.domain.tld"); + $user = $this->getUserMock('user', 'user@domain.tld', 'user@cloud.domain.tld'); $user->method('getManagerUids') ->willReturn(['mgr']); $this->userManager->expects(self::once()) @@ -168,8 +168,8 @@ class ConverterTest extends TestCase { 'fn' => 'Dr. Foo Bar', 'photo' => 'MTIzNDU2Nzg5', ], - "Dr. Foo Bar", - "foo@bar.net", + 'Dr. Foo Bar', + 'foo@bar.net', 'foo@cloud.net' ], [ @@ -178,9 +178,9 @@ class ConverterTest extends TestCase { 'fn' => 'Dr. Foo Bar', 'photo' => 'MTIzNDU2Nzg5', ], - "Dr. Foo Bar", + 'Dr. Foo Bar', null, - "foo@cloud.net" + 'foo@cloud.net' ], [ [ diff --git a/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php b/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php index a1c614cb69d..806c71759f8 100644 --- a/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php @@ -150,7 +150,7 @@ VCF; ->with(123, 'user.vcf') ->willReturn($originalCard); - $card = $this->addressBook->getChild("user.vcf"); + $card = $this->addressBook->getChild('user.vcf'); /** @var VCard $vCard */ $vCard = Reader::read($card->get()); @@ -180,7 +180,7 @@ VCF; ]); $this->expectException(NotFound::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetChildWithoutEnumeration(): void { @@ -193,7 +193,7 @@ VCF; ]); $this->expectException(Forbidden::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetChildAsGuest(): void { @@ -211,7 +211,7 @@ VCF; ->willReturn($user); $this->expectException(Forbidden::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetChildWithGroupEnumerationRestriction(): void { @@ -272,7 +272,7 @@ VCF; ->willReturn($user); $this->expectException(Forbidden::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetOwnChildWithPhoneNumberEnumerationRestriction(): void { @@ -305,7 +305,7 @@ VCF; 'carddata' => $cardData, ]); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetMultipleChildrenWithGroupEnumerationRestriction(): void { diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index 30df9ee79dc..2640b4d966b 100644 --- a/apps/dav/tests/unit/Command/ListCalendarsTest.php +++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php @@ -54,7 +54,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertStringContainsString("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay()); + $this->assertStringContainsString('User <' . self::USERNAME . '> in unknown', $commandTester->getDisplay()); } public function testWithCorrectUserWithNoCalendars(): void { @@ -72,7 +72,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertStringContainsString("User <" . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); + $this->assertStringContainsString('User <' . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); } public function dataExecute() { diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php index 09831fdb1b2..892b00968f9 100644 --- a/apps/dav/tests/unit/Command/MoveCalendarTest.php +++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php @@ -194,7 +194,7 @@ class MoveCalendarTest extends TestCase { 'destinationuid' => 'user2', ]); - $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString('[OK] Calendar <personal> was moved from user <user> to <user2>', $commandTester->getDisplay()); } public function dataTestMoveWithDestinationNotPartOfGroup(): array { @@ -240,7 +240,7 @@ class MoveCalendarTest extends TestCase { ]); if ($shareWithGroupMembersOnly === true) { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("User <user2> is not part of the group <nextclouders> with whom the calendar <personal> was shared. You may use -f to move the calendar while deleting this share."); + $this->expectExceptionMessage('User <user2> is not part of the group <nextclouders> with whom the calendar <personal> was shared. You may use -f to move the calendar while deleting this share.'); } $commandTester = new CommandTester($this->command); @@ -294,7 +294,7 @@ class MoveCalendarTest extends TestCase { 'destinationuid' => 'user2', ]); - $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString('[OK] Calendar <personal> was moved from user <user> to <user2>', $commandTester->getDisplay()); } public function testMoveWithDestinationNotPartOfGroupAndForce(): void { @@ -342,7 +342,7 @@ class MoveCalendarTest extends TestCase { '--force' => true ]); - $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString('[OK] Calendar <personal> was moved from user <user> to <user2>', $commandTester->getDisplay()); } public function dataTestMoveWithCalendarAlreadySharedToDestination(): array { @@ -380,17 +380,17 @@ class MoveCalendarTest extends TestCase { ); $this->calDav->expects($this->once())->method('getShares') - ->with(1234) - ->willReturn([ - [ - 'href' => 'principal:principals/users/user2', - '{DAV:}displayname' => 'Personal' - ] - ]); + ->with(1234) + ->willReturn([ + [ + 'href' => 'principal:principals/users/user2', + '{DAV:}displayname' => 'Personal' + ] + ]); if ($force === false) { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("The calendar <personal> is already shared to user <user2>.You may use -f to move the calendar while deleting this share."); + $this->expectExceptionMessage('The calendar <personal> is already shared to user <user2>.You may use -f to move the calendar while deleting this share.'); } else { $this->calDav->expects($this->once())->method('updateShares'); } diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index d2bb60af4b2..c253c59df0f 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -19,7 +19,7 @@ use Sabre\DAV\PropPatch; class CommentsNodeTest extends \Test\TestCase { - /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ protected $commentsManager; protected $comment; diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php index 60c3e52ef54..5ca0cedf04b 100644 --- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php +++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php @@ -29,7 +29,7 @@ class CommentsPluginTest extends \Test\TestCase { /** @var ICommentsManager */ private $commentsManager; - /** @var IUserSession */ + /** @var IUserSession */ private $userSession; /** @var CommentsPluginImplementation */ diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index dccb1edd0ae..de258c9aaec 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -221,11 +221,11 @@ class AuthTest extends TestCase { public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet(): void { $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $this->userSession ->expects($this->any()) ->method('isLoggedIn') diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index c2167214451..1cda0e4dbdb 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -16,7 +16,7 @@ use Sabre\DAV\PropFind; class CommentsPropertiesPluginTest extends \Test\TestCase { - /** @var CommentPropertiesPluginImplementation */ + /** @var CommentPropertiesPluginImplementation */ protected $plugin; protected $commentsManager; protected $userSession; diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index d2be66c13f5..fb180b7c65d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -72,9 +72,9 @@ class DirectoryTest extends \Test\TestCase { $this->info->method('getType') ->willReturn(Node::TYPE_FOLDER); $this->info->method('getName') - ->willReturn("folder"); + ->willReturn('folder'); $this->info->method('getPath') - ->willReturn("/admin/files/folder"); + ->willReturn('/admin/files/folder'); $this->info->method('getPermissions') ->willReturn(Constants::PERMISSION_READ); } diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index 74f90507bb3..c7fb6066ed4 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -20,7 +20,7 @@ class ForbiddenTest extends \Test\TestCase { $DOM->appendChild($error); // serialize the exception - $message = "1234567890"; + $message = '1234567890'; $retry = false; $expectedXml = <<<EOD <?xml version="1.0" encoding="utf-8"?> diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index 3da0c41b7b3..98921d735fa 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -20,7 +20,7 @@ class InvalidPathTest extends \Test\TestCase { $DOM->appendChild($error); // serialize the exception - $message = "1234567890"; + $message = '1234567890'; $retry = false; $expectedXml = <<<EOD <?xml version="1.0" encoding="utf-8"?> diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php index 40ebc69e42d..18165b79cb2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php @@ -160,11 +160,11 @@ class FakeLockerPluginTest extends TestCase { ->getMock(); $response->expects($this->once()) - ->method('setStatus') - ->with('204'); + ->method('setStatus') + ->with('204'); $response->expects($this->once()) - ->method('setHeader') - ->with('Content-Length', '0'); + ->method('setHeader') + ->with('Content-Length', '0'); $this->assertSame(false, $this->fakeLockerPlugin->fakeUnlockProvider($request, $response)); } diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index d099a431184..6f9a214fab9 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -264,51 +264,51 @@ class FileTest extends TestCase { public function legalMtimeProvider() { return [ - "string" => [ - 'HTTP_X_OC_MTIME' => "string", + 'string' => [ + 'HTTP_X_OC_MTIME' => 'string', 'expected result' => null ], - "castable string (int)" => [ - 'HTTP_X_OC_MTIME' => "987654321", + 'castable string (int)' => [ + 'HTTP_X_OC_MTIME' => '987654321', 'expected result' => 987654321 ], - "castable string (float)" => [ - 'HTTP_X_OC_MTIME' => "123456789.56", + 'castable string (float)' => [ + 'HTTP_X_OC_MTIME' => '123456789.56', 'expected result' => 123456789 ], - "float" => [ + 'float' => [ 'HTTP_X_OC_MTIME' => 123456789.56, 'expected result' => 123456789 ], - "zero" => [ + 'zero' => [ 'HTTP_X_OC_MTIME' => 0, 'expected result' => null ], - "zero string" => [ - 'HTTP_X_OC_MTIME' => "0", + 'zero string' => [ + 'HTTP_X_OC_MTIME' => '0', 'expected result' => null ], - "negative zero string" => [ - 'HTTP_X_OC_MTIME' => "-0", + 'negative zero string' => [ + 'HTTP_X_OC_MTIME' => '-0', 'expected result' => null ], - "string starting with number following by char" => [ - 'HTTP_X_OC_MTIME' => "2345asdf", + 'string starting with number following by char' => [ + 'HTTP_X_OC_MTIME' => '2345asdf', 'expected result' => null ], - "string castable hex int" => [ - 'HTTP_X_OC_MTIME' => "0x45adf", + 'string castable hex int' => [ + 'HTTP_X_OC_MTIME' => '0x45adf', 'expected result' => null ], - "string that looks like invalid hex int" => [ - 'HTTP_X_OC_MTIME' => "0x123g", + 'string that looks like invalid hex int' => [ + 'HTTP_X_OC_MTIME' => '0x123g', 'expected result' => null ], - "negative int" => [ + 'negative int' => [ 'HTTP_X_OC_MTIME' => -34, 'expected result' => null ], - "negative float" => [ + 'negative float' => [ 'HTTP_X_OC_MTIME' => -34.43, 'expected result' => null ], @@ -905,10 +905,10 @@ class FileTest extends TestCase { $userView = Filesystem::getView(); } return [ - "filesize" => $userView->filesize($path), - "mtime" => $userView->filemtime($path), - "filetype" => $userView->filetype($path), - "mimetype" => $userView->getMimeType($path) + 'filesize' => $userView->filesize($path), + 'mtime' => $userView->filemtime($path), + 'filetype' => $userView->filetype($path), + 'mimetype' => $userView->getMimeType($path) ]; } diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index f1460591a91..144b8af7659 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -99,8 +99,8 @@ class FilesPluginTest extends TestCase { ); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $this->server->httpResponse = $response; $this->server->xml = new Service(); @@ -536,8 +536,8 @@ class FilesPluginTest extends TestCase { ->disableOriginalConstructor() ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request ->expects($this->once()) @@ -595,6 +595,6 @@ class FilesPluginTest extends TestCase { $node ); - $this->assertEquals("false", $propFind->get(self::HAS_PREVIEW_PROPERTYNAME)); + $this->assertEquals('false', $propFind->get(self::HAS_PREVIEW_PROPERTYNAME)); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index 97f21572945..95fd79fa5f1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -49,19 +49,19 @@ class FilesReportPluginTest extends \Test\TestCase { private ITagManager|MockObject $privateTagManager; - /** @var \OCP\IUserSession */ + /** @var \OCP\IUserSession */ private $userSession; /** @var FilesReportPluginImplementation */ private $plugin; - /** @var View|MockObject **/ + /** @var View|MockObject * */ private $view; - /** @var IGroupManager|MockObject **/ + /** @var IGroupManager|MockObject * */ private $groupManager; - /** @var Folder|MockObject **/ + /** @var Folder|MockObject * */ private $userFolder; /** @var IPreview|MockObject * */ diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php index 28c22202c1e..9ecc49222e9 100644 --- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php @@ -20,7 +20,7 @@ use Test\TestCase; class MaintenancePluginTest extends TestCase { /** @var IConfig */ private $config; - /** @var \PHPUnit\Framework\MockObject\Builder\InvocationMocker|\PHPUnit_Framework_MockObject_Builder_InvocationMocker|IL10N */ + /** @var \PHPUnit\Framework\MockObject\Builder\InvocationMocker|\PHPUnit_Framework_MockObject_Builder_InvocationMocker|IL10N */ private $l10n; /** @var MaintenancePlugin */ private $maintenancePlugin; diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index f0996a17a33..5010f7698b5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -73,7 +73,7 @@ class ObjectTreeTest extends \Test\TestCase { ->with($this->identicalTo($sourcePath)) ->willReturn(false); - /** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */ + /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */ $mountManager = Filesystem::getMountManager(); $objectTree->init($rootDir, $view, $mountManager); $objectTree->copy($sourcePath, $targetPath); @@ -114,7 +114,7 @@ class ObjectTreeTest extends \Test\TestCase { $objectTree->expects($this->never()) ->method('getNodeForPath'); - /** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */ + /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */ $mountManager = Filesystem::getMountManager(); $objectTree->init($rootDir, $view, $mountManager); $objectTree->copy($sourcePath, $targetPath); diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 03910f32095..30e2c995d18 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -96,26 +96,26 @@ class PrincipalTest extends TestCase { public function testGetPrincipalsByPrefixWithUsers(): void { $fooUser = $this->createMock(User::class); $fooUser - ->expects($this->once()) - ->method('getUID') - ->willReturn('foo'); + ->expects($this->once()) + ->method('getUID') + ->willReturn('foo'); $fooUser - ->expects($this->once()) - ->method('getDisplayName') - ->willReturn('Dr. Foo-Bar'); + ->expects($this->once()) + ->method('getDisplayName') + ->willReturn('Dr. Foo-Bar'); $fooUser - ->expects($this->once()) - ->method('getSystemEMailAddress') - ->willReturn(''); + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn(''); $barUser = $this->createMock(User::class); $barUser ->expects($this->once()) ->method('getUID') ->willReturn('bar'); $barUser - ->expects($this->once()) - ->method('getSystemEMailAddress') - ->willReturn('bar@nextcloud.com'); + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn('bar@nextcloud.com'); $this->userManager ->expects($this->once()) ->method('search') @@ -229,13 +229,13 @@ class PrincipalTest extends TestCase { public function testGetPrincipalsByPathWithMail(): void { $fooUser = $this->createMock(User::class); $fooUser - ->expects($this->once()) - ->method('getSystemEMailAddress') - ->willReturn('foo@nextcloud.com'); + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn('foo@nextcloud.com'); $fooUser - ->expects($this->once()) - ->method('getUID') - ->willReturn('foo'); + ->expects($this->once()) + ->method('getUID') + ->willReturn('foo'); $this->userManager ->expects($this->once()) ->method('get') @@ -851,13 +851,13 @@ class PrincipalTest extends TestCase { ->willReturn(true); $this->shareManager->expects($this->once()) - ->method('shareWithGroupMembersOnly') - ->willReturn(true); + ->method('shareWithGroupMembersOnly') + ->willReturn(true); $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) - ->method('getUser') - ->willReturn($user); + ->method('getUser') + ->willReturn($user); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); @@ -865,9 +865,9 @@ class PrincipalTest extends TestCase { $user3->method('getUID')->willReturn('user3'); $this->userManager->expects($this->once()) - ->method('getByEmail') - ->with($email) - ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); + ->method('getByEmail') + ->with($email) + ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); if ($email === 'user2@foo.bar') { $this->groupManager->expects($this->exactly(2)) @@ -912,8 +912,8 @@ class PrincipalTest extends TestCase { ->willReturn(true); $this->shareManager->expects($this->once()) - ->method('shareWithGroupMembersOnly') - ->willReturn(false); + ->method('shareWithGroupMembersOnly') + ->willReturn(false); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); @@ -921,9 +921,9 @@ class PrincipalTest extends TestCase { $user3->method('getUID')->willReturn('user3'); $this->userManager->expects($this->once()) - ->method('getByEmail') - ->with($email) - ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); + ->method('getByEmail') + ->with($email) + ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); $this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users')); } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php index bed5eb192d9..cf1ea4c6bae 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php @@ -72,7 +72,7 @@ class Auth implements BackendInterface { \OC::$server->getUserFolder($user); return [true, "principals/$user"]; } - return [false, "login failed"]; + return [false, 'login failed']; } /** diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 3c527e24363..6fc87437fe0 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -33,7 +33,7 @@ class CustomPropertiesBackendTest extends TestCase { /** @var Tree | \PHPUnit\Framework\MockObject\MockObject */ private $tree; - /** @var IDBConnection */ + /** @var IDBConnection */ private $dbConnection; /** @var IUser | \PHPUnit\Framework\MockObject\MockObject */ @@ -395,7 +395,7 @@ class CustomPropertiesBackendTest extends TestCase { $this->defaultCalendarValidator->expects(self::once()) ->method('validateScheduleDefaultCalendar') ->with($node) - ->willThrowException(new \Sabre\DAV\Exception("Invalid calendar")); + ->willThrowException(new \Sabre\DAV\Exception('Invalid calendar')); $this->server->method('calculateUri') ->willReturnCallback(function ($uri) { diff --git a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php index eb15bfe0b5a..7a4828dd2de 100644 --- a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php +++ b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php @@ -132,9 +132,9 @@ class ViewOnlyPluginTest extends TestCase { $this->request->expects($this->once())->method('getPath')->willReturn($davPath); $this->tree->expects($this->once()) - ->method('getNodeForPath') - ->with($davPath) - ->willReturn($davNode); + ->method('getNodeForPath') + ->with($davPath) + ->willReturn($davNode); $storage = $this->createMock(SharedStorage::class); $share = $this->createMock(IShare::class); @@ -147,9 +147,9 @@ class ViewOnlyPluginTest extends TestCase { $extAttr = $this->createMock(IAttributes::class); $share->method('getAttributes')->willReturn($extAttr); $extAttr->expects($this->once()) - ->method('getAttribute') - ->with('permissions', 'download') - ->willReturn($attrEnabled); + ->method('getAttribute') + ->with('permissions', 'download') + ->willReturn($attrEnabled); if (!$expectCanDownloadFile) { $this->expectException(Forbidden::class); diff --git a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php index 3458708b23b..ebe2a0b172e 100644 --- a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php +++ b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php @@ -21,17 +21,17 @@ class MultipartRequestParserTest extends TestCase { private function getValidBodyObject() { return [ [ - "headers" => [ - "Content-Length" => 7, - "X-File-MD5" => "4f2377b4d911f7ec46325fe603c3af03", - "X-File-Path" => "/coucou.txt" + 'headers' => [ + 'Content-Length' => 7, + 'X-File-MD5' => '4f2377b4d911f7ec46325fe603c3af03', + 'X-File-Path' => '/coucou.txt' ], - "content" => "Coucou\n" + 'content' => "Coucou\n" ] ]; } - private function getMultipartParser(array $parts, array $headers = [], string $boundary = "boundary_azertyuiop"): MultipartRequestParser { + private function getMultipartParser(array $parts, array $headers = [], string $boundary = 'boundary_azertyuiop'): MultipartRequestParser { $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') ->disableOriginalConstructor() ->getMock(); @@ -43,19 +43,19 @@ class MultipartRequestParserTest extends TestCase { return $headers[$key]; }); - $body = ""; + $body = ''; foreach ($parts as $part) { $body .= '--'.$boundary."\r\n"; foreach ($part['headers'] as $headerKey => $headerPart) { - $body .= $headerKey.": ".$headerPart."\r\n"; + $body .= $headerKey.': '.$headerPart."\r\n"; } $body .= "\r\n"; $body .= $part['content']."\r\n"; } - $body .= '--'.$boundary."--"; + $body .= '--'.$boundary.'--'; $stream = fopen('php://temp', 'r+'); fwrite($stream, $body); @@ -73,7 +73,7 @@ class MultipartRequestParserTest extends TestCase { * Test validation of the request's body type */ public function testBodyTypeValidation(): void { - $bodyStream = "I am not a stream, but pretend to be"; + $bodyStream = 'I am not a stream, but pretend to be'; $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') ->disableOriginalConstructor() ->getMock(); @@ -100,11 +100,11 @@ class MultipartRequestParserTest extends TestCase { [$headers, $content] = $multipartParser->parseNextPart(); - $this->assertSame((int)$headers["content-length"], 7, "Content-Length header should be the same as provided."); - $this->assertSame($headers["x-file-md5"], "4f2377b4d911f7ec46325fe603c3af03", "X-File-MD5 header should be the same as provided."); - $this->assertSame($headers["x-file-path"], "/coucou.txt", "X-File-Path header should be the same as provided."); + $this->assertSame((int)$headers['content-length'], 7, 'Content-Length header should be the same as provided.'); + $this->assertSame($headers['x-file-md5'], '4f2377b4d911f7ec46325fe603c3af03', 'X-File-MD5 header should be the same as provided.'); + $this->assertSame($headers['x-file-path'], '/coucou.txt', 'X-File-Path header should be the same as provided.'); - $this->assertSame($content, "Coucou\n", "Content should be the same"); + $this->assertSame($content, "Coucou\n", 'Content should be the same'); } /** @@ -112,7 +112,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testInvalidMd5Hash(): void { $bodyObject = $this->getValidBodyObject(); - $bodyObject["0"]["headers"]["X-File-MD5"] = "f2377b4d911f7ec46325fe603c3af03"; + $bodyObject['0']['headers']['X-File-MD5'] = 'f2377b4d911f7ec46325fe603c3af03'; $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -126,7 +126,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testNullMd5Hash(): void { $bodyObject = $this->getValidBodyObject(); - unset($bodyObject["0"]["headers"]["X-File-MD5"]); + unset($bodyObject['0']['headers']['X-File-MD5']); $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -140,7 +140,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testNullContentLength(): void { $bodyObject = $this->getValidBodyObject(); - unset($bodyObject["0"]["headers"]["Content-Length"]); + unset($bodyObject['0']['headers']['Content-Length']); $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -154,7 +154,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testLowerContentLength(): void { $bodyObject = $this->getValidBodyObject(); - $bodyObject["0"]["headers"]["Content-Length"] = 6; + $bodyObject['0']['headers']['Content-Length'] = 6; $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -168,7 +168,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testHigherContentLength(): void { $bodyObject = $this->getValidBodyObject(); - $bodyObject["0"]["headers"]["Content-Length"] = 8; + $bodyObject['0']['headers']['Content-Length'] = 8; $multipartParser = $this->getMultipartParser( $bodyObject ); diff --git a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php index ed497d006e1..9f2d2582884 100644 --- a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php +++ b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php @@ -42,14 +42,14 @@ class CalDAVSettingsTest extends TestCase { public function testGetForm(): void { $this->config->method('getAppValue') - ->withConsecutive( - ['dav', 'sendInvitations', 'yes'], - ['dav', 'generateBirthdayCalendar', 'yes'], - ['dav', 'sendEventReminders', 'yes'], - ['dav', 'sendEventRemindersToSharedUsers', 'yes'], - ['dav', 'sendEventRemindersPush', 'yes'], - ) - ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes')); + ->withConsecutive( + ['dav', 'sendInvitations', 'yes'], + ['dav', 'generateBirthdayCalendar', 'yes'], + ['dav', 'sendEventReminders', 'yes'], + ['dav', 'sendEventRemindersToSharedUsers', 'yes'], + ['dav', 'sendEventRemindersPush', 'yes'], + ) + ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes')); $this->urlGenerator ->expects($this->once()) ->method('linkToDocs') diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index 51711fc1666..67e7afa9c54 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -543,11 +543,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->willReturn($node); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') @@ -617,11 +617,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->with(1); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') @@ -666,11 +666,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->method('createFile'); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') @@ -714,11 +714,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->willReturn($node); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index 6c380fa3191..89ae0bc1fea 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -55,7 +55,7 @@ class AssemblyStreamTest extends \Test\TestCase { $dataLess8k = $this->makeData(8191); $tonofnodes = []; - $tonofdata = ""; + $tonofdata = ''; for ($i = 0; $i < 101; $i++) { $thisdata = rand(0, 100); // variable length and content $tonofdata .= $thisdata; |