diff options
author | Kate <26026535+provokateurin@users.noreply.github.com> | 2024-10-22 12:47:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-22 12:47:45 +0200 |
commit | 070adc1131fcd5476e4a93ebf28be6f409c5a992 (patch) | |
tree | 1e8e2238a22d544c370f1ac804426ed675c5eacf /apps/dav/lib | |
parent | 582af10e0be1b22ebde0429b756f62107d8e8083 (diff) | |
parent | e8426996f59ab6dbf0c94adee8f410cbd572b11a (diff) | |
download | nextcloud-server-070adc1131fcd5476e4a93ebf28be6f409c5a992.tar.gz nextcloud-server-070adc1131fcd5476e4a93ebf28be6f409c5a992.zip |
Merge pull request #48790 from nextcloud/refactor/apps/constructor-property-promotion
Diffstat (limited to 'apps/dav/lib')
186 files changed, 976 insertions, 2458 deletions
diff --git a/apps/dav/lib/AppInfo/PluginManager.php b/apps/dav/lib/AppInfo/PluginManager.php index 43fd16ebeb6..fc1cc18a09d 100644 --- a/apps/dav/lib/AppInfo/PluginManager.php +++ b/apps/dav/lib/AppInfo/PluginManager.php @@ -28,16 +28,6 @@ use function is_array; class PluginManager { /** - * @var ServerContainer - */ - private $container; - - /** - * @var IAppManager - */ - private $appManager; - - /** * App plugins * * @var ServerPlugin[] @@ -74,9 +64,10 @@ class PluginManager { * @param ServerContainer $container server container for resolving plugin classes * @param IAppManager $appManager app manager to loading apps and their info */ - public function __construct(ServerContainer $container, IAppManager $appManager) { - $this->container = $container; - $this->appManager = $appManager; + public function __construct( + private ServerContainer $container, + private IAppManager $appManager, + ) { } /** diff --git a/apps/dav/lib/Avatars/AvatarHome.php b/apps/dav/lib/Avatars/AvatarHome.php index 1f86941e592..c3b95db1f4f 100644 --- a/apps/dav/lib/Avatars/AvatarHome.php +++ b/apps/dav/lib/Avatars/AvatarHome.php @@ -16,20 +16,16 @@ use Sabre\Uri; class AvatarHome implements ICollection { - /** @var array */ - private $principalInfo; - /** @var IAvatarManager */ - private $avatarManager; - /** * AvatarHome constructor. * * @param array $principalInfo * @param IAvatarManager $avatarManager */ - public function __construct($principalInfo, IAvatarManager $avatarManager) { - $this->principalInfo = $principalInfo; - $this->avatarManager = $avatarManager; + public function __construct( + private $principalInfo, + private IAvatarManager $avatarManager, + ) { } public function createFile($name, $data = null) { diff --git a/apps/dav/lib/Avatars/AvatarNode.php b/apps/dav/lib/Avatars/AvatarNode.php index 3931ce3ff71..b3a605fbb02 100644 --- a/apps/dav/lib/Avatars/AvatarNode.php +++ b/apps/dav/lib/Avatars/AvatarNode.php @@ -11,10 +11,6 @@ use OCP\IAvatar; use Sabre\DAV\File; class AvatarNode extends File { - private $ext; - private $size; - private $avatar; - /** * AvatarNode constructor. * @@ -22,10 +18,11 @@ class AvatarNode extends File { * @param string $ext * @param IAvatar $avatar */ - public function __construct($size, $ext, $avatar) { - $this->size = $size; - $this->ext = $ext; - $this->avatar = $avatar; + public function __construct( + private $size, + private $ext, + private $avatar, + ) { } /** @@ -72,10 +69,6 @@ class AvatarNode extends File { } public function getLastModified() { - $timestamp = $this->avatar->getFile($this->size)->getMTime(); - if (!empty($timestamp)) { - return (int)$timestamp; - } - return $timestamp; + return $this->avatar->getFile($this->size)->getMTime(); } } diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index abf12f7d587..1165367c33f 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -22,33 +22,20 @@ use Psr\Log\LoggerInterface; */ class BuildReminderIndexBackgroundJob extends QueuedJob { - /** @var IDBConnection */ - private $db; - - /** @var ReminderService */ - private $reminderService; - - private LoggerInterface $logger; - - /** @var IJobList */ - private $jobList; - /** @var ITimeFactory */ private $timeFactory; /** * BuildReminderIndexBackgroundJob constructor. */ - public function __construct(IDBConnection $db, - ReminderService $reminderService, - LoggerInterface $logger, - IJobList $jobList, - ITimeFactory $timeFactory) { + public function __construct( + private IDBConnection $db, + private ReminderService $reminderService, + private LoggerInterface $logger, + private IJobList $jobList, + ITimeFactory $timeFactory, + ) { parent::__construct($timeFactory); - $this->db = $db; - $this->reminderService = $reminderService; - $this->logger = $logger; - $this->jobList = $jobList; $this->timeFactory = $timeFactory; } diff --git a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php index 2de9c6d00ee..c6edac4f228 100644 --- a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php +++ b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php @@ -13,13 +13,11 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; class CalendarRetentionJob extends TimedJob { - /** @var RetentionService */ - private $service; - - public function __construct(ITimeFactory $time, - RetentionService $service) { + public function __construct( + ITimeFactory $time, + private RetentionService $service, + ) { parent::__construct($time); - $this->service = $service; // Run four times a day $this->setInterval(6 * 60 * 60); diff --git a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php index 8895159d6ad..49b6b1607ef 100644 --- a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php @@ -13,12 +13,11 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; class CleanupDirectLinksJob extends TimedJob { - /** @var DirectMapper */ - private $mapper; - - public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) { + public function __construct( + ITimeFactory $timeFactory, + private DirectMapper $mapper, + ) { parent::__construct($timeFactory); - $this->mapper = $mapper; // Run once a day at off-peak time $this->setInterval(24 * 60 * 60); diff --git a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php index 6fe10c576bb..7b664d03181 100644 --- a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php @@ -14,12 +14,11 @@ use OCP\IDBConnection; class CleanupInvitationTokenJob extends TimedJob { - /** @var IDBConnection */ - private $db; - - public function __construct(IDBConnection $db, ITimeFactory $time) { + public function __construct( + private IDBConnection $db, + ITimeFactory $time, + ) { parent::__construct($time); - $this->db = $db; // Run once a day at off-peak time $this->setInterval(24 * 60 * 60); diff --git a/apps/dav/lib/BackgroundJob/EventReminderJob.php b/apps/dav/lib/BackgroundJob/EventReminderJob.php index 894b347de9f..0e21e06fc35 100644 --- a/apps/dav/lib/BackgroundJob/EventReminderJob.php +++ b/apps/dav/lib/BackgroundJob/EventReminderJob.php @@ -8,6 +8,7 @@ declare(strict_types=1); */ namespace OCA\DAV\BackgroundJob; +use OC\User\NoUserException; use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException; use OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException; use OCA\DAV\CalDAV\Reminder\ReminderService; @@ -17,18 +18,12 @@ use OCP\IConfig; class EventReminderJob extends TimedJob { - /** @var ReminderService */ - private $reminderService; - - /** @var IConfig */ - private $config; - - public function __construct(ITimeFactory $time, - ReminderService $reminderService, - IConfig $config) { + public function __construct( + ITimeFactory $time, + private ReminderService $reminderService, + private IConfig $config, + ) { parent::__construct($time); - $this->reminderService = $reminderService; - $this->config = $config; // Run every 5 minutes $this->setInterval(5 * 60); @@ -38,7 +33,7 @@ class EventReminderJob extends TimedJob { /** * @throws ProviderNotAvailableException * @throws NotificationTypeDoesNotExistException - * @throws \OC\User\NoUserException + * @throws NoUserException */ public function run($argument):void { if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') { diff --git a/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php b/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php index 67e7d5bded3..6d94f4810ed 100644 --- a/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php @@ -15,19 +15,12 @@ use OCP\IConfig; class GenerateBirthdayCalendarBackgroundJob extends QueuedJob { - /** @var BirthdayService */ - private $birthdayService; - - /** @var IConfig */ - private $config; - - public function __construct(ITimeFactory $time, - BirthdayService $birthdayService, - IConfig $config) { + public function __construct( + ITimeFactory $time, + private BirthdayService $birthdayService, + private IConfig $config, + ) { parent::__construct($time); - - $this->birthdayService = $birthdayService; - $this->config = $config; } public function run($argument) { diff --git a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php index 15fe439beef..8746588acc7 100644 --- a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php +++ b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php @@ -18,17 +18,14 @@ use Psr\Log\LoggerInterface; class PruneOutdatedSyncTokensJob extends TimedJob { - private IConfig $config; - private LoggerInterface $logger; - private CardDavBackend $cardDavBackend; - private CalDavBackend $calDavBackend; - - public function __construct(ITimeFactory $timeFactory, CalDavBackend $calDavBackend, CardDavBackend $cardDavBackend, IConfig $config, LoggerInterface $logger) { + public function __construct( + ITimeFactory $timeFactory, + private CalDavBackend $calDavBackend, + private CardDavBackend $cardDavBackend, + private IConfig $config, + private LoggerInterface $logger, + ) { parent::__construct($timeFactory); - $this->calDavBackend = $calDavBackend; - $this->cardDavBackend = $cardDavBackend; - $this->config = $config; - $this->logger = $logger; $this->setInterval(60 * 60 * 24); // One day $this->setTimeSensitivity(self::TIME_INSENSITIVE); } diff --git a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php index 24149fe2263..7ec5b7fba79 100644 --- a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php +++ b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php @@ -16,12 +16,6 @@ use OCP\IUserManager; class RegisterRegenerateBirthdayCalendars extends QueuedJob { - /** @var IUserManager */ - private $userManager; - - /** @var IJobList */ - private $jobList; - /** * RegisterRegenerateBirthdayCalendars constructor. * @@ -29,12 +23,12 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob { * @param IUserManager $userManager * @param IJobList $jobList */ - public function __construct(ITimeFactory $time, - IUserManager $userManager, - IJobList $jobList) { + public function __construct( + ITimeFactory $time, + private IUserManager $userManager, + private IJobList $jobList, + ) { parent::__construct($time); - $this->userManager = $userManager; - $this->jobList = $jobList; } /** diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index aa19dbb22ec..230cde61578 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -19,15 +19,13 @@ use OCP\Files\NotFoundException; use Psr\Log\LoggerInterface; class UploadCleanup extends TimedJob { - private IRootFolder $rootFolder; - private IJobList $jobList; - private LoggerInterface $logger; - - public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobList $jobList, LoggerInterface $logger) { + public function __construct( + ITimeFactory $time, + private IRootFolder $rootFolder, + private IJobList $jobList, + private LoggerInterface $logger, + ) { parent::__construct($time); - $this->rootFolder = $rootFolder; - $this->jobList = $jobList; - $this->logger = $logger; // Run once a day $this->setInterval(60 * 60 * 24); diff --git a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php index 381f6aa9e33..137bad34bf5 100644 --- a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php +++ b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php @@ -17,15 +17,10 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class BulkUploadPlugin extends ServerPlugin { - private Folder $userFolder; - private LoggerInterface $logger; - public function __construct( - Folder $userFolder, - LoggerInterface $logger, + private Folder $userFolder, + private LoggerInterface $logger, ) { - $this->userFolder = $userFolder; - $this->logger = $logger; } /** diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php index 56b481097cf..5ae71f4ecc6 100644 --- a/apps/dav/lib/CalDAV/Activity/Backend.php +++ b/apps/dav/lib/CalDAV/Activity/Backend.php @@ -25,27 +25,13 @@ use Sabre\VObject\Reader; */ class Backend { - /** @var IActivityManager */ - protected $activityManager; - - /** @var IGroupManager */ - protected $groupManager; - - /** @var IUserSession */ - protected $userSession; - - /** @var IAppManager */ - protected $appManager; - - /** @var IUserManager */ - protected $userManager; - - public function __construct(IActivityManager $activityManager, IGroupManager $groupManager, IUserSession $userSession, IAppManager $appManager, IUserManager $userManager) { - $this->activityManager = $activityManager; - $this->groupManager = $groupManager; - $this->userSession = $userSession; - $this->appManager = $appManager; - $this->userManager = $userManager; + public function __construct( + protected IActivityManager $activityManager, + protected IGroupManager $groupManager, + protected IUserSession $userSession, + protected IAppManager $appManager, + protected IUserManager $userManager, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php index e5c25fd8ae6..7411202044d 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php @@ -11,15 +11,10 @@ use OCP\IURLGenerator; class Calendar implements IFilter { - /** @var IL10N */ - protected $l; - - /** @var IURLGenerator */ - protected $url; - - public function __construct(IL10N $l, IURLGenerator $url) { - $this->l = $l; - $this->url = $url; + public function __construct( + protected IL10N $l, + protected IURLGenerator $url, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php index 6ca31f1688c..6bc7bd4b308 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php @@ -11,15 +11,10 @@ use OCP\IURLGenerator; class Todo implements IFilter { - /** @var IL10N */ - protected $l; - - /** @var IURLGenerator */ - protected $url; - - public function __construct(IL10N $l, IURLGenerator $url) { - $this->l = $l; - $this->url = $url; + public function __construct( + protected IL10N $l, + protected IURLGenerator $url, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Base.php b/apps/dav/lib/CalDAV/Activity/Provider/Base.php index a063a31d015..43d80b4bb6a 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Base.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Base.php @@ -15,27 +15,19 @@ use OCP\IURLGenerator; use OCP\IUserManager; abstract class Base implements IProvider { - /** @var IUserManager */ - protected $userManager; - - /** @var IGroupManager */ - protected $groupManager; - /** @var string[] */ protected $groupDisplayNames = []; - /** @var IURLGenerator */ - protected $url; - /** * @param IUserManager $userManager * @param IGroupManager $groupManager - * @param IURLGenerator $urlGenerator + * @param IURLGenerator $url */ - public function __construct(IUserManager $userManager, IGroupManager $groupManager, IURLGenerator $urlGenerator) { - $this->userManager = $userManager; - $this->groupManager = $groupManager; - $this->url = $urlGenerator; + public function __construct( + protected IUserManager $userManager, + protected IGroupManager $groupManager, + protected IURLGenerator $url, + ) { } protected function setSubjects(IEvent $event, string $subject, array $parameters): void { diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index 25d3260c7a6..898eb2b5cb6 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -28,18 +28,9 @@ class Calendar extends Base { public const SUBJECT_UNSHARE_USER = 'calendar_user_unshare'; public const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare'; - /** @var IFactory */ - protected $languageFactory; - /** @var IL10N */ protected $l; - /** @var IManager */ - protected $activityManager; - - /** @var IEventMerger */ - protected $eventMerger; - /** * @param IFactory $languageFactory * @param IURLGenerator $url @@ -48,11 +39,15 @@ class Calendar extends Base { * @param IGroupManager $groupManager * @param IEventMerger $eventMerger */ - public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IGroupManager $groupManager, IEventMerger $eventMerger) { + public function __construct( + protected IFactory $languageFactory, + IURLGenerator $url, + protected IManager $activityManager, + IUserManager $userManager, + IGroupManager $groupManager, + protected IEventMerger $eventMerger, + ) { parent::__construct($userManager, $groupManager, $url); - $this->languageFactory = $languageFactory; - $this->activityManager = $activityManager; - $this->eventMerger = $eventMerger; } /** diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 26bf69aecdd..d3cfd00b742 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -25,21 +25,9 @@ class Event extends Base { public const SUBJECT_OBJECT_RESTORE = 'object_restore'; public const SUBJECT_OBJECT_DELETE = 'object_delete'; - /** @var IFactory */ - protected $languageFactory; - /** @var IL10N */ protected $l; - /** @var IManager */ - protected $activityManager; - - /** @var IEventMerger */ - protected $eventMerger; - - /** @var IAppManager */ - protected $appManager; - /** * @param IFactory $languageFactory * @param IURLGenerator $url @@ -49,12 +37,16 @@ class Event extends Base { * @param IEventMerger $eventMerger * @param IAppManager $appManager */ - public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IGroupManager $groupManager, IEventMerger $eventMerger, IAppManager $appManager) { + public function __construct( + protected IFactory $languageFactory, + IURLGenerator $url, + protected IManager $activityManager, + IUserManager $userManager, + IGroupManager $groupManager, + protected IEventMerger $eventMerger, + protected IAppManager $appManager, + ) { parent::__construct($userManager, $groupManager, $url); - $this->languageFactory = $languageFactory; - $this->activityManager = $activityManager; - $this->eventMerger = $eventMerger; - $this->appManager = $appManager; } /** diff --git a/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php b/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php index 67cc2abc9fd..7ab7f16dbbb 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/CalDAVSetting.php @@ -12,14 +12,12 @@ use OCP\Activity\ActivitySettings; use OCP\IL10N; abstract class CalDAVSetting extends ActivitySettings { - /** @var IL10N */ - protected $l; - /** * @param IL10N $l */ - public function __construct(IL10N $l) { - $this->l = $l; + public function __construct( + protected IL10N $l, + ) { } public function getGroupIdentifier() { diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php index 2d9beff9ced..87d26324c32 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php +++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php @@ -24,12 +24,14 @@ use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Reader; class AppCalendar extends ExternalCalendar { - protected string $principal; protected ICalendar $calendar; - public function __construct(string $appId, ICalendar $calendar, string $principal) { + public function __construct( + string $appId, + ICalendar $calendar, + protected string $principal, + ) { parent::__construct($appId, $calendar->getUri()); - $this->principal = $principal; $this->calendar = $calendar; } diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php index 3e058a9b6c1..72f2ed2c163 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php +++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php @@ -18,12 +18,10 @@ use Psr\Log\LoggerInterface; /* Plugin for wrapping application generated calendars registered in nextcloud core (OCP\Calendar\ICalendarProvider) */ class AppCalendarPlugin implements ICalendarProvider { - protected IManager $manager; - protected LoggerInterface $logger; - - public function __construct(IManager $manager, LoggerInterface $logger) { - $this->manager = $manager; - $this->logger = $logger; + public function __construct( + protected IManager $manager, + protected LoggerInterface $logger, + ) { } public function getAppID(): string { diff --git a/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php b/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php index ba3f7074faf..3c62a26df54 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php +++ b/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php @@ -20,14 +20,11 @@ use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Property\ICalendar\DateTime; class CalendarObject implements ICalendarObject, IACL { - private VCalendar $vobject; - private AppCalendar $calendar; - private ICalendar|ICreateFromString $backend; - - public function __construct(AppCalendar $calendar, ICalendar $backend, VCalendar $vobject) { - $this->backend = $backend; - $this->calendar = $calendar; - $this->vobject = $vobject; + public function __construct( + private AppCalendar $calendar, + private ICalendar|ICreateFromString $backend, + private VCalendar $vobject, + ) { } public function getOwner() { diff --git a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php index 933679436d4..b323673969b 100644 --- a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php +++ b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php @@ -24,23 +24,10 @@ class EnablePlugin extends ServerPlugin { public const NS_Nextcloud = 'http://nextcloud.com/ns'; /** - * @var IConfig - */ - protected $config; - - /** - * @var BirthdayService - */ - protected $birthdayService; - - /** * @var Server */ protected $server; - /** @var IUser */ - private $user; - /** * PublishPlugin constructor. * @@ -48,10 +35,11 @@ class EnablePlugin extends ServerPlugin { * @param BirthdayService $birthdayService * @param IUser $user */ - public function __construct(IConfig $config, BirthdayService $birthdayService, IUser $user) { - $this->config = $config; - $this->birthdayService = $birthdayService; - $this->user = $user; + public function __construct( + protected IConfig $config, + protected BirthdayService $birthdayService, + private IUser $user, + ) { } /** diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 00b27219cbd..e1e46316d74 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -32,28 +32,17 @@ class BirthdayService { public const BIRTHDAY_CALENDAR_URI = 'contact_birthdays'; public const EXCLUDE_FROM_BIRTHDAY_CALENDAR_PROPERTY_NAME = 'X-NC-EXCLUDE-FROM-BIRTHDAY-CALENDAR'; - private GroupPrincipalBackend $principalBackend; - private CalDavBackend $calDavBackEnd; - private CardDavBackend $cardDavBackEnd; - private IConfig $config; - private IDBConnection $dbConnection; - private IL10N $l10n; - /** * BirthdayService constructor. */ - public function __construct(CalDavBackend $calDavBackEnd, - CardDavBackend $cardDavBackEnd, - GroupPrincipalBackend $principalBackend, - IConfig $config, - IDBConnection $dbConnection, - IL10N $l10n) { - $this->calDavBackEnd = $calDavBackEnd; - $this->cardDavBackEnd = $cardDavBackEnd; - $this->principalBackend = $principalBackend; - $this->config = $config; - $this->dbConnection = $dbConnection; - $this->l10n = $l10n; + public function __construct( + private CalDavBackend $calDavBackEnd, + private CardDavBackend $cardDavBackEnd, + private GroupPrincipalBackend $principalBackend, + private IConfig $config, + private IDBConnection $dbConnection, + private IL10N $l10n, + ) { } public function onCardChanged(int $addressBookId, diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php index 1301fdb6000..00fa90f5d20 100644 --- a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php +++ b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php @@ -12,19 +12,12 @@ use OCP\Calendar\ICalendar; use OCP\Constants; class CachedSubscriptionImpl implements ICalendar { - private CalDavBackend $backend; - private CachedSubscription $calendar; - /** @var array<string, mixed> */ - private array $calendarInfo; - public function __construct( - CachedSubscription $calendar, - array $calendarInfo, - CalDavBackend $backend, + private CachedSubscription $calendar, + /** @var array<string, mixed> */ + private array $calendarInfo, + private CalDavBackend $backend, ) { - $this->calendar = $calendar; - $this->calendarInfo = $calendarInfo; - $this->backend = $backend; } /** diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index d3e0b3b2226..6fd7d147131 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -31,12 +31,16 @@ use Sabre\DAV\PropPatch; * @property CalDavBackend $caldavBackend */ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable, IMoveTarget { - private IConfig $config; protected IL10N $l10n; private bool $useTrashbin = true; - private LoggerInterface $logger; - public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n, IConfig $config, LoggerInterface $logger) { + public function __construct( + BackendInterface $caldavBackend, + $calendarInfo, + IL10N $l10n, + private IConfig $config, + private LoggerInterface $logger, + ) { // Convert deletion date to ISO8601 string if (isset($calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT])) { $calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT] = (new DateTimeImmutable()) @@ -53,10 +57,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable $this->calendarInfo['{DAV:}displayname'] === CalDavBackend::PERSONAL_CALENDAR_NAME) { $this->calendarInfo['{DAV:}displayname'] = $l10n->t('Personal'); } - - $this->config = $config; $this->l10n = $l10n; - $this->logger = $logger; } /** diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index 4ac00578969..c74c07bc4ab 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -11,6 +11,8 @@ use OCA\DAV\AppInfo\PluginManager; use OCA\DAV\CalDAV\Integration\ExternalCalendar; use OCA\DAV\CalDAV\Integration\ICalendarProvider; use OCA\DAV\CalDAV\Trashbin\TrashbinHome; +use OCP\IConfig; +use OCP\IL10N; use Psr\Log\LoggerInterface; use Sabre\CalDAV\Backend\BackendInterface; use Sabre\CalDAV\Backend\NotificationSupport; @@ -25,23 +27,20 @@ use Sabre\DAV\MkCol; class CalendarHome extends \Sabre\CalDAV\CalendarHome { - /** @var \OCP\IL10N */ + /** @var IL10N */ private $l10n; - /** @var \OCP\IConfig */ + /** @var IConfig */ private $config; /** @var PluginManager */ private $pluginManager; - - /** @var LoggerInterface */ - private $logger; private ?array $cachedChildren = null; public function __construct( BackendInterface $caldavBackend, array $principalInfo, - LoggerInterface $logger, + private LoggerInterface $logger, private bool $returnCachedSubscriptions, ) { parent::__construct($caldavBackend, $principalInfo); @@ -51,7 +50,6 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { \OC::$server, \OC::$server->getAppManager() ); - $this->logger = $logger; } /** diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index ea2ac0e9a62..85ca7f78ca4 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -25,17 +25,12 @@ use Sabre\VObject\Reader; use function Sabre\Uri\split as uriSplit; class CalendarImpl implements ICreateFromString, IHandleImipMessage { - private CalDavBackend $backend; - private Calendar $calendar; - /** @var array<string, mixed> */ - private array $calendarInfo; - - public function __construct(Calendar $calendar, - array $calendarInfo, - CalDavBackend $backend) { - $this->calendar = $calendar; - $this->calendarInfo = $calendarInfo; - $this->backend = $backend; + public function __construct( + private Calendar $calendar, + /** @var array<string, mixed> */ + private array $calendarInfo, + private CalDavBackend $backend, + ) { } /** diff --git a/apps/dav/lib/CalDAV/CalendarManager.php b/apps/dav/lib/CalDAV/CalendarManager.php index a415a830d2e..1baf53ee457 100644 --- a/apps/dav/lib/CalDAV/CalendarManager.php +++ b/apps/dav/lib/CalDAV/CalendarManager.php @@ -12,18 +12,6 @@ use Psr\Log\LoggerInterface; class CalendarManager { - /** @var CalDavBackend */ - private $backend; - - /** @var IL10N */ - private $l10n; - - /** @var IConfig */ - private $config; - - /** @var LoggerInterface */ - private $logger; - /** * CalendarManager constructor. * @@ -31,11 +19,12 @@ class CalendarManager { * @param IL10N $l10n * @param IConfig $config */ - public function __construct(CalDavBackend $backend, IL10N $l10n, IConfig $config, LoggerInterface $logger) { - $this->backend = $backend; - $this->l10n = $l10n; - $this->config = $config; - $this->logger = $logger; + public function __construct( + private CalDavBackend $backend, + private IL10N $l10n, + private IConfig $config, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index 0dd9bee9ce4..90a1e97ec4d 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -13,9 +13,6 @@ use Sabre\VObject\Reader; class CalendarObject extends \Sabre\CalDAV\CalendarObject { - /** @var IL10N */ - protected $l10n; - /** * CalendarObject constructor. * @@ -24,16 +21,17 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { * @param array $calendarInfo * @param array $objectData */ - public function __construct(CalDavBackend $caldavBackend, IL10N $l10n, + public function __construct( + CalDavBackend $caldavBackend, + protected IL10N $l10n, array $calendarInfo, - array $objectData) { + array $objectData, + ) { parent::__construct($caldavBackend, $calendarInfo, $objectData); if ($this->isShared()) { unset($this->objectData['size']); } - - $this->l10n = $l10n; } /** diff --git a/apps/dav/lib/CalDAV/CalendarProvider.php b/apps/dav/lib/CalDAV/CalendarProvider.php index 90605d4f76e..207713de750 100644 --- a/apps/dav/lib/CalDAV/CalendarProvider.php +++ b/apps/dav/lib/CalDAV/CalendarProvider.php @@ -15,23 +15,12 @@ use Psr\Log\LoggerInterface; class CalendarProvider implements ICalendarProvider { - /** @var CalDavBackend */ - private $calDavBackend; - - /** @var IL10N */ - private $l10n; - - /** @var IConfig */ - private $config; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(CalDavBackend $calDavBackend, IL10N $l10n, IConfig $config, LoggerInterface $logger) { - $this->calDavBackend = $calDavBackend; - $this->l10n = $l10n; - $this->config = $config; - $this->logger = $logger; + public function __construct( + private CalDavBackend $calDavBackend, + private IL10N $l10n, + private IConfig $config, + private LoggerInterface $logger, + ) { } public function getCalendars(string $principalUri, array $calendarUris = []): array { diff --git a/apps/dav/lib/CalDAV/CalendarRoot.php b/apps/dav/lib/CalDAV/CalendarRoot.php index 9ab3a4dd43f..bfe5f84ce31 100644 --- a/apps/dav/lib/CalDAV/CalendarRoot.php +++ b/apps/dav/lib/CalDAV/CalendarRoot.php @@ -12,18 +12,15 @@ use Sabre\CalDAV\Backend; use Sabre\DAVACL\PrincipalBackend; class CalendarRoot extends \Sabre\CalDAV\CalendarRoot { - private LoggerInterface $logger; - private array $returnCachedSubscriptions = []; public function __construct( PrincipalBackend\BackendInterface $principalBackend, Backend\BackendInterface $caldavBackend, $principalPrefix, - LoggerInterface $logger, + private LoggerInterface $logger, ) { parent::__construct($principalBackend, $caldavBackend, $principalPrefix); - $this->logger = $logger; } public function getChildForPrincipal(array $principal) { diff --git a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php index 2b4f8ed0223..3f71b1db24c 100644 --- a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php +++ b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php @@ -18,18 +18,16 @@ use Sabre\VObject\Property\ICalendar\Duration; * @package OCA\DAV\CalDAV\ICSExportPlugin */ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin { - private IConfig $config; - private LoggerInterface $logger; - /** @var string */ private const DEFAULT_REFRESH_INTERVAL = 'PT4H'; /** * ICSExportPlugin constructor. */ - public function __construct(IConfig $config, LoggerInterface $logger) { - $this->config = $config; - $this->logger = $logger; + public function __construct( + private IConfig $config, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php index 882a11c34b2..6e755716397 100644 --- a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php +++ b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php @@ -32,21 +32,16 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties { */ private const DELIMITER = '--'; - /** @var string */ - private $appId; - - /** @var string */ - private $calendarUri; - /** * ExternalCalendar constructor. * * @param string $appId * @param string $calendarUri */ - public function __construct(string $appId, string $calendarUri) { - $this->appId = $appId; - $this->calendarUri = $calendarUri; + public function __construct( + private string $appId, + private string $calendarUri, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Outbox.php b/apps/dav/lib/CalDAV/Outbox.php index ffda73147a6..fc9dc87a574 100644 --- a/apps/dav/lib/CalDAV/Outbox.php +++ b/apps/dav/lib/CalDAV/Outbox.php @@ -15,9 +15,6 @@ use Sabre\CalDAV\Plugin as CalDAVPlugin; */ class Outbox extends \Sabre\CalDAV\Schedule\Outbox { - /** @var IConfig */ - private $config; - /** @var null|bool */ private $disableFreeBusy = null; @@ -27,9 +24,11 @@ class Outbox extends \Sabre\CalDAV\Schedule\Outbox { * @param IConfig $config * @param string $principalUri */ - public function __construct(IConfig $config, string $principalUri) { + public function __construct( + private IConfig $config, + string $principalUri, + ) { parent::__construct($principalUri); - $this->config = $config; } /** diff --git a/apps/dav/lib/CalDAV/PublicCalendarRoot.php b/apps/dav/lib/CalDAV/PublicCalendarRoot.php index e7008bfd82c..edfb9f8dccc 100644 --- a/apps/dav/lib/CalDAV/PublicCalendarRoot.php +++ b/apps/dav/lib/CalDAV/PublicCalendarRoot.php @@ -14,18 +14,6 @@ use Sabre\DAV\Collection; class PublicCalendarRoot extends Collection { - /** @var CalDavBackend */ - protected $caldavBackend; - - /** @var \OCP\IL10N */ - protected $l10n; - - /** @var \OCP\IConfig */ - protected $config; - - /** @var LoggerInterface */ - private $logger; - /** * PublicCalendarRoot constructor. * @@ -33,12 +21,12 @@ class PublicCalendarRoot extends Collection { * @param IL10N $l10n * @param IConfig $config */ - public function __construct(CalDavBackend $caldavBackend, IL10N $l10n, - IConfig $config, LoggerInterface $logger) { - $this->caldavBackend = $caldavBackend; - $this->l10n = $l10n; - $this->config = $config; - $this->logger = $logger; + public function __construct( + protected CalDavBackend $caldavBackend, + protected IL10N $l10n, + protected IConfig $config, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 6f8746283d1..1916187af2b 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -29,28 +29,21 @@ class PublishPlugin extends ServerPlugin { protected $server; /** - * Config instance to get instance secret. - * - * @var IConfig - */ - protected $config; - - /** - * URL Generator for absolute URLs. - * - * @var IURLGenerator - */ - protected $urlGenerator; - - /** * PublishPlugin constructor. * * @param IConfig $config * @param IURLGenerator $urlGenerator */ - public function __construct(IConfig $config, IURLGenerator $urlGenerator) { - $this->config = $config; - $this->urlGenerator = $urlGenerator; + public function __construct( + /** + * Config instance to get instance secret. + */ + protected IConfig $config, + /** + * URL Generator for absolute URLs. + */ + protected IURLGenerator $urlGenerator, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php b/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php index d3543ce5bae..2fd55a12643 100644 --- a/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php +++ b/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php @@ -11,22 +11,13 @@ use Sabre\Xml\XmlSerializable; class Publisher implements XmlSerializable { /** - * @var string $publishUrl - */ - protected $publishUrl; - - /** - * @var boolean $isPublished - */ - protected $isPublished; - - /** * @param string $publishUrl * @param boolean $isPublished */ - public function __construct($publishUrl, $isPublished) { - $this->publishUrl = $publishUrl; - $this->isPublished = $isPublished; + public function __construct( + protected $publishUrl, + protected $isPublished, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php index 33e7ae9c09f..94edff98e52 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php @@ -29,31 +29,18 @@ abstract class AbstractProvider implements INotificationProvider { /** @var string */ public const NOTIFICATION_TYPE = ''; - protected LoggerInterface $logger; - - /** @var L10NFactory */ - protected $l10nFactory; - /** @var IL10N[] */ private $l10ns; /** @var string */ private $fallbackLanguage; - /** @var IURLGenerator */ - protected $urlGenerator; - - /** @var IConfig */ - protected $config; - - public function __construct(LoggerInterface $logger, - L10NFactory $l10nFactory, - IURLGenerator $urlGenerator, - IConfig $config) { - $this->logger = $logger; - $this->l10nFactory = $l10nFactory; - $this->urlGenerator = $urlGenerator; - $this->config = $config; + public function __construct( + protected LoggerInterface $logger, + protected L10NFactory $l10nFactory, + protected IURLGenerator $urlGenerator, + protected IConfig $config, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index b33b9c61834..0fd39a9e459 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -33,15 +33,14 @@ class EmailProvider extends AbstractProvider { /** @var string */ public const NOTIFICATION_TYPE = 'EMAIL'; - private IMailer $mailer; - - public function __construct(IConfig $config, - IMailer $mailer, + public function __construct( + IConfig $config, + private IMailer $mailer, LoggerInterface $logger, L10NFactory $l10nFactory, - IURLGenerator $urlGenerator) { + IURLGenerator $urlGenerator, + ) { parent::__construct($logger, $l10nFactory, $urlGenerator, $config); - $this->mailer = $mailer; } /** diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index d8abbc39631..a3f0cce547a 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -30,21 +30,15 @@ class PushProvider extends AbstractProvider { /** @var string */ public const NOTIFICATION_TYPE = 'DISPLAY'; - /** @var IManager */ - private $manager; - - /** @var ITimeFactory */ - private $timeFactory; - - public function __construct(IConfig $config, - IManager $manager, + public function __construct( + IConfig $config, + private IManager $manager, LoggerInterface $logger, L10NFactory $l10nFactory, IURLGenerator $urlGenerator, - ITimeFactory $timeFactory) { + private ITimeFactory $timeFactory, + ) { parent::__construct($logger, $l10nFactory, $urlGenerator, $config); - $this->manager = $manager; - $this->timeFactory = $timeFactory; } /** diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php b/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php index 21f4f5094d4..a5fad34e63e 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OCA\DAV\CalDAV\Reminder; use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException; +use OCP\AppFramework\QueryException; /** * Class NotificationProviderManager @@ -53,7 +54,7 @@ class NotificationProviderManager { * Registers a new provider * * @param string $providerClassName - * @throws \OCP\AppFramework\QueryException + * @throws QueryException */ public function registerProvider(string $providerClassName):void { $provider = \OC::$server->query($providerClassName); diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index f3c784ea21f..137fb509f56 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -26,31 +26,21 @@ use OCP\Notification\UnknownNotificationException; */ class Notifier implements INotifier { - /** @var IFactory */ - private $l10nFactory; - - /** @var IURLGenerator */ - private $urlGenerator; - /** @var IL10N */ private $l10n; - /** @var ITimeFactory */ - private $timeFactory; - /** * Notifier constructor. * - * @param IFactory $factory + * @param IFactory $l10nFactory * @param IURLGenerator $urlGenerator * @param ITimeFactory $timeFactory */ - public function __construct(IFactory $factory, - IURLGenerator $urlGenerator, - ITimeFactory $timeFactory) { - $this->l10nFactory = $factory; - $this->urlGenerator = $urlGenerator; - $this->timeFactory = $timeFactory; + public function __construct( + private IFactory $l10nFactory, + private IURLGenerator $urlGenerator, + private ITimeFactory $timeFactory, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index 293ce6a8788..e2d44535ce0 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -32,33 +32,6 @@ use function strcasecmp; class ReminderService { - /** @var Backend */ - private $backend; - - /** @var NotificationProviderManager */ - private $notificationProviderManager; - - /** @var IUserManager */ - private $userManager; - - /** @var IGroupManager */ - private $groupManager; - - /** @var CalDavBackend */ - private $caldavBackend; - - /** @var ITimeFactory */ - private $timeFactory; - - /** @var IConfig */ - private $config; - - /** @var LoggerInterface */ - private $logger; - - /** @var Principal */ - private $principalConnector; - public const REMINDER_TYPE_EMAIL = 'EMAIL'; public const REMINDER_TYPE_DISPLAY = 'DISPLAY'; public const REMINDER_TYPE_AUDIO = 'AUDIO'; @@ -74,24 +47,17 @@ class ReminderService { self::REMINDER_TYPE_AUDIO ]; - public function __construct(Backend $backend, - NotificationProviderManager $notificationProviderManager, - IUserManager $userManager, - IGroupManager $groupManager, - CalDavBackend $caldavBackend, - ITimeFactory $timeFactory, - IConfig $config, - LoggerInterface $logger, - Principal $principalConnector) { - $this->backend = $backend; - $this->notificationProviderManager = $notificationProviderManager; - $this->userManager = $userManager; - $this->groupManager = $groupManager; - $this->caldavBackend = $caldavBackend; - $this->timeFactory = $timeFactory; - $this->config = $config; - $this->logger = $logger; - $this->principalConnector = $principalConnector; + public function __construct( + private Backend $backend, + private NotificationProviderManager $notificationProviderManager, + private IUserManager $userManager, + private IGroupManager $groupManager, + private CalDavBackend $caldavBackend, + private ITimeFactory $timeFactory, + private IConfig $config, + private LoggerInterface $logger, + private Principal $principalConnector, + ) { } /** diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 83e2935a46e..e1bd2f5be29 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -25,17 +25,6 @@ use function array_values; abstract class AbstractPrincipalBackend implements BackendInterface { - /** @var IDBConnection */ - private $db; - - /** @var IUserSession */ - private $userSession; - - /** @var IGroupManager */ - private $groupManager; - - private LoggerInterface $logger; - /** @var ProxyMapper */ private $proxyMapper; @@ -51,27 +40,21 @@ abstract class AbstractPrincipalBackend implements BackendInterface { /** @var string */ private $dbForeignKeyName; - /** @var string */ - private $cuType; - - public function __construct(IDBConnection $dbConnection, - IUserSession $userSession, - IGroupManager $groupManager, - LoggerInterface $logger, + public function __construct( + private IDBConnection $db, + private IUserSession $userSession, + private IGroupManager $groupManager, + private LoggerInterface $logger, ProxyMapper $proxyMapper, string $principalPrefix, string $dbPrefix, - string $cuType) { - $this->db = $dbConnection; - $this->userSession = $userSession; - $this->groupManager = $groupManager; - $this->logger = $logger; + private string $cuType, + ) { $this->proxyMapper = $proxyMapper; $this->principalPrefix = $principalPrefix; $this->dbTableName = 'calendar_' . $dbPrefix . 's'; $this->dbMetaDataTableName = $this->dbTableName . '_md'; $this->dbForeignKeyName = $dbPrefix . '_id'; - $this->cuType = $cuType; } use PrincipalProxyTrait; diff --git a/apps/dav/lib/CalDAV/RetentionService.php b/apps/dav/lib/CalDAV/RetentionService.php index a41aa12bb66..399d1a46639 100644 --- a/apps/dav/lib/CalDAV/RetentionService.php +++ b/apps/dav/lib/CalDAV/RetentionService.php @@ -17,21 +17,11 @@ class RetentionService { public const RETENTION_CONFIG_KEY = 'calendarRetentionObligation'; private const DEFAULT_RETENTION_SECONDS = 30 * 24 * 60 * 60; - /** @var IConfig */ - private $config; - - /** @var ITimeFactory */ - private $time; - - /** @var CalDavBackend */ - private $calDavBackend; - - public function __construct(IConfig $config, - ITimeFactory $time, - CalDavBackend $calDavBackend) { - $this->config = $config; - $this->time = $time; - $this->calDavBackend = $calDavBackend; + public function __construct( + private IConfig $config, + private ITimeFactory $time, + private CalDavBackend $calDavBackend, + ) { } public function getDuration(): int { diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index beca5cff233..f88625b551b 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -45,41 +45,25 @@ use Sabre\VObject\Reader; * @license http://sabre.io/license/ Modified BSD License */ class IMipPlugin extends SabreIMipPlugin { - private IUserSession $userSession; - private IConfig $config; - private IMailer $mailer; - private LoggerInterface $logger; - private ITimeFactory $timeFactory; - private Defaults $defaults; private ?VCalendar $vCalendar = null; - private IMipService $imipService; public const MAX_DATE = '2038-01-01'; public const METHOD_REQUEST = 'request'; public const METHOD_REPLY = 'reply'; public const METHOD_CANCEL = 'cancel'; - public const IMIP_INDENT = 15; // Enough for the length of all body bullet items, in all languages - private EventComparisonService $eventComparisonService; - private IMailManager $mailManager; - - public function __construct(IConfig $config, - IMailer $mailer, - LoggerInterface $logger, - ITimeFactory $timeFactory, - Defaults $defaults, - IUserSession $userSession, - IMipService $imipService, - EventComparisonService $eventComparisonService, - IMailManager $mailManager) { + public const IMIP_INDENT = 15; + + public function __construct( + private IConfig $config, + private IMailer $mailer, + private LoggerInterface $logger, + private ITimeFactory $timeFactory, + private Defaults $defaults, + private IUserSession $userSession, + private IMipService $imipService, + private EventComparisonService $eventComparisonService, + private IMailManager $mailManager, + ) { parent::__construct(''); - $this->userSession = $userSession; - $this->config = $config; - $this->mailer = $mailer; - $this->logger = $logger; - $this->timeFactory = $timeFactory; - $this->defaults = $defaults; - $this->imipService = $imipService; - $this->eventComparisonService = $eventComparisonService; - $this->mailManager = $mailManager; } public function initialize(DAV\Server $server): void { diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php index 010f6408731..eebfe2ead49 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -41,11 +41,6 @@ use function Sabre\Uri\split; class Plugin extends \Sabre\CalDAV\Schedule\Plugin { - /** - * @var IConfig - */ - private $config; - /** @var ITip\Message[] */ private $schedulingResponses = []; @@ -54,16 +49,15 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { public const CALENDAR_USER_TYPE = '{' . self::NS_CALDAV . '}calendar-user-type'; public const SCHEDULE_DEFAULT_CALENDAR_URL = '{' . Plugin::NS_CALDAV . '}schedule-default-calendar-URL'; - private LoggerInterface $logger; - private DefaultCalendarValidator $defaultCalendarValidator; /** * @param IConfig $config */ - public function __construct(IConfig $config, LoggerInterface $logger, DefaultCalendarValidator $defaultCalendarValidator) { - $this->config = $config; - $this->logger = $logger; - $this->defaultCalendarValidator = $defaultCalendarValidator; + public function __construct( + private IConfig $config, + private LoggerInterface $logger, + private DefaultCalendarValidator $defaultCalendarValidator, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php b/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php index 236b5c6d99d..311157994e2 100644 --- a/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php +++ b/apps/dav/lib/CalDAV/Security/RateLimitingPlugin.php @@ -25,24 +25,16 @@ use function explode; class RateLimitingPlugin extends ServerPlugin { private Limiter $limiter; - private IUserManager $userManager; - private CalDavBackend $calDavBackend; - private IAppConfig $config; - private LoggerInterface $logger; - private ?string $userId; - public function __construct(Limiter $limiter, - IUserManager $userManager, - CalDavBackend $calDavBackend, - LoggerInterface $logger, - IAppConfig $config, - ?string $userId) { + public function __construct( + Limiter $limiter, + private IUserManager $userManager, + private CalDavBackend $calDavBackend, + private LoggerInterface $logger, + private IAppConfig $config, + private ?string $userId, + ) { $this->limiter = $limiter; - $this->userManager = $userManager; - $this->calDavBackend = $calDavBackend; - $this->config = $config; - $this->logger = $logger; - $this->userId = $userId; } public function initialize(DAV\Server $server): void { diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php index 06f4a153bf9..d8c429f2056 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php @@ -18,26 +18,13 @@ use Sabre\DAVACL\IACL; class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { use ACLTrait; - /** @var string */ - private $name; - - /** @var mixed[] */ - private $objectData; - - /** @var string */ - private $principalUri; - - /** @var CalDavBackend */ - private $calDavBackend; - - public function __construct(string $name, - array $objectData, - string $principalUri, - CalDavBackend $calDavBackend) { - $this->name = $name; - $this->objectData = $objectData; - $this->calDavBackend = $calDavBackend; - $this->principalUri = $principalUri; + public function __construct( + private string $name, + /** @var mixed[] */ + private array $objectData, + private string $principalUri, + private CalDavBackend $calDavBackend, + ) { } public function delete() { diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php index c9db04f7d32..f75e19689f1 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php @@ -25,16 +25,11 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL public const NAME = 'objects'; - /** @var CalDavBackend */ - protected $caldavBackend; - - /** @var mixed[] */ - private $principalInfo; - - public function __construct(CalDavBackend $caldavBackend, - array $principalInfo) { - $this->caldavBackend = $caldavBackend; - $this->principalInfo = $principalInfo; + public function __construct( + protected CalDavBackend $caldavBackend, + /** @var mixed[] */ + private array $principalInfo, + ) { } /** diff --git a/apps/dav/lib/CalDAV/Trashbin/Plugin.php b/apps/dav/lib/CalDAV/Trashbin/Plugin.php index f3c8342c475..6f58b1f3110 100644 --- a/apps/dav/lib/CalDAV/Trashbin/Plugin.php +++ b/apps/dav/lib/CalDAV/Trashbin/Plugin.php @@ -32,16 +32,14 @@ class Plugin extends ServerPlugin { /** @var bool */ private $disableTrashbin; - /** @var RetentionService */ - private $retentionService; - /** @var Server */ private $server; - public function __construct(IRequest $request, - RetentionService $retentionService) { + public function __construct( + IRequest $request, + private RetentionService $retentionService, + ) { $this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1'; - $this->retentionService = $retentionService; } public function initialize(Server $server): void { diff --git a/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php b/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php index a1958bb2794..1c76bd2295d 100644 --- a/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php +++ b/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php @@ -26,16 +26,10 @@ class TrashbinHome implements IACL, ICollection, IProperties { public const NAME = 'trashbin'; - /** @var CalDavBackend */ - private $caldavBackend; - - /** @var array */ - private $principalInfo; - - public function __construct(CalDavBackend $caldavBackend, - array $principalInfo) { - $this->caldavBackend = $caldavBackend; - $this->principalInfo = $principalInfo; + public function __construct( + private CalDavBackend $caldavBackend, + private array $principalInfo, + ) { } public function getOwner(): string { diff --git a/apps/dav/lib/Capabilities.php b/apps/dav/lib/Capabilities.php index 1de64e16e41..b0f63f80f2d 100644 --- a/apps/dav/lib/Capabilities.php +++ b/apps/dav/lib/Capabilities.php @@ -9,10 +9,9 @@ use OCP\Capabilities\ICapability; use OCP\IConfig; class Capabilities implements ICapability { - private IConfig $config; - - public function __construct(IConfig $config) { - $this->config = $config; + public function __construct( + private IConfig $config, + ) { } /** diff --git a/apps/dav/lib/CardDAV/Activity/Backend.php b/apps/dav/lib/CardDAV/Activity/Backend.php index d2466e34f9d..b08414d3b02 100644 --- a/apps/dav/lib/CardDAV/Activity/Backend.php +++ b/apps/dav/lib/CardDAV/Activity/Backend.php @@ -22,31 +22,13 @@ use Sabre\VObject\Reader; class Backend { - /** @var IActivityManager */ - protected $activityManager; - - /** @var IGroupManager */ - protected $groupManager; - - /** @var IUserSession */ - protected $userSession; - - /** @var IAppManager */ - protected $appManager; - - /** @var IUserManager */ - protected $userManager; - - public function __construct(IActivityManager $activityManager, - IGroupManager $groupManager, - IUserSession $userSession, - IAppManager $appManager, - IUserManager $userManager) { - $this->activityManager = $activityManager; - $this->groupManager = $groupManager; - $this->userSession = $userSession; - $this->appManager = $appManager; - $this->userManager = $userManager; + public function __construct( + protected IActivityManager $activityManager, + protected IGroupManager $groupManager, + protected IUserSession $userSession, + protected IAppManager $appManager, + protected IUserManager $userManager, + ) { } /** diff --git a/apps/dav/lib/CardDAV/Activity/Filter.php b/apps/dav/lib/CardDAV/Activity/Filter.php index 2003189ab5c..8934c455def 100644 --- a/apps/dav/lib/CardDAV/Activity/Filter.php +++ b/apps/dav/lib/CardDAV/Activity/Filter.php @@ -11,15 +11,10 @@ use OCP\IURLGenerator; class Filter implements IFilter { - /** @var IL10N */ - protected $l; - - /** @var IURLGenerator */ - protected $url; - - public function __construct(IL10N $l, IURLGenerator $url) { - $this->l = $l; - $this->url = $url; + public function __construct( + protected IL10N $l, + protected IURLGenerator $url, + ) { } /** diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php index 31f26554d67..cdb9769401f 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php @@ -27,25 +27,15 @@ class Addressbook extends Base { public const SUBJECT_UNSHARE_USER = 'addressbook_user_unshare'; public const SUBJECT_UNSHARE_GROUP = 'addressbook_group_unshare'; - /** @var IFactory */ - protected $languageFactory; - - /** @var IManager */ - protected $activityManager; - - /** @var IEventMerger */ - protected $eventMerger; - - public function __construct(IFactory $languageFactory, + public function __construct( + protected IFactory $languageFactory, IURLGenerator $url, - IManager $activityManager, + protected IManager $activityManager, IUserManager $userManager, IGroupManager $groupManager, - IEventMerger $eventMerger) { + protected IEventMerger $eventMerger, + ) { parent::__construct($userManager, $groupManager, $url); - $this->languageFactory = $languageFactory; - $this->activityManager = $activityManager; - $this->eventMerger = $eventMerger; } /** diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Base.php b/apps/dav/lib/CardDAV/Activity/Provider/Base.php index 95b4d52b242..ee430668a32 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Base.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Base.php @@ -18,27 +18,17 @@ use OCP\IURLGenerator; use OCP\IUserManager; abstract class Base implements IProvider { - /** @var IUserManager */ - protected $userManager; - /** @var string[] */ protected $userDisplayNames = []; - /** @var IGroupManager */ - protected $groupManager; - /** @var string[] */ protected $groupDisplayNames = []; - /** @var IURLGenerator */ - protected $url; - - public function __construct(IUserManager $userManager, - IGroupManager $groupManager, - IURLGenerator $urlGenerator) { - $this->userManager = $userManager; - $this->groupManager = $groupManager; - $this->url = $urlGenerator; + public function __construct( + protected IUserManager $userManager, + protected IGroupManager $groupManager, + protected IURLGenerator $url, + ) { } protected function setSubjects(IEvent $event, string $subject, array $parameters): void { diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Card.php b/apps/dav/lib/CardDAV/Activity/Provider/Card.php index aa821f592d9..acf23c00531 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Card.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Card.php @@ -24,30 +24,16 @@ class Card extends Base { public const SUBJECT_UPDATE = 'card_update'; public const SUBJECT_DELETE = 'card_delete'; - /** @var IFactory */ - protected $languageFactory; - - /** @var IManager */ - protected $activityManager; - - /** @var IEventMerger */ - protected $eventMerger; - - /** @var IAppManager */ - protected $appManager; - - public function __construct(IFactory $languageFactory, + public function __construct( + protected IFactory $languageFactory, IURLGenerator $url, - IManager $activityManager, + protected IManager $activityManager, IUserManager $userManager, IGroupManager $groupManager, - IEventMerger $eventMerger, - IAppManager $appManager) { + protected IEventMerger $eventMerger, + protected IAppManager $appManager, + ) { parent::__construct($userManager, $groupManager, $url); - $this->languageFactory = $languageFactory; - $this->activityManager = $activityManager; - $this->eventMerger = $eventMerger; - $this->appManager = $appManager; } /** diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 5dfb22141e8..e37281e92eb 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -17,18 +17,6 @@ use Sabre\VObject\UUIDUtil; class AddressBookImpl implements IAddressBook { - /** @var CardDavBackend */ - private $backend; - - /** @var array */ - private $addressBookInfo; - - /** @var AddressBook */ - private $addressBook; - - /** @var IURLGenerator */ - private $urlGenerator; - /** * AddressBookImpl constructor. * @@ -38,14 +26,11 @@ class AddressBookImpl implements IAddressBook { * @param IUrlGenerator $urlGenerator */ public function __construct( - AddressBook $addressBook, - array $addressBookInfo, - CardDavBackend $backend, - IURLGenerator $urlGenerator) { - $this->addressBook = $addressBook; - $this->addressBookInfo = $addressBookInfo; - $this->backend = $backend; - $this->urlGenerator = $urlGenerator; + private AddressBook $addressBook, + private array $addressBookInfo, + private CardDavBackend $backend, + private IURLGenerator $urlGenerator, + ) { } /** diff --git a/apps/dav/lib/CardDAV/AddressBookRoot.php b/apps/dav/lib/CardDAV/AddressBookRoot.php index ec6fa6c9fe1..5679a03545e 100644 --- a/apps/dav/lib/CardDAV/AddressBookRoot.php +++ b/apps/dav/lib/CardDAV/AddressBookRoot.php @@ -13,26 +13,20 @@ use OCP\IUser; class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot { - /** @var PluginManager */ - private $pluginManager; - private ?IUser $user; - private ?IGroupManager $groupManager; - /** * @param \Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend * @param \Sabre\CardDAV\Backend\BackendInterface $carddavBackend * @param string $principalPrefix */ - public function __construct(\Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend, + public function __construct( + \Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend, \Sabre\CardDAV\Backend\BackendInterface $carddavBackend, - PluginManager $pluginManager, - ?IUser $user, - ?IGroupManager $groupManager, - string $principalPrefix = 'principals') { + private PluginManager $pluginManager, + private ?IUser $user, + private ?IGroupManager $groupManager, + string $principalPrefix = 'principals', + ) { parent::__construct($principalBackend, $carddavBackend, $principalPrefix); - $this->pluginManager = $pluginManager; - $this->user = $user; - $this->groupManager = $groupManager; } /** diff --git a/apps/dav/lib/CardDAV/ContactsManager.php b/apps/dav/lib/CardDAV/ContactsManager.php index 899396ddc17..39e4e6aa117 100644 --- a/apps/dav/lib/CardDAV/ContactsManager.php +++ b/apps/dav/lib/CardDAV/ContactsManager.php @@ -12,21 +12,16 @@ use OCP\IL10N; use OCP\IURLGenerator; class ContactsManager { - /** @var CardDavBackend */ - private $backend; - - /** @var IL10N */ - private $l10n; - /** * ContactsManager constructor. * * @param CardDavBackend $backend * @param IL10N $l10n */ - public function __construct(CardDavBackend $backend, IL10N $l10n) { - $this->backend = $backend; - $this->l10n = $l10n; + public function __construct( + private CardDavBackend $backend, + private IL10N $l10n, + ) { } /** diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php index a0a25716ed8..64c1cfa66d5 100644 --- a/apps/dav/lib/CardDAV/Converter.php +++ b/apps/dav/lib/CardDAV/Converter.php @@ -20,21 +20,12 @@ use Sabre\VObject\Property\Text; use Sabre\VObject\Property\VCard\Date; class Converter { - /** @var IURLGenerator */ - private $urlGenerator; - /** @var IAccountManager */ - private $accountManager; - private IUserManager $userManager; - public function __construct( - IAccountManager $accountManager, - IUserManager $userManager, - IURLGenerator $urlGenerator, + private IAccountManager $accountManager, + private IUserManager $userManager, + private IURLGenerator $urlGenerator, private LoggerInterface $logger, ) { - $this->accountManager = $accountManager; - $this->userManager = $userManager; - $this->urlGenerator = $urlGenerator; } public function createCardFromUser(IUser $user): ?VCard { diff --git a/apps/dav/lib/CardDAV/ImageExportPlugin.php b/apps/dav/lib/CardDAV/ImageExportPlugin.php index f8c2b6ee827..e9d390d0849 100644 --- a/apps/dav/lib/CardDAV/ImageExportPlugin.php +++ b/apps/dav/lib/CardDAV/ImageExportPlugin.php @@ -18,16 +18,15 @@ class ImageExportPlugin extends ServerPlugin { /** @var Server */ protected $server; - /** @var PhotoCache */ - private $cache; /** * ImageExportPlugin constructor. * * @param PhotoCache $cache */ - public function __construct(PhotoCache $cache) { - $this->cache = $cache; + public function __construct( + private PhotoCache $cache, + ) { } /** diff --git a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php index 48e0b0d3036..372906a6ae8 100644 --- a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php +++ b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php @@ -32,12 +32,10 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties { */ private const DELIMITER = '--'; - private string $appId; - private string $uri; - - public function __construct(string $appId, string $uri) { - $this->appId = $appId; - $this->uri = $uri; + public function __construct( + private string $appId, + private string $uri, + ) { } /** diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php index 0fb5592142e..7f9579a377f 100644 --- a/apps/dav/lib/CardDAV/PhotoCache.php +++ b/apps/dav/lib/CardDAV/PhotoCache.php @@ -28,15 +28,13 @@ class PhotoCache { 'image/vnd.microsoft.icon' => 'ico', ]; - protected IAppData $appData; - protected LoggerInterface $logger; - /** * PhotoCache constructor. */ - public function __construct(IAppData $appData, LoggerInterface $logger) { - $this->appData = $appData; - $this->logger = $logger; + public function __construct( + protected IAppData $appData, + protected LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php b/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php index 256d8481ee3..3e18a1341b0 100644 --- a/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php +++ b/apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php @@ -23,22 +23,19 @@ use function count; use function explode; class CardDavRateLimitingPlugin extends ServerPlugin { - private ?string $userId; - public function __construct( private Limiter $limiter, private IUserManager $userManager, private CardDavBackend $cardDavBackend, private LoggerInterface $logger, private IAppConfig $config, - ?string $userId, + private ?string $userId, ) { $this->limiter = $limiter; $this->userManager = $userManager; $this->cardDavBackend = $cardDavBackend; $this->config = $config; $this->logger = $logger; - $this->userId = $userId; } public function initialize(DAV\Server $server): void { diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index a10c830ec79..4e8c4b1355e 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -26,32 +26,19 @@ use function is_null; class SyncService { use TTransactional; - - private CardDavBackend $backend; - private IUserManager $userManager; - private IDBConnection $dbConnection; - private LoggerInterface $logger; private ?array $localSystemAddressBook = null; - private Converter $converter; protected string $certPath; - private IClientService $clientService; - private IConfig $config; - - public function __construct(CardDavBackend $backend, - IUserManager $userManager, - IDBConnection $dbConnection, - LoggerInterface $logger, - Converter $converter, - IClientService $clientService, - IConfig $config) { - $this->backend = $backend; - $this->userManager = $userManager; - $this->logger = $logger; - $this->converter = $converter; + + public function __construct( + private CardDavBackend $backend, + private IUserManager $userManager, + private IDBConnection $dbConnection, + private LoggerInterface $logger, + private Converter $converter, + private IClientService $clientService, + private IConfig $config, + ) { $this->certPath = ''; - $this->dbConnection = $dbConnection; - $this->clientService = $clientService; - $this->config = $config; } /** diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php index aff51ac5b9b..e0032044e70 100644 --- a/apps/dav/lib/CardDAV/SystemAddressbook.php +++ b/apps/dav/lib/CardDAV/SystemAddressbook.php @@ -30,27 +30,18 @@ use function in_array; class SystemAddressbook extends AddressBook { public const URI_SHARED = 'z-server-generated--system'; - /** @var IConfig */ - private $config; - private IUserSession $userSession; - private ?TrustedServers $trustedServers; - private ?IRequest $request; - private ?IGroupManager $groupManager; - public function __construct(BackendInterface $carddavBackend, + public function __construct( + BackendInterface $carddavBackend, array $addressBookInfo, IL10N $l10n, - IConfig $config, - IUserSession $userSession, - ?IRequest $request = null, - ?TrustedServers $trustedServers = null, - ?IGroupManager $groupManager = null) { + private IConfig $config, + private IUserSession $userSession, + private ?IRequest $request = null, + private ?TrustedServers $trustedServers = null, + private ?IGroupManager $groupManager = null, + ) { parent::__construct($carddavBackend, $addressBookInfo, $l10n); - $this->config = $config; - $this->userSession = $userSession; - $this->request = $request; - $this->trustedServers = $trustedServers; - $this->groupManager = $groupManager; $this->addressBookInfo['{DAV:}displayname'] = $l10n->t('Accounts'); $this->addressBookInfo['{' . Plugin::NS_CARDDAV . '}addressbook-description'] = $l10n->t('System address book which holds all accounts'); diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index aee26af4ed9..eaf393dec04 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -36,20 +36,14 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { /** @var IConfig */ protected $config; - /** @var PluginManager */ - private $pluginManager; - private ?IUser $user; - private ?IGroupManager $groupManager; - - public function __construct(Backend\BackendInterface $carddavBackend, + public function __construct( + Backend\BackendInterface $carddavBackend, string $principalUri, - PluginManager $pluginManager, - ?IUser $user, - ?IGroupManager $groupManager) { + private PluginManager $pluginManager, + private ?IUser $user, + private ?IGroupManager $groupManager, + ) { parent::__construct($carddavBackend, $principalUri); - $this->pluginManager = $pluginManager; - $this->user = $user; - $this->groupManager = $groupManager; } /** diff --git a/apps/dav/lib/CardDAV/Xml/Groups.php b/apps/dav/lib/CardDAV/Xml/Groups.php index 6100bac1aea..07aeecb3fa2 100644 --- a/apps/dav/lib/CardDAV/Xml/Groups.php +++ b/apps/dav/lib/CardDAV/Xml/Groups.php @@ -13,14 +13,12 @@ use Sabre\Xml\XmlSerializable; class Groups implements XmlSerializable { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; - /** @var string[] of TYPE:CHECKSUM */ - private $groups; - /** - * @param string $groups + * @param list<string> $groups */ - public function __construct($groups) { - $this->groups = $groups; + public function __construct( + private array $groups, + ) { } public function xmlSerialize(Writer $writer) { diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index d0f0d585888..5dbefa82d93 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -30,37 +30,19 @@ 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 */ - public $comment; - - /** @var ICommentsManager */ - protected $commentsManager; - - protected LoggerInterface $logger; - /** @var array list of properties with key being their name and value their setter */ protected $properties = []; - /** @var IUserManager */ - protected $userManager; - - /** @var IUserSession */ - protected $userSession; - /** * CommentNode constructor. */ public function __construct( - ICommentsManager $commentsManager, - IComment $comment, - IUserManager $userManager, - IUserSession $userSession, - LoggerInterface $logger, + protected ICommentsManager $commentsManager, + public IComment $comment, + protected IUserManager $userManager, + protected IUserSession $userSession, + protected LoggerInterface $logger, ) { - $this->commentsManager = $commentsManager; - $this->comment = $comment; - $this->logger = $logger; - $methods = get_class_methods($this->comment); $methods = array_filter($methods, function ($name) { return str_starts_with($name, 'get'); @@ -72,8 +54,6 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { $name = '{' . self::NS_OWNCLOUD . '}' . lcfirst(substr($getter, 3)); $this->properties[$name] = $getter; } - $this->userManager = $userManager; - $this->userSession = $userSession; } /** diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 6cae12d20ab..92ffae3f73e 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -35,24 +35,19 @@ 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 */ - protected $commentsManager; - /** @var \Sabre\DAV\Server $server */ private $server; - /** @var \OCP\IUserSession */ - protected $userSession; - /** * Comments plugin * * @param ICommentsManager $commentsManager * @param IUserSession $userSession */ - public function __construct(ICommentsManager $commentsManager, IUserSession $userSession) { - $this->commentsManager = $commentsManager; - $this->userSession = $userSession; + public function __construct( + protected ICommentsManager $commentsManager, + protected IUserSession $userSession, + ) { } /** diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index 3135449641c..33c58ee44d2 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -27,11 +27,6 @@ use Sabre\DAV\PropPatch; class EntityCollection extends RootCollection implements IProperties { public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; - /** @var string */ - protected $id; - - protected LoggerInterface $logger; - /** * @param string $id * @param string $name @@ -41,12 +36,12 @@ class EntityCollection extends RootCollection implements IProperties { * @param LoggerInterface $logger */ public function __construct( - $id, + protected $id, $name, ICommentsManager $commentsManager, IUserManager $userManager, IUserSession $userSession, - LoggerInterface $logger, + protected LoggerInterface $logger, ) { foreach (['id', 'name'] as $property) { $$property = trim($$property); @@ -54,10 +49,8 @@ class EntityCollection extends RootCollection implements IProperties { throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string'); } } - $this->id = $id; $this->name = $name; $this->commentsManager = $commentsManager; - $this->logger = $logger; $this->userManager = $userManager; $this->userSession = $userSession; } diff --git a/apps/dav/lib/Comments/EntityTypeCollection.php b/apps/dav/lib/Comments/EntityTypeCollection.php index b326805542d..1c8533ca375 100644 --- a/apps/dav/lib/Comments/EntityTypeCollection.php +++ b/apps/dav/lib/Comments/EntityTypeCollection.php @@ -26,19 +26,13 @@ use Sabre\DAV\Exception\NotFound; * @package OCA\DAV\Comments */ class EntityTypeCollection extends RootCollection { - protected LoggerInterface $logger; - protected IUserManager $userManager; - - /** @var \Closure */ - protected $childExistsFunction; - public function __construct( string $name, ICommentsManager $commentsManager, - IUserManager $userManager, + protected IUserManager $userManager, IUserSession $userSession, - LoggerInterface $logger, - \Closure $childExistsFunction, + protected LoggerInterface $logger, + protected \Closure $childExistsFunction, ) { $name = trim($name); if (empty($name)) { @@ -46,10 +40,7 @@ class EntityTypeCollection extends RootCollection { } $this->name = $name; $this->commentsManager = $commentsManager; - $this->logger = $logger; - $this->userManager = $userManager; $this->userSession = $userSession; - $this->childExistsFunction = $childExistsFunction; } /** diff --git a/apps/dav/lib/Comments/RootCollection.php b/apps/dav/lib/Comments/RootCollection.php index a9aa88458b7..493d73ec531 100644 --- a/apps/dav/lib/Comments/RootCollection.php +++ b/apps/dav/lib/Comments/RootCollection.php @@ -21,24 +21,15 @@ use Sabre\DAV\ICollection; class RootCollection implements ICollection { /** @var EntityTypeCollection[]|null */ private ?array $entityTypeCollections = null; - protected ICommentsManager $commentsManager; protected string $name = 'comments'; - protected LoggerInterface $logger; - protected IUserManager $userManager; - protected IUserSession $userSession; - protected IEventDispatcher $dispatcher; public function __construct( - ICommentsManager $commentsManager, - IUserManager $userManager, - IUserSession $userSession, - IEventDispatcher $dispatcher, - LoggerInterface $logger) { - $this->commentsManager = $commentsManager; - $this->logger = $logger; - $this->userManager = $userManager; - $this->userSession = $userSession; - $this->dispatcher = $dispatcher; + protected ICommentsManager $commentsManager, + protected IUserManager $userManager, + protected IUserSession $userSession, + protected IEventDispatcher $dispatcher, + protected LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/Connector/LegacyPublicAuth.php b/apps/dav/lib/Connector/LegacyPublicAuth.php index 731654df31a..03d18853de0 100644 --- a/apps/dav/lib/Connector/LegacyPublicAuth.php +++ b/apps/dav/lib/Connector/LegacyPublicAuth.php @@ -26,20 +26,13 @@ class LegacyPublicAuth extends AbstractBasic { private const BRUTEFORCE_ACTION = 'legacy_public_webdav_auth'; private ?IShare $share = null; - private IManager $shareManager; - private ISession $session; - private IRequest $request; - private IThrottler $throttler; - - public function __construct(IRequest $request, - IManager $shareManager, - ISession $session, - IThrottler $throttler) { - $this->request = $request; - $this->shareManager = $shareManager; - $this->session = $session; - $this->throttler = $throttler; + public function __construct( + private IRequest $request, + private IManager $shareManager, + private ISession $session, + private IThrottler $throttler, + ) { // setup realm $defaults = new Defaults(); $this->realm = $defaults->getName() ?: 'Nextcloud'; diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 4c6ce557980..fa1c2e95fad 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -27,25 +27,20 @@ use Sabre\HTTP\ResponseInterface; class Auth extends AbstractBasic { public const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND'; - - private ISession $session; private Session $userSession; - private IRequest $request; private ?string $currentUser = null; private Manager $twoFactorManager; - private IThrottler $throttler; - public function __construct(ISession $session, + public function __construct( + private ISession $session, Session $userSession, - IRequest $request, + private IRequest $request, Manager $twoFactorManager, - IThrottler $throttler, - string $principalPrefix = 'principals/users/') { - $this->session = $session; + private IThrottler $throttler, + string $principalPrefix = 'principals/users/', + ) { $this->userSession = $userSession; $this->twoFactorManager = $twoFactorManager; - $this->request = $request; - $this->throttler = $throttler; $this->principalPrefix = $principalPrefix; // setup realm diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index d5840848cef..1b85a971553 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -14,20 +14,12 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class BearerAuth extends AbstractBearer { - private IUserSession $userSession; - private ISession $session; - private IRequest $request; - private string $principalPrefix; - - public function __construct(IUserSession $userSession, - ISession $session, - IRequest $request, - $principalPrefix = 'principals/users/') { - $this->userSession = $userSession; - $this->session = $session; - $this->request = $request; - $this->principalPrefix = $principalPrefix; - + public function __construct( + private IUserSession $userSession, + private ISession $session, + private IRequest $request, + private string $principalPrefix = 'principals/users/', + ) { // setup realm $defaults = new Defaults(); $this->realm = $defaults->getName() ?: 'Nextcloud'; diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index 65e77cea285..e4b6c2636da 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -20,13 +20,12 @@ class CommentPropertiesPlugin extends ServerPlugin { public const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread'; protected ?Server $server = null; - private ICommentsManager $commentsManager; - private IUserSession $userSession; private array $cachedUnreadCount = []; - public function __construct(ICommentsManager $commentsManager, IUserSession $userSession) { - $this->commentsManager = $commentsManager; - $this->userSession = $userSession; + public function __construct( + private ICommentsManager $commentsManager, + private IUserSession $userSession, + ) { } /** diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index c520a6c5a84..a193417831c 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -39,20 +39,23 @@ use Sabre\DAV\INode; class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget { /** * Cached directory content - * @var \OCP\Files\FileInfo[] + * @var FileInfo[] */ private ?array $dirContent = null; /** Cached quota info */ private ?array $quotaInfo = null; - private ?CachingTree $tree = null; /** * Sets up the node, expects a full path name */ - public function __construct(View $view, FileInfo $info, ?CachingTree $tree = null, ?IShareManager $shareManager = null) { + public function __construct( + View $view, + FileInfo $info, + private ?CachingTree $tree = null, + ?IShareManager $shareManager = null, + ) { parent::__construct($view, $info, $shareManager); - $this->tree = $tree; } /** @@ -161,7 +164,7 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot * Returns a specific child node, referenced by its name * * @param string $name - * @param \OCP\Files\FileInfo $info + * @param FileInfo $info * @return \Sabre\DAV\INode * @throws InvalidPath * @throws \Sabre\DAV\Exception\NotFound @@ -360,10 +363,6 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot throw new BadRequest('Incompatible node types'); } - if (!$this->fileView) { - throw new ServiceUnavailable('filesystem not setup'); - } - $destinationPath = $this->getPath() . '/' . $targetName; diff --git a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php index 0dd346a2546..95d4b3ab514 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php +++ b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php @@ -11,18 +11,16 @@ class Forbidden extends \Sabre\DAV\Exception\Forbidden { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** - * @var bool - */ - private $retry; - - /** * @param string $message * @param bool $retry * @param \Exception $previous */ - public function __construct($message, $retry = false, ?\Exception $previous = null) { + public function __construct( + $message, + private $retry = false, + ?\Exception $previous = null, + ) { parent::__construct($message, 0, $previous); - $this->retry = $retry; } /** diff --git a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php index a9ec8ffef9a..dfc08aa8b88 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php +++ b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php @@ -13,18 +13,16 @@ class InvalidPath extends Exception { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** - * @var bool - */ - private $retry; - - /** * @param string $message * @param bool $retry * @param \Exception|null $previous */ - public function __construct($message, $retry = false, ?\Exception $previous = null) { + public function __construct( + $message, + private $retry = false, + ?\Exception $previous = null, + ) { parent::__construct($message, 0, $previous); - $this->retry = $retry; } /** diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php index 2e8fcefe577..686386dbfef 100644 --- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php @@ -67,15 +67,13 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { ServerMaintenanceMode::class => true, ]; - private string $appName; - private LoggerInterface $logger; - /** - * @param string $loggerAppName app name to use when logging + * @param string $appName app name to use when logging */ - public function __construct(string $loggerAppName, LoggerInterface $logger) { - $this->appName = $loggerAppName; - $this->logger = $logger; + public function __construct( + private string $appName, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 36ac0fcec72..cafb00fbe1e 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -53,8 +53,8 @@ class File extends Node implements IFile { /** * Sets up the node, expects a full path name * - * @param \OC\Files\View $view - * @param \OCP\Files\FileInfo $info + * @param View $view + * @param FileInfo $info * @param ?\OCP\Share\IManager $shareManager * @param ?IRequest $request * @param ?IL10N $l10n diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 49ceff9118d..c44dcc0d2da 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -42,55 +42,8 @@ class FilesReportPlugin extends ServerPlugin { private $server; /** - * @var Tree - */ - private $tree; - - /** - * @var View - */ - private $fileView; - - /** - * @var ISystemTagManager - */ - private $tagManager; - - /** - * @var ISystemTagObjectMapper - */ - private $tagMapper; - - /** - * Manager for private tags - * - * @var ITagManager - */ - private $fileTagger; - - /** - * @var IUserSession - */ - private $userSession; - - /** - * @var IGroupManager - */ - private $groupManager; - - /** - * @var Folder - */ - private $userFolder; - - /** - * @var IAppManager - */ - private $appManager; - - /** * @param Tree $tree - * @param View $view + * @param View $fileView * @param ISystemTagManager $tagManager * @param ISystemTagObjectMapper $tagMapper * @param ITagManager $fileTagger manager for private tags @@ -99,25 +52,20 @@ class FilesReportPlugin extends ServerPlugin { * @param Folder $userFolder * @param IAppManager $appManager */ - public function __construct(Tree $tree, - View $view, - ISystemTagManager $tagManager, - ISystemTagObjectMapper $tagMapper, - ITagManager $fileTagger, - IUserSession $userSession, - IGroupManager $groupManager, - Folder $userFolder, - IAppManager $appManager, + public function __construct( + private Tree $tree, + private View $fileView, + private ISystemTagManager $tagManager, + private ISystemTagObjectMapper $tagMapper, + /** + * Manager for private tags + */ + private ITagManager $fileTagger, + private IUserSession $userSession, + private IGroupManager $groupManager, + private Folder $userFolder, + private IAppManager $appManager, ) { - $this->tree = $tree; - $this->fileView = $view; - $this->tagManager = $tagManager; - $this->tagMapper = $tagMapper; - $this->fileTagger = $fileTagger; - $this->userSession = $userSession; - $this->groupManager = $groupManager; - $this->userFolder = $userFolder; - $this->appManager = $appManager; } /** diff --git a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php index 8d23a05a3ec..d5ab7f09dfa 100644 --- a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php +++ b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php @@ -16,10 +16,7 @@ use Sabre\DAV\ServerPlugin; class MaintenancePlugin extends ServerPlugin { - /** @var IConfig */ - private $config; - - /** @var \OCP\IL10N */ + /** @var IL10N */ private $l10n; /** @@ -32,8 +29,10 @@ class MaintenancePlugin extends ServerPlugin { /** * @param IConfig $config */ - public function __construct(IConfig $config, IL10N $l10n) { - $this->config = $config; + public function __construct( + private IConfig $config, + IL10N $l10n, + ) { $this->l10n = \OC::$server->getL10N('dav'); } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 93cf302ff89..4ee6283b0d2 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -25,11 +25,6 @@ use OCP\Share\IManager; abstract class Node implements \Sabre\DAV\INode { /** - * @var View - */ - protected $fileView; - - /** * The path to the current node * * @var string @@ -55,8 +50,11 @@ abstract class Node implements \Sabre\DAV\INode { /** * Sets up the node, expects a full path name */ - public function __construct(View $view, FileInfo $info, ?IManager $shareManager = null) { - $this->fileView = $view; + public function __construct( + protected View $fileView, + FileInfo $info, + ?IManager $shareManager = null, + ) { $this->path = $this->fileView->getRelativePath($info->getPath()); $this->info = $info; if ($shareManager) { diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index 6cdd5708743..bfbdfb33db0 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -9,6 +9,7 @@ namespace OCA\DAV\Connector\Sabre; use OC\Files\FileInfo; use OC\Files\Storage\FailedStorage; +use OC\Files\Storage\Storage; use OC\Files\View; use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OCA\DAV\Connector\Sabre\Exception\Forbidden; @@ -23,12 +24,12 @@ use OCP\Lock\LockedException; class ObjectTree extends CachingTree { /** - * @var \OC\Files\View + * @var View */ protected $fileView; /** - * @var \OCP\Files\Mount\IMountManager + * @var IMountManager */ protected $mountManager; @@ -40,8 +41,8 @@ class ObjectTree extends CachingTree { /** * @param \Sabre\DAV\INode $rootNode - * @param \OC\Files\View $view - * @param \OCP\Files\Mount\IMountManager $mountManager + * @param View $view + * @param IMountManager $mountManager */ public function init(\Sabre\DAV\INode $rootNode, View $view, IMountManager $mountManager) { $this->rootNode = $rootNode; @@ -91,7 +92,7 @@ class ObjectTree extends CachingTree { $internalPath = $mount->getInternalPath($absPath); if ($storage && $storage->file_exists($internalPath)) { /** - * @var \OC\Files\Storage\Storage $storage + * @var Storage $storage */ // get data directly $data = $storage->getMetaData($internalPath); diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 0151bc9cf69..515ef807a25 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -9,6 +9,7 @@ namespace OCA\DAV\Connector\Sabre; use OC\KnownUser\KnownUserService; use OCA\Circles\Api\v1\Circles; use OCA\Circles\Exceptions\CircleNotFoundException; +use OCA\Circles\Model\Circle; use OCA\DAV\CalDAV\Proxy\ProxyMapper; use OCA\DAV\Traits\PrincipalProxyTrait; use OCP\Accounts\IAccountManager; @@ -31,24 +32,6 @@ use Sabre\DAVACL\PrincipalBackend\BackendInterface; class Principal implements BackendInterface { - /** @var IUserManager */ - private $userManager; - - /** @var IGroupManager */ - private $groupManager; - - /** @var IAccountManager */ - private $accountManager; - - /** @var IShareManager */ - private $shareManager; - - /** @var IUserSession */ - private $userSession; - - /** @var IAppManager */ - private $appManager; - /** @var string */ private $principalPrefix; @@ -64,34 +47,23 @@ class Principal implements BackendInterface { /** @var KnownUserService */ private $knownUserService; - /** @var IConfig */ - private $config; - /** @var IFactory */ - private $languageFactory; - - public function __construct(IUserManager $userManager, - IGroupManager $groupManager, - IAccountManager $accountManager, - IShareManager $shareManager, - IUserSession $userSession, - IAppManager $appManager, + public function __construct( + private IUserManager $userManager, + private IGroupManager $groupManager, + private IAccountManager $accountManager, + private IShareManager $shareManager, + private IUserSession $userSession, + private IAppManager $appManager, ProxyMapper $proxyMapper, KnownUserService $knownUserService, - IConfig $config, - IFactory $languageFactory, - string $principalPrefix = 'principals/users/') { - $this->userManager = $userManager; - $this->groupManager = $groupManager; - $this->accountManager = $accountManager; - $this->shareManager = $shareManager; - $this->userSession = $userSession; - $this->appManager = $appManager; + private IConfig $config, + private IFactory $languageFactory, + string $principalPrefix = 'principals/users/', + ) { $this->principalPrefix = trim($principalPrefix, '/'); $this->hasGroups = $this->hasCircles = ($principalPrefix === 'principals/users/'); $this->proxyMapper = $proxyMapper; $this->knownUserService = $knownUserService; - $this->config = $config; - $this->languageFactory = $languageFactory; } use PrincipalProxyTrait { @@ -556,7 +528,7 @@ class Principal implements BackendInterface { * @param string $principal * @return array * @throws Exception - * @throws \OCP\AppFramework\QueryException + * @throws QueryException * @suppress PhanUndeclaredClassMethod */ public function getCircleMembership($principal):array { @@ -574,7 +546,7 @@ class Principal implements BackendInterface { $circles = Circles::joinedCircles($name, true); $circles = array_map(function ($circle) { - /** @var \OCA\Circles\Model\Circle $circle */ + /** @var Circle $circle */ return 'principals/circles/' . urlencode($circle->getSingleId()); }, $circles); diff --git a/apps/dav/lib/Connector/Sabre/PublicAuth.php b/apps/dav/lib/Connector/Sabre/PublicAuth.php index 977b3bf304e..ea59d9efc8f 100644 --- a/apps/dav/lib/Connector/Sabre/PublicAuth.php +++ b/apps/dav/lib/Connector/Sabre/PublicAuth.php @@ -37,23 +37,14 @@ class PublicAuth extends AbstractBasic { public const DAV_AUTHENTICATED = 'public_link_authenticated'; private ?IShare $share = null; - private IManager $shareManager; - private ISession $session; - private IRequest $request; - private IThrottler $throttler; - private LoggerInterface $logger; - - public function __construct(IRequest $request, - IManager $shareManager, - ISession $session, - IThrottler $throttler, - LoggerInterface $logger) { - $this->request = $request; - $this->shareManager = $shareManager; - $this->session = $session; - $this->throttler = $throttler; - $this->logger = $logger; + public function __construct( + private IRequest $request, + private IManager $shareManager, + private ISession $session, + private IThrottler $throttler, + private LoggerInterface $logger, + ) { // setup realm $defaults = new Defaults(); $this->realm = $defaults->getName(); diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php index deaa4cf672b..9790fc99837 100644 --- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php +++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php @@ -8,6 +8,7 @@ */ namespace OCA\DAV\Connector\Sabre; +use OC\Files\View; use OCA\DAV\Upload\FutureFile; use OCA\DAV\Upload\UploadFolder; use OCP\Files\StorageNotAvailableException; @@ -23,9 +24,6 @@ use Sabre\DAV\INode; * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License */ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { - /** @var \OC\Files\View */ - private $view; - /** * Reference to main server object * @@ -34,10 +32,11 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { private $server; /** - * @param \OC\Files\View $view + * @param View $view */ - public function __construct($view) { - $this->view = $view; + public function __construct( + private $view, + ) { } /** diff --git a/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php index f856fca51e1..5484bab9237 100644 --- a/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php @@ -13,11 +13,9 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class RequestIdHeaderPlugin extends \Sabre\DAV\ServerPlugin { - /** @var IRequest */ - private $request; - - public function __construct(IRequest $request) { - $this->request = $request; + public function __construct( + private IRequest $request, + ) { } public function initialize(\Sabre\DAV\Server $server) { diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index 967bd0a74b8..3aabb828d9c 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -7,6 +7,7 @@ */ namespace OCA\DAV\Connector\Sabre; +use OC\Files\View; use OCA\DAV\AppInfo\PluginManager; use OCA\DAV\CalDAV\DefaultCalendarValidator; use OCA\DAV\DAV\CustomPropertiesBackend; @@ -96,7 +97,7 @@ class ServerFactory { // ensure the skeleton is copied $userFolder = \OC::$server->getUserFolder(); - /** @var \OC\Files\View $view */ + /** @var View $view */ $view = $viewCallBack($server); if ($userFolder instanceof Folder && $userFolder->getPath() === $view->getRoot()) { $rootInfo = $userFolder; diff --git a/apps/dav/lib/Connector/Sabre/ShareTypeList.php b/apps/dav/lib/Connector/Sabre/ShareTypeList.php index abe56cd0301..0b66ed27576 100644 --- a/apps/dav/lib/Connector/Sabre/ShareTypeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareTypeList.php @@ -20,17 +20,14 @@ class ShareTypeList implements Element { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** - * Share types - * - * @var int[] - */ - private $shareTypes; - - /** * @param int[] $shareTypes */ - public function __construct($shareTypes) { - $this->shareTypes = $shareTypes; + public function __construct( + /** + * Share types + */ + private $shareTypes, + ) { } /** diff --git a/apps/dav/lib/Connector/Sabre/ShareeList.php b/apps/dav/lib/Connector/Sabre/ShareeList.php index b8f9f98d1c7..909c29fc24b 100644 --- a/apps/dav/lib/Connector/Sabre/ShareeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareeList.php @@ -18,11 +18,10 @@ use Sabre\Xml\XmlSerializable; class ShareeList implements XmlSerializable { public const NS_NEXTCLOUD = 'http://nextcloud.org/ns'; - /** @var IShare[] */ - private $shares; - - public function __construct(array $shares) { - $this->shares = $shares; + public function __construct( + /** @var IShare[] */ + private array $shares, + ) { } /** diff --git a/apps/dav/lib/Connector/Sabre/TagList.php b/apps/dav/lib/Connector/Sabre/TagList.php index 5537acc452c..9a5cd0d51cf 100644 --- a/apps/dav/lib/Connector/Sabre/TagList.php +++ b/apps/dav/lib/Connector/Sabre/TagList.php @@ -20,17 +20,14 @@ class TagList implements Element { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** - * tags - * - * @var array - */ - private $tags; - - /** * @param array $tags */ - public function __construct(array $tags) { - $this->tags = $tags; + public function __construct( + /** + * tags + */ + private array $tags, + ) { } /** diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index c048b79484a..7f05d4d3c03 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -28,6 +28,7 @@ namespace OCA\DAV\Connector\Sabre; * */ use OCP\ITagManager; +use OCP\ITags; use Sabre\DAV\PropFind; use Sabre\DAV\PropPatch; @@ -47,12 +48,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { private $server; /** - * @var \OCP\ITagManager - */ - private $tagManager; - - /** - * @var \OCP\ITags + * @var ITags */ private $tagger; @@ -65,17 +61,13 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { private $cachedTags; /** - * @var \Sabre\DAV\Tree - */ - private $tree; - - /** * @param \Sabre\DAV\Tree $tree tree - * @param \OCP\ITagManager $tagManager tag manager + * @param ITagManager $tagManager tag manager */ - public function __construct(\Sabre\DAV\Tree $tree, ITagManager $tagManager) { - $this->tree = $tree; - $this->tagManager = $tagManager; + public function __construct( + private \Sabre\DAV\Tree $tree, + private ITagManager $tagManager, + ) { $this->tagger = null; $this->cachedTags = []; } @@ -103,7 +95,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { /** * Returns the tagger * - * @return \OCP\ITags tagger + * @return ITags tagger */ private function getTagger() { if (!$this->tagger) { diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php index 9e18b5111a8..d3a9239dd22 100644 --- a/apps/dav/lib/Controller/BirthdayCalendarController.php +++ b/apps/dav/lib/Controller/BirthdayCalendarController.php @@ -22,31 +22,6 @@ use OCP\IUserManager; class BirthdayCalendarController extends Controller { /** - * @var IDBConnection - */ - protected $db; - - /** - * @var IConfig - */ - protected $config; - - /** - * @var IUserManager - */ - protected $userManager; - - /** - * @var CalDavBackend - */ - protected $caldavBackend; - - /** - * @var IJobList - */ - protected $jobList; - - /** * BirthdayCalendar constructor. * * @param string $appName @@ -55,19 +30,18 @@ class BirthdayCalendarController extends Controller { * @param IConfig $config * @param IJobList $jobList * @param IUserManager $userManager - * @param CalDavBackend $calDavBackend + * @param CalDavBackend $caldavBackend */ - public function __construct($appName, IRequest $request, - IDBConnection $db, IConfig $config, - IJobList $jobList, - IUserManager $userManager, - CalDavBackend $calDavBackend) { + public function __construct( + $appName, + IRequest $request, + protected IDBConnection $db, + protected IConfig $config, + protected IJobList $jobList, + protected IUserManager $userManager, + protected CalDavBackend $caldavBackend, + ) { parent::__construct($appName, $request); - $this->db = $db; - $this->config = $config; - $this->userManager = $userManager; - $this->jobList = $jobList; - $this->caldavBackend = $calDavBackend; } /** diff --git a/apps/dav/lib/Controller/DirectController.php b/apps/dav/lib/Controller/DirectController.php index 80e00e93ca7..ea209168123 100644 --- a/apps/dav/lib/Controller/DirectController.php +++ b/apps/dav/lib/Controller/DirectController.php @@ -28,45 +28,18 @@ use OCP\Security\ISecureRandom; class DirectController extends OCSController { - /** @var IRootFolder */ - private $rootFolder; - - /** @var string */ - private $userId; - - /** @var DirectMapper */ - private $mapper; - - /** @var ISecureRandom */ - private $random; - - /** @var ITimeFactory */ - private $timeFactory; - - /** @var IURLGenerator */ - private $urlGenerator; - - /** @var IEventDispatcher */ - private $eventDispatcher; - - public function __construct(string $appName, + public function __construct( + string $appName, IRequest $request, - IRootFolder $rootFolder, - string $userId, - DirectMapper $mapper, - ISecureRandom $random, - ITimeFactory $timeFactory, - IURLGenerator $urlGenerator, - IEventDispatcher $eventDispatcher) { + private IRootFolder $rootFolder, + private string $userId, + private DirectMapper $mapper, + private ISecureRandom $random, + private ITimeFactory $timeFactory, + private IURLGenerator $urlGenerator, + private IEventDispatcher $eventDispatcher, + ) { parent::__construct($appName, $request); - - $this->rootFolder = $rootFolder; - $this->userId = $userId; - $this->mapper = $mapper; - $this->random = $random; - $this->timeFactory = $timeFactory; - $this->urlGenerator = $urlGenerator; - $this->eventDispatcher = $eventDispatcher; } /** diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index cf4e24e8f1c..19eb4097b45 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -23,15 +23,6 @@ use Sabre\VObject\Reader; #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] class InvitationResponseController extends Controller { - /** @var IDBConnection */ - private $db; - - /** @var ITimeFactory */ - private $timeFactory; - - /** @var InvitationResponseServer */ - private $responseServer; - /** * InvitationResponseController constructor. * @@ -41,13 +32,14 @@ class InvitationResponseController extends Controller { * @param ITimeFactory $timeFactory * @param InvitationResponseServer $responseServer */ - public function __construct(string $appName, IRequest $request, - IDBConnection $db, ITimeFactory $timeFactory, - InvitationResponseServer $responseServer) { + public function __construct( + string $appName, + IRequest $request, + private IDBConnection $db, + private ITimeFactory $timeFactory, + private InvitationResponseServer $responseServer, + ) { parent::__construct($appName, $request); - $this->db = $db; - $this->timeFactory = $timeFactory; - $this->responseServer = $responseServer; // Don't run `$server->exec()`, because we just need access to the // fully initialized schedule plugin, but we don't want Sabre/DAV // to actually handle and reply to the request diff --git a/apps/dav/lib/Controller/UpcomingEventsController.php b/apps/dav/lib/Controller/UpcomingEventsController.php index 879fe05d613..c8eb39abb17 100644 --- a/apps/dav/lib/Controller/UpcomingEventsController.php +++ b/apps/dav/lib/Controller/UpcomingEventsController.php @@ -23,17 +23,12 @@ use OCP\IRequest; * @psalm-import-type DAVUpcomingEvent from ResponseDefinitions */ class UpcomingEventsController extends OCSController { - private ?string $userId; - private UpcomingEventsService $service; - public function __construct( IRequest $request, - ?string $userId, - UpcomingEventsService $service) { + private ?string $userId, + private UpcomingEventsService $service, + ) { parent::__construct(Application::APP_ID, $request); - - $this->userId = $userId; - $this->service = $service; } /** diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index dde97cabf37..f73246161ba 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -113,30 +113,12 @@ class CustomPropertiesBackend implements BackendInterface { ]; /** - * @var Tree - */ - private $tree; - - /** - * @var IDBConnection - */ - private $connection; - - /** - * @var IUser - */ - private $user; - - /** * Properties cache * * @var array */ private $userCache = []; - - private Server $server; private XmlService $xmlService; - private DefaultCalendarValidator $defaultCalendarValidator; /** * @param Tree $tree node tree @@ -144,22 +126,17 @@ class CustomPropertiesBackend implements BackendInterface { * @param IUser $user owner of the tree and properties */ public function __construct( - Server $server, - Tree $tree, - IDBConnection $connection, - IUser $user, - DefaultCalendarValidator $defaultCalendarValidator, + private Server $server, + private Tree $tree, + private IDBConnection $connection, + private IUser $user, + private DefaultCalendarValidator $defaultCalendarValidator, ) { - $this->server = $server; - $this->tree = $tree; - $this->connection = $connection; - $this->user = $user; $this->xmlService = new XmlService(); $this->xmlService->elementMap = array_merge( $this->xmlService->elementMap, self::COMPLEX_XML_ELEMENT_MAP, ); - $this->defaultCalendarValidator = $defaultCalendarValidator; } /** diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 887f3b2d7e9..143fc7d69f1 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -20,32 +20,17 @@ use Sabre\DAVACL\PrincipalBackend\BackendInterface; class GroupPrincipalBackend implements BackendInterface { public const PRINCIPAL_PREFIX = 'principals/groups'; - /** @var IGroupManager */ - private $groupManager; - - /** @var IUserSession */ - private $userSession; - - /** @var IShareManager */ - private $shareManager; - /** @var IConfig */ - private $config; - /** - * @param IGroupManager $IGroupManager + * @param IGroupManager $groupManager * @param IUserSession $userSession * @param IShareManager $shareManager */ public function __construct( - IGroupManager $IGroupManager, - IUserSession $userSession, - IShareManager $shareManager, - IConfig $config, + private IGroupManager $groupManager, + private IUserSession $userSession, + private IShareManager $shareManager, + private IConfig $config, ) { - $this->groupManager = $IGroupManager; - $this->userSession = $userSession; - $this->shareManager = $shareManager; - $this->config = $config; } /** diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index c228d6993c2..cef8dc0b689 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -26,26 +26,18 @@ class Plugin extends ServerPlugin { public const NS_OWNCLOUD = 'http://owncloud.org/ns'; public const NS_NEXTCLOUD = 'http://nextcloud.com/ns'; - /** @var Auth */ - private $auth; - - /** @var IRequest */ - private $request; - - /** @var IConfig */ - private $config; - /** * Plugin constructor. * - * @param Auth $authBackEnd + * @param Auth $auth * @param IRequest $request * @param IConfig $config */ - public function __construct(Auth $authBackEnd, IRequest $request, IConfig $config) { - $this->auth = $authBackEnd; - $this->request = $request; - $this->config = $config; + public function __construct( + private Auth $auth, + private IRequest $request, + private IConfig $config, + ) { } /** diff --git a/apps/dav/lib/DAV/Sharing/Xml/Invite.php b/apps/dav/lib/DAV/Sharing/Xml/Invite.php index 91eda03f45b..7a20dbe6df7 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/Invite.php +++ b/apps/dav/lib/DAV/Sharing/Xml/Invite.php @@ -27,21 +27,6 @@ use Sabre\Xml\XmlSerializable; class Invite implements XmlSerializable { /** - * The list of users a calendar has been shared to. - * - * @var array - */ - protected $users; - - /** - * The organizer contains information about the person who shared the - * object. - * - * @var array|null - */ - protected $organizer; - - /** * Creates the property. * * Users is an array. Each element of the array has the following @@ -67,9 +52,17 @@ class Invite implements XmlSerializable { * * @param array $users */ - public function __construct(array $users, ?array $organizer = null) { - $this->users = $users; - $this->organizer = $organizer; + public function __construct( + /** + * The list of users a calendar has been shared to. + */ + protected array $users, + /** + * The organizer contains information about the person who shared the + * object. + */ + protected ?array $organizer = null, + ) { } /** diff --git a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php index aa3a880df6b..aefb39c5701 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php +++ b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php @@ -12,19 +12,16 @@ use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; class ShareRequest implements XmlDeserializable { - public $set = []; - - public $remove = []; - /** * Constructor * * @param array $set * @param array $remove */ - public function __construct(array $set, array $remove) { - $this->set = $set; - $this->remove = $remove; + public function __construct( + public array $set, + public array $remove, + ) { } public static function xmlDeserialize(Reader $reader) { diff --git a/apps/dav/lib/DAV/ViewOnlyPlugin.php b/apps/dav/lib/DAV/ViewOnlyPlugin.php index d8c8649b4b7..d53a74923fe 100644 --- a/apps/dav/lib/DAV/ViewOnlyPlugin.php +++ b/apps/dav/lib/DAV/ViewOnlyPlugin.php @@ -24,12 +24,10 @@ use Sabre\HTTP\RequestInterface; */ class ViewOnlyPlugin extends ServerPlugin { private ?Server $server = null; - private ?Folder $userFolder; public function __construct( - ?Folder $userFolder, + private ?Folder $userFolder, ) { - $this->userFolder = $userFolder; } /** diff --git a/apps/dav/lib/Direct/DirectFile.php b/apps/dav/lib/Direct/DirectFile.php index 3c684b83ef2..7f41dd65f41 100644 --- a/apps/dav/lib/Direct/DirectFile.php +++ b/apps/dav/lib/Direct/DirectFile.php @@ -18,21 +18,14 @@ use Sabre\DAV\Exception\NotFound; use Sabre\DAV\IFile; class DirectFile implements IFile { - /** @var Direct */ - private $direct; - - /** @var IRootFolder */ - private $rootFolder; - /** @var File */ private $file; - private $eventDispatcher; - - public function __construct(Direct $direct, IRootFolder $rootFolder, IEventDispatcher $eventDispatcher) { - $this->direct = $direct; - $this->rootFolder = $rootFolder; - $this->eventDispatcher = $eventDispatcher; + public function __construct( + private Direct $direct, + private IRootFolder $rootFolder, + private IEventDispatcher $eventDispatcher, + ) { } public function put($data) { diff --git a/apps/dav/lib/Direct/DirectHome.php b/apps/dav/lib/Direct/DirectHome.php index 66fe6f0f3d4..10e1017f5a4 100644 --- a/apps/dav/lib/Direct/DirectHome.php +++ b/apps/dav/lib/Direct/DirectHome.php @@ -22,38 +22,14 @@ use Sabre\DAV\ICollection; class DirectHome implements ICollection { - /** @var IRootFolder */ - private $rootFolder; - - /** @var DirectMapper */ - private $mapper; - - /** @var ITimeFactory */ - private $timeFactory; - - /** @var IThrottler */ - private $throttler; - - /** @var IRequest */ - private $request; - - /** @var IEventDispatcher */ - private $eventDispatcher; - public function __construct( - IRootFolder $rootFolder, - DirectMapper $mapper, - ITimeFactory $timeFactory, - IThrottler $throttler, - IRequest $request, - IEventDispatcher $eventDispatcher, + private IRootFolder $rootFolder, + private DirectMapper $mapper, + private ITimeFactory $timeFactory, + private IThrottler $throttler, + private IRequest $request, + private IEventDispatcher $eventDispatcher, ) { - $this->rootFolder = $rootFolder; - $this->mapper = $mapper; - $this->timeFactory = $timeFactory; - $this->throttler = $throttler; - $this->request = $request; - $this->eventDispatcher = $eventDispatcher; } public function createFile($name, $data = null) { diff --git a/apps/dav/lib/Direct/ServerFactory.php b/apps/dav/lib/Direct/ServerFactory.php index e64dc3a3266..473439361c2 100644 --- a/apps/dav/lib/Direct/ServerFactory.php +++ b/apps/dav/lib/Direct/ServerFactory.php @@ -20,17 +20,15 @@ use OCP\L10N\IFactory; use OCP\Security\Bruteforce\IThrottler; class ServerFactory { - /** @var IConfig */ - private $config; /** @var IL10N */ private $l10n; - /** @var IEventDispatcher */ - private $eventDispatcher; - public function __construct(IConfig $config, IFactory $l10nFactory, IEventDispatcher $eventDispatcher) { - $this->config = $config; + public function __construct( + private IConfig $config, + IFactory $l10nFactory, + private IEventDispatcher $eventDispatcher, + ) { $this->l10n = $l10nFactory->get('dav'); - $this->eventDispatcher = $eventDispatcher; } public function createServer(string $baseURI, diff --git a/apps/dav/lib/Events/AddressBookCreatedEvent.php b/apps/dav/lib/Events/AddressBookCreatedEvent.php index ec8e3cb6116..1a56bcbf63f 100644 --- a/apps/dav/lib/Events/AddressBookCreatedEvent.php +++ b/apps/dav/lib/Events/AddressBookCreatedEvent.php @@ -18,12 +18,6 @@ use OCP\EventDispatcher\Event; */ class AddressBookCreatedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - /** * AddressBookCreatedEvent constructor. * @@ -31,11 +25,11 @@ class AddressBookCreatedEvent extends Event { * @param array $addressBookData * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; } /** diff --git a/apps/dav/lib/Events/AddressBookDeletedEvent.php b/apps/dav/lib/Events/AddressBookDeletedEvent.php index bc46106a47a..b1ec4125513 100644 --- a/apps/dav/lib/Events/AddressBookDeletedEvent.php +++ b/apps/dav/lib/Events/AddressBookDeletedEvent.php @@ -18,15 +18,6 @@ use OCP\EventDispatcher\Event; */ class AddressBookDeletedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - - /** @var array */ - private $shares; - /** * AddressBookDeletedEvent constructor. * @@ -35,13 +26,12 @@ class AddressBookDeletedEvent extends Event { * @param array $shares * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData, - array $shares) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + private array $shares, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; - $this->shares = $shares; } /** diff --git a/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php b/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php index 14a63bee4a6..9a574fb548e 100644 --- a/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php +++ b/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php @@ -18,21 +18,6 @@ use OCP\EventDispatcher\Event; */ class AddressBookShareUpdatedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - - /** @var array */ - private $oldShares; - - /** @var array */ - private $added; - - /** @var array */ - private $removed; - /** * AddressBookShareUpdatedEvent constructor. * @@ -43,17 +28,14 @@ class AddressBookShareUpdatedEvent extends Event { * @param array $removed * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData, - array $oldShares, - array $added, - array $removed) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + private array $oldShares, + private array $added, + private array $removed, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; - $this->oldShares = $oldShares; - $this->added = $added; - $this->removed = $removed; } /** diff --git a/apps/dav/lib/Events/AddressBookUpdatedEvent.php b/apps/dav/lib/Events/AddressBookUpdatedEvent.php index 48e2f101f7e..fe6dc024cd2 100644 --- a/apps/dav/lib/Events/AddressBookUpdatedEvent.php +++ b/apps/dav/lib/Events/AddressBookUpdatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class AddressBookUpdatedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - - /** @var array */ - private $shares; - - /** @var array */ - private $mutations; - /** * AddressBookUpdatedEvent constructor. * @@ -39,15 +27,13 @@ class AddressBookUpdatedEvent extends Event { * @param array $mutations * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $mutations) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + private array $shares, + private array $mutations, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; - $this->shares = $shares; - $this->mutations = $mutations; } /** diff --git a/apps/dav/lib/Events/BeforeFileDirectDownloadedEvent.php b/apps/dav/lib/Events/BeforeFileDirectDownloadedEvent.php index adaa7f1a81c..a79d730e8ff 100644 --- a/apps/dav/lib/Events/BeforeFileDirectDownloadedEvent.php +++ b/apps/dav/lib/Events/BeforeFileDirectDownloadedEvent.php @@ -15,11 +15,10 @@ use OCP\Files\File; * @since 22.0.0 */ class BeforeFileDirectDownloadedEvent extends Event { - private $file; - - public function __construct(File $file) { + public function __construct( + private File $file, + ) { parent::__construct(); - $this->file = $file; } /** diff --git a/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php b/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php index 536472de6fe..ea1c344ed27 100644 --- a/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php +++ b/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CachedCalendarObjectCreatedEvent extends Event { - /** @var int */ - private $subscriptionId; - - /** @var array */ - private $subscriptionData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * CachedCalendarObjectCreatedEvent constructor. * @@ -39,15 +27,13 @@ class CachedCalendarObjectCreatedEvent extends Event { * @param array $objectData * @since 20.0.0 */ - public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $objectData) { + public function __construct( + private int $subscriptionId, + private array $subscriptionData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->subscriptionId = $subscriptionId; - $this->subscriptionData = $subscriptionData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php b/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php index c3d98fd94d9..8f8e55d32e5 100644 --- a/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php +++ b/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CachedCalendarObjectDeletedEvent extends Event { - /** @var int */ - private $subscriptionId; - - /** @var array */ - private $subscriptionData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * CachedCalendarObjectDeletedEvent constructor. * @@ -39,15 +27,13 @@ class CachedCalendarObjectDeletedEvent extends Event { * @param array $objectData * @since 20.0.0 */ - public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $objectData) { + public function __construct( + private int $subscriptionId, + private array $subscriptionData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->subscriptionId = $subscriptionId; - $this->subscriptionData = $subscriptionData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php b/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php index 12c712a2aa7..0adb4164dc9 100644 --- a/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php +++ b/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CachedCalendarObjectUpdatedEvent extends Event { - /** @var int */ - private $subscriptionId; - - /** @var array */ - private $subscriptionData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * CachedCalendarObjectUpdatedEvent constructor. * @@ -39,15 +27,13 @@ class CachedCalendarObjectUpdatedEvent extends Event { * @param array $objectData * @since 20.0.0 */ - public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $objectData) { + public function __construct( + private int $subscriptionId, + private array $subscriptionData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->subscriptionId = $subscriptionId; - $this->subscriptionData = $subscriptionData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarCreatedEvent.php b/apps/dav/lib/Events/CalendarCreatedEvent.php index abefda54358..46d1194914e 100644 --- a/apps/dav/lib/Events/CalendarCreatedEvent.php +++ b/apps/dav/lib/Events/CalendarCreatedEvent.php @@ -18,12 +18,6 @@ use OCP\EventDispatcher\Event; */ class CalendarCreatedEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - /** * CalendarCreatedEvent constructor. * @@ -31,11 +25,11 @@ class CalendarCreatedEvent extends Event { * @param array $calendarData * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData) { + public function __construct( + private int $calendarId, + private array $calendarData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; } /** diff --git a/apps/dav/lib/Events/CalendarDeletedEvent.php b/apps/dav/lib/Events/CalendarDeletedEvent.php index 326af0702ad..c8ab4265b27 100644 --- a/apps/dav/lib/Events/CalendarDeletedEvent.php +++ b/apps/dav/lib/Events/CalendarDeletedEvent.php @@ -18,15 +18,6 @@ use OCP\EventDispatcher\Event; */ class CalendarDeletedEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - /** * CalendarDeletedEvent constructor. * @@ -35,13 +26,12 @@ class CalendarDeletedEvent extends Event { * @param array $shares * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; } /** diff --git a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php index b2eb8e1f018..8bb660a98c6 100644 --- a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php +++ b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php @@ -15,28 +15,18 @@ use OCP\EventDispatcher\Event; */ class CalendarMovedToTrashEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - /** * @param int $calendarId * @param array $calendarData * @param array $shares * @since 22.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; } /** diff --git a/apps/dav/lib/Events/CalendarObjectCreatedEvent.php b/apps/dav/lib/Events/CalendarObjectCreatedEvent.php index 5531f9954e7..187ded2dcd4 100644 --- a/apps/dav/lib/Events/CalendarObjectCreatedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectCreatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CalendarObjectCreatedEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * CalendarObjectCreatedEvent constructor. * @@ -39,15 +27,13 @@ class CalendarObjectCreatedEvent extends Event { * @param array $objectData * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarObjectDeletedEvent.php b/apps/dav/lib/Events/CalendarObjectDeletedEvent.php index f3a1441fbc2..9928080f99b 100644 --- a/apps/dav/lib/Events/CalendarObjectDeletedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectDeletedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CalendarObjectDeletedEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * CalendarObjectDeletedEvent constructor. * @@ -39,15 +27,13 @@ class CalendarObjectDeletedEvent extends Event { * @param array $objectData * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarObjectMovedEvent.php b/apps/dav/lib/Events/CalendarObjectMovedEvent.php index b3adfae20bd..0b57919ddc9 100644 --- a/apps/dav/lib/Events/CalendarObjectMovedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectMovedEvent.php @@ -17,32 +17,19 @@ use OCP\EventDispatcher\Event; * @since 25.0.0 */ class CalendarObjectMovedEvent extends Event { - private int $sourceCalendarId; - private array $sourceCalendarData; - private int $targetCalendarId; - private array $targetCalendarData; - private array $sourceShares; - private array $targetShares; - private array $objectData; - /** * @since 25.0.0 */ - public function __construct(int $sourceCalendarId, - array $sourceCalendarData, - int $targetCalendarId, - array $targetCalendarData, - array $sourceShares, - array $targetShares, - array $objectData) { + public function __construct( + private int $sourceCalendarId, + private array $sourceCalendarData, + private int $targetCalendarId, + private array $targetCalendarData, + private array $sourceShares, + private array $targetShares, + private array $objectData, + ) { parent::__construct(); - $this->sourceCalendarId = $sourceCalendarId; - $this->sourceCalendarData = $sourceCalendarData; - $this->targetCalendarId = $targetCalendarId; - $this->targetCalendarData = $targetCalendarData; - $this->sourceShares = $sourceShares; - $this->targetShares = $targetShares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php b/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php index f2ccd2731bc..a26aca4ff2b 100644 --- a/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php +++ b/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php @@ -15,18 +15,6 @@ use OCP\EventDispatcher\Event; */ class CalendarObjectMovedToTrashEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * @param int $calendarId * @param array $calendarData @@ -34,15 +22,13 @@ class CalendarObjectMovedToTrashEvent extends Event { * @param array $objectData * @since 22.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarObjectRestoredEvent.php b/apps/dav/lib/Events/CalendarObjectRestoredEvent.php index bfd64be72b5..99d752de466 100644 --- a/apps/dav/lib/Events/CalendarObjectRestoredEvent.php +++ b/apps/dav/lib/Events/CalendarObjectRestoredEvent.php @@ -15,18 +15,6 @@ use OCP\EventDispatcher\Event; */ class CalendarObjectRestoredEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * @param int $calendarId * @param array $calendarData @@ -34,15 +22,13 @@ class CalendarObjectRestoredEvent extends Event { * @param array $objectData * @since 22.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php b/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php index 2f15ce6b3f2..8c4b843609d 100644 --- a/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CalendarObjectUpdatedEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - - /** @var array */ - private $objectData; - /** * CalendarObjectUpdatedEvent constructor. * @@ -39,15 +27,13 @@ class CalendarObjectUpdatedEvent extends Event { * @param array $objectData * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + private array $objectData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CalendarPublishedEvent.php b/apps/dav/lib/Events/CalendarPublishedEvent.php index 922781e3cb7..32fb1c36963 100644 --- a/apps/dav/lib/Events/CalendarPublishedEvent.php +++ b/apps/dav/lib/Events/CalendarPublishedEvent.php @@ -17,10 +17,6 @@ use OCP\EventDispatcher\Event; * @since 20.0.0 */ class CalendarPublishedEvent extends Event { - private int $calendarId; - private array $calendarData; - private string $publicUri; - /** * CalendarPublishedEvent constructor. * @@ -29,13 +25,12 @@ class CalendarPublishedEvent extends Event { * @param string $publicUri * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - string $publicUri) { + public function __construct( + private int $calendarId, + private array $calendarData, + private string $publicUri, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->publicUri = $publicUri; } /** diff --git a/apps/dav/lib/Events/CalendarRestoredEvent.php b/apps/dav/lib/Events/CalendarRestoredEvent.php index 5ea754ef200..f404771dea2 100644 --- a/apps/dav/lib/Events/CalendarRestoredEvent.php +++ b/apps/dav/lib/Events/CalendarRestoredEvent.php @@ -15,28 +15,18 @@ use OCP\EventDispatcher\Event; */ class CalendarRestoredEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - /** * @param int $calendarId * @param array $calendarData * @param array $shares * @since 22.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; } /** diff --git a/apps/dav/lib/Events/CalendarShareUpdatedEvent.php b/apps/dav/lib/Events/CalendarShareUpdatedEvent.php index cdd1bc86cc0..762307b202f 100644 --- a/apps/dav/lib/Events/CalendarShareUpdatedEvent.php +++ b/apps/dav/lib/Events/CalendarShareUpdatedEvent.php @@ -19,20 +19,6 @@ use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet; * @since 20.0.0 */ class CalendarShareUpdatedEvent extends Event { - private int $calendarId; - - /** @var array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string } */ - private array $calendarData; - - /** @var list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> */ - private array $oldShares; - - /** @var list<array{href: string, commonName: string, readOnly: bool}> */ - private array $added; - - /** @var list<string> */ - private array $removed; - /** * CalendarShareUpdatedEvent constructor. * @@ -43,17 +29,14 @@ class CalendarShareUpdatedEvent extends Event { * @param list<string> $removed * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $oldShares, - array $added, - array $removed) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $oldShares, + private array $added, + private array $removed, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->oldShares = $oldShares; - $this->added = $added; - $this->removed = $removed; } /** diff --git a/apps/dav/lib/Events/CalendarUnpublishedEvent.php b/apps/dav/lib/Events/CalendarUnpublishedEvent.php index 5f10f1e2c62..10d1712686d 100644 --- a/apps/dav/lib/Events/CalendarUnpublishedEvent.php +++ b/apps/dav/lib/Events/CalendarUnpublishedEvent.php @@ -17,9 +17,6 @@ use OCP\EventDispatcher\Event; * @since 20.0.0 */ class CalendarUnpublishedEvent extends Event { - private int $calendarId; - private array $calendarData; - /** * CalendarUnpublishedEvent constructor. * @@ -27,11 +24,11 @@ class CalendarUnpublishedEvent extends Event { * @param array $calendarData * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData) { + public function __construct( + private int $calendarId, + private array $calendarData, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; } /** diff --git a/apps/dav/lib/Events/CalendarUpdatedEvent.php b/apps/dav/lib/Events/CalendarUpdatedEvent.php index 46964156b16..a603d3152f0 100644 --- a/apps/dav/lib/Events/CalendarUpdatedEvent.php +++ b/apps/dav/lib/Events/CalendarUpdatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CalendarUpdatedEvent extends Event { - /** @var int */ - private $calendarId; - - /** @var array */ - private $calendarData; - - /** @var array */ - private $shares; - - /** @var array */ - private $mutations; - /** * CalendarUpdatedEvent constructor. * @@ -39,15 +27,13 @@ class CalendarUpdatedEvent extends Event { * @param array $mutations * @since 20.0.0 */ - public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $mutations) { + public function __construct( + private int $calendarId, + private array $calendarData, + private array $shares, + private array $mutations, + ) { parent::__construct(); - $this->calendarId = $calendarId; - $this->calendarData = $calendarData; - $this->shares = $shares; - $this->mutations = $mutations; } /** diff --git a/apps/dav/lib/Events/CardCreatedEvent.php b/apps/dav/lib/Events/CardCreatedEvent.php index 3036451862b..5a66d73e707 100644 --- a/apps/dav/lib/Events/CardCreatedEvent.php +++ b/apps/dav/lib/Events/CardCreatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CardCreatedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - - /** @var array */ - private $shares; - - /** @var array */ - private $cardData; - /** * CardCreatedEvent constructor. * @@ -39,15 +27,13 @@ class CardCreatedEvent extends Event { * @param array $cardData * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $cardData) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + private array $shares, + private array $cardData, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; - $this->shares = $shares; - $this->cardData = $cardData; } /** diff --git a/apps/dav/lib/Events/CardDeletedEvent.php b/apps/dav/lib/Events/CardDeletedEvent.php index 8b2499f71e0..237ffa7d623 100644 --- a/apps/dav/lib/Events/CardDeletedEvent.php +++ b/apps/dav/lib/Events/CardDeletedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CardDeletedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - - /** @var array */ - private $shares; - - /** @var array */ - private $cardData; - /** * CardDeletedEvent constructor. * @@ -39,15 +27,13 @@ class CardDeletedEvent extends Event { * @param array $cardData * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $cardData) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + private array $shares, + private array $cardData, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; - $this->shares = $shares; - $this->cardData = $cardData; } /** diff --git a/apps/dav/lib/Events/CardMovedEvent.php b/apps/dav/lib/Events/CardMovedEvent.php index adeb513c5d9..be69a046537 100644 --- a/apps/dav/lib/Events/CardMovedEvent.php +++ b/apps/dav/lib/Events/CardMovedEvent.php @@ -17,32 +17,19 @@ use OCP\EventDispatcher\Event; * @since 27.0.0 */ class CardMovedEvent extends Event { - private int $sourceAddressBookId; - private array $sourceAddressBookData; - private int $targetAddressBookId; - private array $targetAddressBookData; - private array $sourceShares; - private array $targetShares; - private array $objectData; - /** * @since 27.0.0 */ - public function __construct(int $sourceAddressBookId, - array $sourceAddressBookData, - int $targetAddressBookId, - array $targetAddressBookData, - array $sourceShares, - array $targetShares, - array $objectData) { + public function __construct( + private int $sourceAddressBookId, + private array $sourceAddressBookData, + private int $targetAddressBookId, + private array $targetAddressBookData, + private array $sourceShares, + private array $targetShares, + private array $objectData, + ) { parent::__construct(); - $this->sourceAddressBookId = $sourceAddressBookId; - $this->sourceAddressBookData = $sourceAddressBookData; - $this->targetAddressBookId = $targetAddressBookId; - $this->targetAddressBookData = $targetAddressBookData; - $this->sourceShares = $sourceShares; - $this->targetShares = $targetShares; - $this->objectData = $objectData; } /** diff --git a/apps/dav/lib/Events/CardUpdatedEvent.php b/apps/dav/lib/Events/CardUpdatedEvent.php index 3d97b5adf2e..10fc5b74594 100644 --- a/apps/dav/lib/Events/CardUpdatedEvent.php +++ b/apps/dav/lib/Events/CardUpdatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class CardUpdatedEvent extends Event { - /** @var int */ - private $addressBookId; - - /** @var array */ - private $addressBookData; - - /** @var array */ - private $shares; - - /** @var array */ - private $cardData; - /** * CardUpdatedEvent constructor. * @@ -39,15 +27,13 @@ class CardUpdatedEvent extends Event { * @param array $cardData * @since 20.0.0 */ - public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $cardData) { + public function __construct( + private int $addressBookId, + private array $addressBookData, + private array $shares, + private array $cardData, + ) { parent::__construct(); - $this->addressBookId = $addressBookId; - $this->addressBookData = $addressBookData; - $this->shares = $shares; - $this->cardData = $cardData; } /** diff --git a/apps/dav/lib/Events/SabrePluginAddEvent.php b/apps/dav/lib/Events/SabrePluginAddEvent.php index 42ba7263e90..866fae2e224 100644 --- a/apps/dav/lib/Events/SabrePluginAddEvent.php +++ b/apps/dav/lib/Events/SabrePluginAddEvent.php @@ -19,15 +19,13 @@ use Sabre\DAV\Server; */ class SabrePluginAddEvent extends Event { - /** @var Server */ - private $server; - /** * @since 28.0.0 */ - public function __construct(Server $server) { + public function __construct( + private Server $server, + ) { parent::__construct(); - $this->server = $server; } /** diff --git a/apps/dav/lib/Events/SabrePluginAuthInitEvent.php b/apps/dav/lib/Events/SabrePluginAuthInitEvent.php index 1709756368d..d3d93770c74 100644 --- a/apps/dav/lib/Events/SabrePluginAuthInitEvent.php +++ b/apps/dav/lib/Events/SabrePluginAuthInitEvent.php @@ -19,14 +19,12 @@ use Sabre\DAV\Server; */ class SabrePluginAuthInitEvent extends Event { - /** @var Server */ - private $server; - /** * @since 20.0.0 */ - public function __construct(Server $server) { - $this->server = $server; + public function __construct( + private Server $server, + ) { } /** diff --git a/apps/dav/lib/Events/SubscriptionCreatedEvent.php b/apps/dav/lib/Events/SubscriptionCreatedEvent.php index b96477582ad..433b6db59b0 100644 --- a/apps/dav/lib/Events/SubscriptionCreatedEvent.php +++ b/apps/dav/lib/Events/SubscriptionCreatedEvent.php @@ -18,12 +18,6 @@ use OCP\EventDispatcher\Event; */ class SubscriptionCreatedEvent extends Event { - /** @var int */ - private $subscriptionId; - - /** @var array */ - private $subscriptionData; - /** * SubscriptionCreatedEvent constructor. * @@ -31,11 +25,11 @@ class SubscriptionCreatedEvent extends Event { * @param array $subscriptionData * @since 20.0.0 */ - public function __construct(int $subscriptionId, - array $subscriptionData) { + public function __construct( + private int $subscriptionId, + private array $subscriptionData, + ) { parent::__construct(); - $this->subscriptionId = $subscriptionId; - $this->subscriptionData = $subscriptionData; } /** diff --git a/apps/dav/lib/Events/SubscriptionDeletedEvent.php b/apps/dav/lib/Events/SubscriptionDeletedEvent.php index a99a72b125d..58d47ae98a4 100644 --- a/apps/dav/lib/Events/SubscriptionDeletedEvent.php +++ b/apps/dav/lib/Events/SubscriptionDeletedEvent.php @@ -18,15 +18,6 @@ use OCP\EventDispatcher\Event; */ class SubscriptionDeletedEvent extends Event { - /** @var int */ - private $subscriptionId; - - /** @var array */ - private $subscriptionData; - - /** @var array */ - private $shares; - /** * SubscriptionDeletedEvent constructor. * @@ -35,13 +26,12 @@ class SubscriptionDeletedEvent extends Event { * @param array $shares * @since 20.0.0 */ - public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares) { + public function __construct( + private int $subscriptionId, + private array $subscriptionData, + private array $shares, + ) { parent::__construct(); - $this->subscriptionId = $subscriptionId; - $this->subscriptionData = $subscriptionData; - $this->shares = $shares; } /** diff --git a/apps/dav/lib/Events/SubscriptionUpdatedEvent.php b/apps/dav/lib/Events/SubscriptionUpdatedEvent.php index 879b8ec1074..1a1b2804663 100644 --- a/apps/dav/lib/Events/SubscriptionUpdatedEvent.php +++ b/apps/dav/lib/Events/SubscriptionUpdatedEvent.php @@ -18,18 +18,6 @@ use OCP\EventDispatcher\Event; */ class SubscriptionUpdatedEvent extends Event { - /** @var int */ - private $subscriptionId; - - /** @var array */ - private $subscriptionData; - - /** @var array */ - private $shares; - - /** @var array */ - private $mutations; - /** * SubscriptionUpdatedEvent constructor. * @@ -39,15 +27,13 @@ class SubscriptionUpdatedEvent extends Event { * @param array $mutations * @since 20.0.0 */ - public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $mutations) { + public function __construct( + private int $subscriptionId, + private array $subscriptionData, + private array $shares, + private array $mutations, + ) { parent::__construct(); - $this->subscriptionId = $subscriptionId; - $this->subscriptionData = $subscriptionData; - $this->shares = $shares; - $this->mutations = $mutations; } /** diff --git a/apps/dav/lib/Files/FilesHome.php b/apps/dav/lib/Files/FilesHome.php index b865b7c1bb6..f8aa82cdcc9 100644 --- a/apps/dav/lib/Files/FilesHome.php +++ b/apps/dav/lib/Files/FilesHome.php @@ -15,18 +15,15 @@ use Sabre\DAV\Exception\Forbidden; class FilesHome extends Directory { /** - * @var array - */ - private $principalInfo; - - /** * FilesHome constructor. * * @param array $principalInfo * @param FileInfo $userFolder */ - public function __construct($principalInfo, FileInfo $userFolder) { - $this->principalInfo = $principalInfo; + public function __construct( + private $principalInfo, + FileInfo $userFolder, + ) { $view = Filesystem::getView(); parent::__construct($view, $userFolder); } diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index f717752038a..9f4bc95d89b 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -18,21 +18,9 @@ use Psr\Log\LoggerInterface; class HookManager { - /** @var IUserManager */ - private $userManager; - - /** @var SyncService */ - private $syncService; - /** @var IUser[] */ private $usersToDelete = []; - /** @var CalDavBackend */ - private $calDav; - - /** @var CardDavBackend */ - private $cardDav; - /** @var array */ private $calendarsToDelete = []; @@ -42,19 +30,13 @@ class HookManager { /** @var array */ private $addressBooksToDelete = []; - /** @var Defaults */ - private $themingDefaults; - - public function __construct(IUserManager $userManager, - SyncService $syncService, - CalDavBackend $calDav, - CardDavBackend $cardDav, - Defaults $themingDefaults) { - $this->userManager = $userManager; - $this->syncService = $syncService; - $this->calDav = $calDav; - $this->cardDav = $cardDav; - $this->themingDefaults = $themingDefaults; + public function __construct( + private IUserManager $userManager, + private SyncService $syncService, + private CalDavBackend $calDav, + private CardDavBackend $cardDav, + private Defaults $themingDefaults, + ) { } public function setup() { diff --git a/apps/dav/lib/Listener/ActivityUpdaterListener.php b/apps/dav/lib/Listener/ActivityUpdaterListener.php index 61dda3e8e47..700bc2f306c 100644 --- a/apps/dav/lib/Listener/ActivityUpdaterListener.php +++ b/apps/dav/lib/Listener/ActivityUpdaterListener.php @@ -30,16 +30,10 @@ use function sprintf; /** @template-implements IEventListener<CalendarCreatedEvent|CalendarUpdatedEvent|CalendarMovedToTrashEvent|CalendarRestoredEvent|CalendarDeletedEvent|CalendarObjectCreatedEvent|CalendarObjectUpdatedEvent|CalendarObjectMovedEvent|CalendarObjectMovedToTrashEvent|CalendarObjectRestoredEvent|CalendarObjectDeletedEvent> */ class ActivityUpdaterListener implements IEventListener { - /** @var ActivityBackend */ - private $activityBackend; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(ActivityBackend $activityBackend, - LoggerInterface $logger) { - $this->activityBackend = $activityBackend; - $this->logger = $logger; + public function __construct( + private ActivityBackend $activityBackend, + private LoggerInterface $logger, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/AddressbookListener.php b/apps/dav/lib/Listener/AddressbookListener.php index 7c95cb1e0c7..4e38ce50dfd 100644 --- a/apps/dav/lib/Listener/AddressbookListener.php +++ b/apps/dav/lib/Listener/AddressbookListener.php @@ -21,16 +21,10 @@ use function sprintf; /** @template-implements IEventListener<AddressBookCreatedEvent|AddressBookUpdatedEvent|AddressBookDeletedEvent|AddressBookShareUpdatedEvent> */ class AddressbookListener implements IEventListener { - /** @var ActivityBackend */ - private $activityBackend; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(ActivityBackend $activityBackend, - LoggerInterface $logger) { - $this->activityBackend = $activityBackend; - $this->logger = $logger; + public function __construct( + private ActivityBackend $activityBackend, + private LoggerInterface $logger, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/BirthdayListener.php b/apps/dav/lib/Listener/BirthdayListener.php index 61e47a8171b..3a464d668f9 100644 --- a/apps/dav/lib/Listener/BirthdayListener.php +++ b/apps/dav/lib/Listener/BirthdayListener.php @@ -17,10 +17,9 @@ use OCP\EventDispatcher\IEventListener; /** @template-implements IEventListener<CardCreatedEvent|CardUpdatedEvent|CardDeletedEvent> */ class BirthdayListener implements IEventListener { - private BirthdayService $birthdayService; - - public function __construct(BirthdayService $birthdayService) { - $this->birthdayService = $birthdayService; + public function __construct( + private BirthdayService $birthdayService, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/CalendarContactInteractionListener.php b/apps/dav/lib/Listener/CalendarContactInteractionListener.php index b4eab7b6544..8e574e150cd 100644 --- a/apps/dav/lib/Listener/CalendarContactInteractionListener.php +++ b/apps/dav/lib/Listener/CalendarContactInteractionListener.php @@ -32,31 +32,13 @@ use function substr; class CalendarContactInteractionListener implements IEventListener { private const URI_USERS = 'principals/users/'; - /** @var IEventDispatcher */ - private $dispatcher; - - /** @var IUserSession */ - private $userSession; - - /** @var Principal */ - private $principalConnector; - - /** @var IMailer */ - private $mailer; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(IEventDispatcher $dispatcher, - IUserSession $userSession, - Principal $principalConnector, - IMailer $mailer, - LoggerInterface $logger) { - $this->dispatcher = $dispatcher; - $this->userSession = $userSession; - $this->principalConnector = $principalConnector; - $this->mailer = $mailer; - $this->logger = $logger; + public function __construct( + private IEventDispatcher $dispatcher, + private IUserSession $userSession, + private Principal $principalConnector, + private IMailer $mailer, + private LoggerInterface $logger, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php index df8b190b993..0cfc435eb8c 100644 --- a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php +++ b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php @@ -20,16 +20,10 @@ use Throwable; */ class CalendarDeletionDefaultUpdaterListener implements IEventListener { - /** @var IConfig */ - private $config; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(IConfig $config, - LoggerInterface $logger) { - $this->config = $config; - $this->logger = $logger; + public function __construct( + private IConfig $config, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php b/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php index 7b5026a9570..544c88af929 100644 --- a/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php +++ b/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php @@ -28,26 +28,12 @@ use function sprintf; /** @template-implements IEventListener<CalendarMovedToTrashEvent|CalendarDeletedEvent|CalendarRestoredEvent|CalendarObjectCreatedEvent|CalendarObjectUpdatedEvent|CalendarObjectMovedToTrashEvent|CalendarObjectRestoredEvent|CalendarObjectDeletedEvent> */ class CalendarObjectReminderUpdaterListener implements IEventListener { - /** @var ReminderBackend */ - private $reminderBackend; - - /** @var ReminderService */ - private $reminderService; - - /** @var CalDavBackend */ - private $calDavBackend; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(ReminderBackend $reminderBackend, - ReminderService $reminderService, - CalDavBackend $calDavBackend, - LoggerInterface $logger) { - $this->reminderBackend = $reminderBackend; - $this->reminderService = $reminderService; - $this->calDavBackend = $calDavBackend; - $this->logger = $logger; + public function __construct( + private ReminderBackend $reminderBackend, + private ReminderService $reminderService, + private CalDavBackend $calDavBackend, + private LoggerInterface $logger, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/CalendarPublicationListener.php b/apps/dav/lib/Listener/CalendarPublicationListener.php index 2fd640d0c76..94a0a208d4e 100644 --- a/apps/dav/lib/Listener/CalendarPublicationListener.php +++ b/apps/dav/lib/Listener/CalendarPublicationListener.php @@ -17,13 +17,10 @@ use Psr\Log\LoggerInterface; /** @template-implements IEventListener<CalendarPublishedEvent|CalendarUnpublishedEvent> */ class CalendarPublicationListener implements IEventListener { - private Backend $activityBackend; - private LoggerInterface $logger; - - public function __construct(Backend $activityBackend, - LoggerInterface $logger) { - $this->activityBackend = $activityBackend; - $this->logger = $logger; + public function __construct( + private Backend $activityBackend, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/Listener/CalendarShareUpdateListener.php b/apps/dav/lib/Listener/CalendarShareUpdateListener.php index 51a8968cac1..541b0d07736 100644 --- a/apps/dav/lib/Listener/CalendarShareUpdateListener.php +++ b/apps/dav/lib/Listener/CalendarShareUpdateListener.php @@ -16,13 +16,10 @@ use Psr\Log\LoggerInterface; /** @template-implements IEventListener<CalendarShareUpdatedEvent> */ class CalendarShareUpdateListener implements IEventListener { - private Backend $activityBackend; - private LoggerInterface $logger; - - public function __construct(Backend $activityBackend, - LoggerInterface $logger) { - $this->activityBackend = $activityBackend; - $this->logger = $logger; + public function __construct( + private Backend $activityBackend, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/Listener/CardListener.php b/apps/dav/lib/Listener/CardListener.php index 346445c10a2..b9fd1a7f64b 100644 --- a/apps/dav/lib/Listener/CardListener.php +++ b/apps/dav/lib/Listener/CardListener.php @@ -21,16 +21,10 @@ use function sprintf; /** @template-implements IEventListener<CardCreatedEvent|CardUpdatedEvent|CardDeletedEvent> */ class CardListener implements IEventListener { - /** @var ActivityBackend */ - private $activityBackend; - - /** @var LoggerInterface */ - private $logger; - - public function __construct(ActivityBackend $activityBackend, - LoggerInterface $logger) { - $this->activityBackend = $activityBackend; - $this->logger = $logger; + public function __construct( + private ActivityBackend $activityBackend, + private LoggerInterface $logger, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/ClearPhotoCacheListener.php b/apps/dav/lib/Listener/ClearPhotoCacheListener.php index 70bf8e3fb35..eb599d33871 100644 --- a/apps/dav/lib/Listener/ClearPhotoCacheListener.php +++ b/apps/dav/lib/Listener/ClearPhotoCacheListener.php @@ -16,10 +16,9 @@ use OCP\EventDispatcher\IEventListener; /** @template-implements IEventListener<CardUpdatedEvent|CardDeletedEvent> */ class ClearPhotoCacheListener implements IEventListener { - private PhotoCache $photoCache; - - public function __construct(PhotoCache $photoCache) { - $this->photoCache = $photoCache; + public function __construct( + private PhotoCache $photoCache, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/SubscriptionListener.php b/apps/dav/lib/Listener/SubscriptionListener.php index 9c9904d1aa2..fc9dfcf122d 100644 --- a/apps/dav/lib/Listener/SubscriptionListener.php +++ b/apps/dav/lib/Listener/SubscriptionListener.php @@ -20,17 +20,12 @@ use Psr\Log\LoggerInterface; /** @template-implements IEventListener<SubscriptionCreatedEvent|SubscriptionDeletedEvent> */ class SubscriptionListener implements IEventListener { - private IJobList $jobList; - private RefreshWebcalService $refreshWebcalService; - private ReminderBackend $reminderBackend; - private LoggerInterface $logger; - - public function __construct(IJobList $jobList, RefreshWebcalService $refreshWebcalService, ReminderBackend $reminderBackend, - LoggerInterface $logger) { - $this->jobList = $jobList; - $this->refreshWebcalService = $refreshWebcalService; - $this->reminderBackend = $reminderBackend; - $this->logger = $logger; + public function __construct( + private IJobList $jobList, + private RefreshWebcalService $refreshWebcalService, + private ReminderBackend $reminderBackend, + private LoggerInterface $logger, + ) { } /** diff --git a/apps/dav/lib/Listener/TrustedServerRemovedListener.php b/apps/dav/lib/Listener/TrustedServerRemovedListener.php index 36cb37b88ec..9adbcfc14c2 100644 --- a/apps/dav/lib/Listener/TrustedServerRemovedListener.php +++ b/apps/dav/lib/Listener/TrustedServerRemovedListener.php @@ -15,10 +15,9 @@ use OCP\Federation\Events\TrustedServerRemovedEvent; /** @template-implements IEventListener<TrustedServerRemovedEvent> */ class TrustedServerRemovedListener implements IEventListener { - private CardDavBackend $cardDavBackend; - - public function __construct(CardDavBackend $cardDavBackend) { - $this->cardDavBackend = $cardDavBackend; + public function __construct( + private CardDavBackend $cardDavBackend, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Listener/UserPreferenceListener.php b/apps/dav/lib/Listener/UserPreferenceListener.php index 436a312ea88..5f5fed05348 100644 --- a/apps/dav/lib/Listener/UserPreferenceListener.php +++ b/apps/dav/lib/Listener/UserPreferenceListener.php @@ -17,10 +17,9 @@ use OCP\EventDispatcher\IEventListener; /** @template-implements IEventListener<BeforePreferenceSetEvent|BeforePreferenceDeletedEvent> */ class UserPreferenceListener implements IEventListener { - protected IJobList $jobList; - - public function __construct(IJobList $jobList) { - $this->jobList = $jobList; + public function __construct( + protected IJobList $jobList, + ) { } public function handle(Event $event): void { diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndex.php b/apps/dav/lib/Migration/BuildSocialSearchIndex.php index 16100196e1b..5fab3f4ef77 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndex.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndex.php @@ -13,26 +13,16 @@ use OCP\Migration\IRepairStep; class BuildSocialSearchIndex implements IRepairStep { - /** @var IDBConnection */ - private $db; - - /** @var IJobList */ - private $jobList; - - /** @var IConfig */ - private $config; - /** * @param IDBConnection $db * @param IJobList $jobList * @param IConfig $config */ - public function __construct(IDBConnection $db, - IJobList $jobList, - IConfig $config) { - $this->db = $db; - $this->jobList = $jobList; - $this->config = $config; + public function __construct( + private IDBConnection $db, + private IJobList $jobList, + private IConfig $config, + ) { } /** diff --git a/apps/dav/lib/Migration/ChunkCleanup.php b/apps/dav/lib/Migration/ChunkCleanup.php index 96e84984700..681b38404b9 100644 --- a/apps/dav/lib/Migration/ChunkCleanup.php +++ b/apps/dav/lib/Migration/ChunkCleanup.php @@ -21,23 +21,12 @@ use OCP\Migration\IRepairStep; class ChunkCleanup implements IRepairStep { - /** @var IConfig */ - private $config; - /** @var IUserManager */ - private $userManager; - /** @var IRootFolder */ - private $rootFolder; - /** @var IJobList */ - private $jobList; - - public function __construct(IConfig $config, - IUserManager $userManager, - IRootFolder $rootFolder, - IJobList $jobList) { - $this->config = $config; - $this->userManager = $userManager; - $this->rootFolder = $rootFolder; - $this->jobList = $jobList; + public function __construct( + private IConfig $config, + private IUserManager $userManager, + private IRootFolder $rootFolder, + private IJobList $jobList, + ) { } public function getName(): string { diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php index 94ef7e8a13b..14037801eb4 100644 --- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php +++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php @@ -13,20 +13,14 @@ use OCP\Migration\IRepairStep; class RegenerateBirthdayCalendars implements IRepairStep { - /** @var IJobList */ - private $jobList; - - /** @var IConfig */ - private $config; - /** * @param IJobList $jobList * @param IConfig $config */ - public function __construct(IJobList $jobList, - IConfig $config) { - $this->jobList = $jobList; - $this->config = $config; + public function __construct( + private IJobList $jobList, + private IConfig $config, + ) { } /** diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php index 0122ed37b06..e2b2b701e74 100644 --- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php +++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php @@ -15,12 +15,6 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { - /** @var IDBConnection */ - private $connection; - - /** @var IUserManager */ - private $userManager; - /** @var int */ private $progress = 0; @@ -29,9 +23,10 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { private const SUBSCRIPTIONS_CHUNK_SIZE = 1000; - public function __construct(IDBConnection $connection, IUserManager $userManager) { - $this->connection = $connection; - $this->userManager = $userManager; + public function __construct( + private IDBConnection $connection, + private IUserManager $userManager, + ) { } /** diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php index b87eb82af19..3f505ecb1e2 100644 --- a/apps/dav/lib/Migration/RemoveObjectProperties.php +++ b/apps/dav/lib/Migration/RemoveObjectProperties.php @@ -15,16 +15,14 @@ class RemoveObjectProperties implements IRepairStep { private const ME_CARD_PROPERTY = '{http://calendarserver.org/ns/}me-card'; private const CALENDAR_TRANSP_PROPERTY = '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp'; - /** @var IDBConnection */ - private $connection; - /** * RemoveObjectProperties constructor. * * @param IDBConnection $connection */ - public function __construct(IDBConnection $connection) { - $this->connection = $connection; + public function __construct( + private IDBConnection $connection, + ) { } /** diff --git a/apps/dav/lib/Migration/Version1008Date20181105104826.php b/apps/dav/lib/Migration/Version1008Date20181105104826.php index 6447372ee5f..82612307cbb 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105104826.php +++ b/apps/dav/lib/Migration/Version1008Date20181105104826.php @@ -17,16 +17,14 @@ use OCP\Migration\SimpleMigrationStep; class Version1008Date20181105104826 extends SimpleMigrationStep { - /** @var IDBConnection */ - private $connection; - /** * Version1008Date20181105104826 constructor. * * @param IDBConnection $connection */ - public function __construct(IDBConnection $connection) { - $this->connection = $connection; + public function __construct( + private IDBConnection $connection, + ) { } /** diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php index 37d0c12ce43..72e8dee1bf8 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105110300.php +++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php @@ -17,16 +17,14 @@ use OCP\Migration\SimpleMigrationStep; class Version1008Date20181105110300 extends SimpleMigrationStep { - /** @var IDBConnection */ - private $connection; - /** * Version1008Date20181105110300 constructor. * * @param IDBConnection $connection */ - public function __construct(IDBConnection $connection) { - $this->connection = $connection; + public function __construct( + private IDBConnection $connection, + ) { } /** diff --git a/apps/dav/lib/Migration/Version1025Date20240308063933.php b/apps/dav/lib/Migration/Version1025Date20240308063933.php index 3a68760762b..d84acf8fea9 100644 --- a/apps/dav/lib/Migration/Version1025Date20240308063933.php +++ b/apps/dav/lib/Migration/Version1025Date20240308063933.php @@ -20,13 +20,10 @@ use OCP\Migration\SimpleMigrationStep; class Version1025Date20240308063933 extends SimpleMigrationStep { - private IAppConfig $appConfig; - private IDBConnection $db; - - public function __construct(IAppConfig $appConfig, - IDBConnection $db) { - $this->db = $db; - $this->appConfig = $appConfig; + public function __construct( + private IAppConfig $appConfig, + private IDBConnection $db, + ) { } /** diff --git a/apps/dav/lib/Profiler/ProfilerPlugin.php b/apps/dav/lib/Profiler/ProfilerPlugin.php index 3bcf0b21446..455760fc2bf 100644 --- a/apps/dav/lib/Profiler/ProfilerPlugin.php +++ b/apps/dav/lib/Profiler/ProfilerPlugin.php @@ -14,10 +14,9 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class ProfilerPlugin extends \Sabre\DAV\ServerPlugin { - private IRequest $request; - - public function __construct(IRequest $request) { - $this->request = $request; + public function __construct( + private IRequest $request, + ) { } /** @return void */ diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php index f1313b89582..198a09b4bc8 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php @@ -14,13 +14,12 @@ use Sabre\DAV\PropPatch; class AppleProvisioningNode implements INode, IProperties { public const FILENAME = 'apple-provisioning.mobileconfig'; - protected $timeFactory; - /** * @param ITimeFactory $timeFactory */ - public function __construct(ITimeFactory $timeFactory) { - $this->timeFactory = $timeFactory; + public function __construct( + protected ITimeFactory $timeFactory, + ) { } /** diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index 1a02457d653..36b08cd940c 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -21,52 +21,22 @@ class AppleProvisioningPlugin extends ServerPlugin { protected $server; /** - * @var IURLGenerator - */ - protected $urlGenerator; - - /** - * @var IUserSession - */ - protected $userSession; - - /** * @var \OC_Defaults */ protected $themingDefaults; /** - * @var IRequest - */ - protected $request; - - /** - * @var IL10N - */ - protected $l10n; - - /** - * @var \Closure - */ - protected $uuidClosure; - - /** * AppleProvisioningPlugin constructor. */ public function __construct( - IUserSession $userSession, - IURLGenerator $urlGenerator, + protected IUserSession $userSession, + protected IURLGenerator $urlGenerator, \OC_Defaults $themingDefaults, - IRequest $request, - IL10N $l10n, - \Closure $uuidClosure, + protected IRequest $request, + protected IL10N $l10n, + protected \Closure $uuidClosure, ) { - $this->userSession = $userSession; - $this->urlGenerator = $urlGenerator; $this->themingDefaults = $themingDefaults; - $this->request = $request; - $this->l10n = $l10n; - $this->uuidClosure = $uuidClosure; } /** diff --git a/apps/dav/lib/Search/ACalendarSearchProvider.php b/apps/dav/lib/Search/ACalendarSearchProvider.php index 04e97f80cb1..331d05cb500 100644 --- a/apps/dav/lib/Search/ACalendarSearchProvider.php +++ b/apps/dav/lib/Search/ACalendarSearchProvider.php @@ -23,18 +23,6 @@ use Sabre\VObject\Reader; */ abstract class ACalendarSearchProvider implements IProvider { - /** @var IAppManager */ - protected $appManager; - - /** @var IL10N */ - protected $l10n; - - /** @var IURLGenerator */ - protected $urlGenerator; - - /** @var CalDavBackend */ - protected $backend; - /** * ACalendarSearchProvider constructor. * @@ -43,14 +31,12 @@ abstract class ACalendarSearchProvider implements IProvider { * @param IURLGenerator $urlGenerator * @param CalDavBackend $backend */ - public function __construct(IAppManager $appManager, - IL10N $l10n, - IURLGenerator $urlGenerator, - CalDavBackend $backend) { - $this->appManager = $appManager; - $this->l10n = $l10n; - $this->urlGenerator = $urlGenerator; - $this->backend = $backend; + public function __construct( + protected IAppManager $appManager, + protected IL10N $l10n, + protected IURLGenerator $urlGenerator, + protected CalDavBackend $backend, + ) { } /** diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 986f7465051..835a13a45b2 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -85,12 +85,13 @@ use Sabre\DAV\UUIDUtil; use SearchDAV\DAV\SearchPlugin; class Server { - private IRequest $request; - private string $baseUri; public Connector\Sabre\Server $server; private IProfiler $profiler; - public function __construct(IRequest $request, string $baseUri) { + public function __construct( + private IRequest $request, + private string $baseUri, + ) { $this->profiler = \OC::$server->get(IProfiler::class); if ($this->profiler->isEnabled()) { /** @var IEventLogger $eventLogger */ @@ -98,9 +99,6 @@ class Server { $eventLogger->start('runtime', 'DAV Runtime'); } - $this->request = $request; - $this->baseUri = $baseUri; - $logger = \OCP\Server::get(LoggerInterface::class); $eventDispatcher = \OCP\Server::get(IEventDispatcher::class); @@ -180,7 +178,7 @@ class Server { $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DefaultCalendarValidator::class))); $this->server->addPlugin(\OC::$server->get(\OCA\DAV\CalDAV\Trashbin\Plugin::class)); - $this->server->addPlugin(new \OCA\DAV\CalDAV\WebcalCaching\Plugin($request)); + $this->server->addPlugin(new \OCA\DAV\CalDAV\WebcalCaching\Plugin($this->request)); if (\OC::$server->getConfig()->getAppValue('dav', 'allow_calendar_link_subscriptions', 'yes') === 'yes') { $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); } @@ -237,7 +235,7 @@ class Server { // Some WebDAV clients do require Class 2 WebDAV support (locking), since // we do not provide locking we emulate it using a fake locking plugin. - if ($request->isUserAgent([ + if ($this->request->isUserAgent([ '/WebDAVFS/', '/OneNote/', '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 diff --git a/apps/dav/lib/Settings/AvailabilitySettings.php b/apps/dav/lib/Settings/AvailabilitySettings.php index 6afb03bda8d..a1ada96b255 100644 --- a/apps/dav/lib/Settings/AvailabilitySettings.php +++ b/apps/dav/lib/Settings/AvailabilitySettings.php @@ -20,21 +20,14 @@ use OCP\User\IAvailabilityCoordinator; use Psr\Log\LoggerInterface; class AvailabilitySettings implements ISettings { - protected IConfig $config; - protected IInitialState $initialState; - protected ?string $userId; - public function __construct( - IConfig $config, - IInitialState $initialState, - ?string $userId, + protected IConfig $config, + protected IInitialState $initialState, + protected ?string $userId, private LoggerInterface $logger, private IAvailabilityCoordinator $coordinator, private AbsenceMapper $absenceMapper, ) { - $this->config = $config; - $this->initialState = $initialState; - $this->userId = $userId; } public function getForm(): TemplateResponse { diff --git a/apps/dav/lib/Settings/CalDAVSettings.php b/apps/dav/lib/Settings/CalDAVSettings.php index 7c738a83148..5b6b7fa7e3d 100644 --- a/apps/dav/lib/Settings/CalDAVSettings.php +++ b/apps/dav/lib/Settings/CalDAVSettings.php @@ -15,15 +15,6 @@ use OCP\Settings\IDelegatedSettings; class CalDAVSettings implements IDelegatedSettings { - /** @var IConfig */ - private $config; - - /** @var IInitialState */ - private $initialState; - - private IURLGenerator $urlGenerator; - private IAppManager $appManager; - private const defaults = [ 'sendInvitations' => 'yes', 'generateBirthdayCalendar' => 'yes', @@ -38,11 +29,12 @@ class CalDAVSettings implements IDelegatedSettings { * @param IConfig $config * @param IInitialState $initialState */ - public function __construct(IConfig $config, IInitialState $initialState, IURLGenerator $urlGenerator, IAppManager $appManager) { - $this->config = $config; - $this->initialState = $initialState; - $this->urlGenerator = $urlGenerator; - $this->appManager = $appManager; + public function __construct( + private IConfig $config, + private IInitialState $initialState, + private IURLGenerator $urlGenerator, + private IAppManager $appManager, + ) { } public function getForm(): TemplateResponse { diff --git a/apps/dav/lib/SystemTag/SystemTagNode.php b/apps/dav/lib/SystemTag/SystemTagNode.php index 06eead814b2..9357f207779 100644 --- a/apps/dav/lib/SystemTag/SystemTagNode.php +++ b/apps/dav/lib/SystemTag/SystemTagNode.php @@ -23,30 +23,6 @@ use Sabre\DAV\Exception\NotFound; */ class SystemTagNode implements \Sabre\DAV\INode { - /** - * @var ISystemTag - */ - protected $tag; - - /** - * @var ISystemTagManager - */ - protected $tagManager; - - /** - * User - * - * @var IUser - */ - protected $user; - - /** - * Whether to allow permissions for admins - * - * @var bool - */ - protected $isAdmin; - protected int $numberOfFiles = -1; protected int $referenceFileId = -1; @@ -58,11 +34,18 @@ class SystemTagNode implements \Sabre\DAV\INode { * @param bool $isAdmin whether to allow operations for admins * @param ISystemTagManager $tagManager tag manager */ - public function __construct(ISystemTag $tag, IUser $user, $isAdmin, ISystemTagManager $tagManager) { - $this->tag = $tag; - $this->user = $user; - $this->isAdmin = $isAdmin; - $this->tagManager = $tagManager; + public function __construct( + protected ISystemTag $tag, + /** + * User + */ + protected IUser $user, + /** + * Whether to allow permissions for admins + */ + protected $isAdmin, + protected ISystemTagManager $tagManager, + ) { } /** diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 6098a41ab3b..3c34f4263f6 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -52,38 +52,17 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { */ private $server; - /** - * @var ISystemTagManager - */ - protected $tagManager; - - /** - * @var IUserSession - */ - protected $userSession; - - /** - * @var IGroupManager - */ - protected $groupManager; - /** @var array<int, string[]> */ private array $cachedTagMappings = []; /** @var array<string, ISystemTag> */ private array $cachedTags = []; - private ISystemTagObjectMapper $tagMapper; - public function __construct( - ISystemTagManager $tagManager, - IGroupManager $groupManager, - IUserSession $userSession, - ISystemTagObjectMapper $tagMapper, + protected ISystemTagManager $tagManager, + protected IGroupManager $groupManager, + protected IUserSession $userSession, + private ISystemTagObjectMapper $tagMapper, ) { - $this->tagManager = $tagManager; - $this->userSession = $userSession; - $this->groupManager = $groupManager; - $this->tagMapper = $tagMapper; } /** diff --git a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php index 13e79c99b65..cf889985d1b 100644 --- a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php @@ -20,21 +20,6 @@ use Sabre\DAV\ICollection; class SystemTagsByIdCollection implements ICollection { /** - * @var ISystemTagManager - */ - private $tagManager; - - /** - * @var IGroupManager - */ - private $groupManager; - - /** - * @var IUserSession - */ - private $userSession; - - /** * SystemTagsByIdCollection constructor. * * @param ISystemTagManager $tagManager @@ -42,13 +27,10 @@ class SystemTagsByIdCollection implements ICollection { * @param IGroupManager $groupManager */ public function __construct( - ISystemTagManager $tagManager, - IUserSession $userSession, - IGroupManager $groupManager, + private ISystemTagManager $tagManager, + private IUserSession $userSession, + private IGroupManager $groupManager, ) { - $this->tagManager = $tagManager; - $this->userSession = $userSession; - $this->groupManager = $groupManager; } /** diff --git a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php index 0431acc553a..6a3dd0c2155 100644 --- a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php @@ -21,24 +21,16 @@ use Sabre\DAV\Exception\NotFound; use Sabre\DAV\SimpleCollection; class SystemTagsInUseCollection extends SimpleCollection { - protected IUserSession $userSession; - protected IRootFolder $rootFolder; - protected string $mediaType; - protected ISystemTagManager $systemTagManager; protected SystemTagsInFilesDetector $systemTagsInFilesDetector; /** @noinspection PhpMissingParentConstructorInspection */ public function __construct( - IUserSession $userSession, - IRootFolder $rootFolder, - ISystemTagManager $systemTagManager, + protected IUserSession $userSession, + protected IRootFolder $rootFolder, + protected ISystemTagManager $systemTagManager, SystemTagsInFilesDetector $systemTagsInFilesDetector, - string $mediaType = '', + protected string $mediaType = '', ) { - $this->userSession = $userSession; - $this->rootFolder = $rootFolder; - $this->systemTagManager = $systemTagManager; - $this->mediaType = $mediaType; $this->systemTagsInFilesDetector = $systemTagsInFilesDetector; $this->name = 'systemtags-assigned'; if ($this->mediaType != '') { diff --git a/apps/dav/lib/Upload/CleanupService.php b/apps/dav/lib/Upload/CleanupService.php index 2b939941c55..36b75280504 100644 --- a/apps/dav/lib/Upload/CleanupService.php +++ b/apps/dav/lib/Upload/CleanupService.php @@ -13,14 +13,10 @@ use OCP\BackgroundJob\IJobList; use OCP\IUserSession; class CleanupService { - /** @var IUserSession */ - private $userSession; - /** @var IJobList */ - private $jobList; - - public function __construct(IUserSession $userSession, IJobList $jobList) { - $this->userSession = $userSession; - $this->jobList = $jobList; + public function __construct( + private IUserSession $userSession, + private IJobList $jobList, + ) { } public function addJob(string $folder) { diff --git a/apps/dav/lib/Upload/FutureFile.php b/apps/dav/lib/Upload/FutureFile.php index 5ef15bd2b56..ba37c56978d 100644 --- a/apps/dav/lib/Upload/FutureFile.php +++ b/apps/dav/lib/Upload/FutureFile.php @@ -20,18 +20,14 @@ use Sabre\DAV\IFile; * @package OCA\DAV\Upload */ class FutureFile implements \Sabre\DAV\IFile { - /** @var Directory */ - private $root; - /** @var string */ - private $name; - /** * @param Directory $root * @param string $name */ - public function __construct(Directory $root, $name) { - $this->root = $root; - $this->name = $name; + public function __construct( + private Directory $root, + private $name, + ) { } /** diff --git a/apps/dav/lib/Upload/PartFile.php b/apps/dav/lib/Upload/PartFile.php index a711fe083b9..11900997a90 100644 --- a/apps/dav/lib/Upload/PartFile.php +++ b/apps/dav/lib/Upload/PartFile.php @@ -16,14 +16,10 @@ use Sabre\DAV\IFile; * but handled directly by external storage services like S3 with Multipart Upload */ class PartFile implements IFile { - /** @var Directory */ - private $root; - /** @var array */ - private $partInfo; - - public function __construct(Directory $root, array $partInfo) { - $this->root = $root; - $this->partInfo = $partInfo; + public function __construct( + private Directory $root, + private array $partInfo, + ) { } /** diff --git a/apps/dav/lib/Upload/RootCollection.php b/apps/dav/lib/Upload/RootCollection.php index 1adab40671b..6b12363367a 100644 --- a/apps/dav/lib/Upload/RootCollection.php +++ b/apps/dav/lib/Upload/RootCollection.php @@ -14,14 +14,12 @@ use Sabre\DAVACL\PrincipalBackend; class RootCollection extends AbstractPrincipalCollection { - /** @var CleanupService */ - private $cleanupService; - - public function __construct(PrincipalBackend\BackendInterface $principalBackend, + public function __construct( + PrincipalBackend\BackendInterface $principalBackend, string $principalPrefix, - CleanupService $cleanupService) { + private CleanupService $cleanupService, + ) { parent::__construct($principalBackend, $principalPrefix); - $this->cleanupService = $cleanupService; } /** diff --git a/apps/dav/lib/Upload/UploadFile.php b/apps/dav/lib/Upload/UploadFile.php index 742eda78d08..7301e855cfe 100644 --- a/apps/dav/lib/Upload/UploadFile.php +++ b/apps/dav/lib/Upload/UploadFile.php @@ -12,11 +12,9 @@ use OCA\DAV\Connector\Sabre\File; use Sabre\DAV\IFile; class UploadFile implements IFile { - /** @var File */ - private $file; - - public function __construct(File $file) { - $this->file = $file; + public function __construct( + private File $file, + ) { } public function put($data) { diff --git a/apps/dav/lib/Upload/UploadFolder.php b/apps/dav/lib/Upload/UploadFolder.php index 3f84f7a8597..8ea0591ab16 100644 --- a/apps/dav/lib/Upload/UploadFolder.php +++ b/apps/dav/lib/Upload/UploadFolder.php @@ -15,17 +15,11 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\ICollection; class UploadFolder implements ICollection { - /** @var Directory */ - private $node; - /** @var CleanupService */ - private $cleanupService; - /** @var IStorage */ - private $storage; - - public function __construct(Directory $node, CleanupService $cleanupService, IStorage $storage) { - $this->node = $node; - $this->cleanupService = $cleanupService; - $this->storage = $storage; + public function __construct( + private Directory $node, + private CleanupService $cleanupService, + private IStorage $storage, + ) { } public function createFile($name, $data = null) { diff --git a/apps/dav/lib/Upload/UploadHome.php b/apps/dav/lib/Upload/UploadHome.php index 3e7e3c6c986..739c38feb30 100644 --- a/apps/dav/lib/Upload/UploadHome.php +++ b/apps/dav/lib/Upload/UploadHome.php @@ -14,14 +14,10 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\ICollection; class UploadHome implements ICollection { - /** @var array */ - private $principalInfo; - /** @var CleanupService */ - private $cleanupService; - - public function __construct(array $principalInfo, CleanupService $cleanupService) { - $this->principalInfo = $principalInfo; - $this->cleanupService = $cleanupService; + public function __construct( + private array $principalInfo, + private CleanupService $cleanupService, + ) { } public function createFile($name, $data = null) { diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php index 7e5bdcd7890..73e9c375490 100644 --- a/apps/dav/lib/UserMigration/CalendarMigrator.php +++ b/apps/dav/lib/UserMigration/CalendarMigrator.php @@ -41,17 +41,6 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { use TMigratorBasicVersionHandling; - private CalDavBackend $calDavBackend; - - private ICalendarManager $calendarManager; - - // ICSExportPlugin is injected as the mergeObjects() method is required and is not to be used as a SabreDAV server plugin - private ICSExportPlugin $icsExportPlugin; - - private Defaults $defaults; - - private IL10N $l10n; - private SabreDavServer $sabreDavServer; private const USERS_URI_ROOT = 'principals/users/'; @@ -63,18 +52,12 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { private const EXPORT_ROOT = Application::APP_ID . '/calendars/'; public function __construct( - CalDavBackend $calDavBackend, - ICalendarManager $calendarManager, - ICSExportPlugin $icsExportPlugin, - Defaults $defaults, - IL10N $l10n, + private CalDavBackend $calDavBackend, + private ICalendarManager $calendarManager, + private ICSExportPlugin $icsExportPlugin, + private Defaults $defaults, + private IL10N $l10n, ) { - $this->calDavBackend = $calDavBackend; - $this->calendarManager = $calendarManager; - $this->icsExportPlugin = $icsExportPlugin; - $this->defaults = $defaults; - $this->l10n = $l10n; - $root = new RootCollection(); $this->sabreDavServer = new SabreDavServer(new CachingTree($root)); $this->sabreDavServer->addPlugin(new CalDAVPlugin()); diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index 50787dc4e5d..96d623938a3 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -37,10 +37,6 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { use TMigratorBasicVersionHandling; - private CardDavBackend $cardDavBackend; - - private IL10N $l10n; - private SabreDavServer $sabreDavServer; private const USERS_URI_ROOT = 'principals/users/'; @@ -54,12 +50,9 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { private const PATH_ROOT = Application::APP_ID . '/address_books/'; public function __construct( - CardDavBackend $cardDavBackend, - IL10N $l10n, + private CardDavBackend $cardDavBackend, + private IL10N $l10n, ) { - $this->cardDavBackend = $cardDavBackend; - $this->l10n = $l10n; - $root = new RootCollection(); $this->sabreDavServer = new SabreDavServer(new CachingTree($root)); $this->sabreDavServer->addPlugin(new CardDAVPlugin()); |