Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c8c8f93
Move createSubscription and deleteSubscription event handlers to
tcitworld Dec 17, 2021
bfdfd3e
Remove uses of LegacyDispatcher for create/delete subscriptions
tcitworld Dec 17, 2021
dfa2cc3
Move every event to listeners and remove all uses of legacy dispatcher
tcitworld Dec 17, 2021
10af3ab
Add tests for new Listeners
tcitworld Dec 17, 2021
180e695
Remove usages of legacyDispatcher in CardDAVBackend
tcitworld Dec 19, 2021
ab07629
Update some depreciated calls
tcitworld Dec 19, 2021
08abaae
Fix doctype of param passed to deleteContact
tcitworld Dec 19, 2021
4827bc7
Improve OCA\DAV\Connector\Sabre\Principal
tcitworld Dec 19, 2021
aa7994f
Improve OCA\DAV\Tests\unit\CardDAV\AddressBookImplTest
tcitworld Dec 19, 2021
3a3a1a0
Move uses of ILogger to LoggerInterface
tcitworld Dec 19, 2021
fed15f9
Move some events to IEventDispatcher
tcitworld Dec 19, 2021
c304561
Replace calls to Sabre's depreciated getPropertiesForPath with getPro…
tcitworld Jan 16, 2022
981b99c
Remove more depreciated calls
tcitworld Jan 20, 2022
dcc9c70
Remove HookManager and replace with UserChangeListener
tcitworld Jan 20, 2022
7a5f4af
Modernize endpoints
tcitworld Jan 20, 2022
d739f92
Modernize Sabre Connector
tcitworld Jan 20, 2022
244aaa7
Add @template-implements metadata for listeners
tcitworld Jan 20, 2022
57ddf28
Remove CalendarManager registration
tcitworld Jan 20, 2022
fccc89d
Various fixes
tcitworld Jan 20, 2022
041526d
Improve tests
tcitworld Jan 26, 2022
3d42336
Improve CommentsEntityEvent
tcitworld Jan 26, 2022
9246d06
Use PHP 7.4 typed properties
tcitworld Feb 14, 2022
6d6008d
Rebasing, cs and more typing
tcitworld Mar 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use PHP 7.4 typed properties
Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Mar 31, 2022
commit 9246d0602ac0ecfd37db8dd1cf4bd6d94701808a
24 changes: 8 additions & 16 deletions apps/dav/lib/AppInfo/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,49 +46,41 @@
*/
class PluginManager {

/**
* @var ServerContainer
*/
private $container;

/**
* @var IAppManager
*/
private $appManager;
private ServerContainer $container;
private IAppManager $appManager;

/**
* App plugins
*
* @var ServerPlugin[]
*/
private $plugins = [];
private array $plugins = [];

/**
* App collections
*
* @var Collection[]
*/
private $collections = [];
private array $collections = [];

/**
* Address book plugins
*
* @var IAddressBookProvider[]
*/
private $addressBookPlugins = [];
private array $addressBookPlugins = [];

/**
* Calendar plugins
*
* @var ICalendarProvider[]
*/
private $calendarPlugins = [];
private array $calendarPlugins = [];

/** @var bool */
private $populated = false;
private bool $populated = false;

/**
* Contstruct a PluginManager
* Construct a PluginManager
*
* @param ServerContainer $container server container for resolving plugin classes
* @param IAppManager $appManager app manager to loading apps and their info
Expand Down
4 changes: 3 additions & 1 deletion apps/dav/lib/Avatars/RootCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
<?php /**
* @var IAppManager
*/
/**
* @copyright Copyright (c) 2016 Thomas Müller <[email protected]>
*
Expand Down
20 changes: 5 additions & 15 deletions apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,11 @@
* @package OCA\DAV\BackgroundJob
*/
class BuildReminderIndexBackgroundJob extends QueuedJob {

/** @var IDBConnection */
private $db;

/** @var ReminderService */
private $reminderService;

/** @var LoggerInterface */
private $logger;

/** @var IJobList */
private $jobList;

/** @var ITimeFactory */
private $timeFactory;
private IDBConnection $db;
private ReminderService $reminderService;
private LoggerInterface $logger;
private IJobList $jobList;
private ITimeFactory $timeFactory;

/**
* BuildReminderIndexBackgroundJob constructor.
Expand Down
3 changes: 1 addition & 2 deletions apps/dav/lib/BackgroundJob/CalendarRetentionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
use OCP\BackgroundJob\TimedJob;

class CalendarRetentionJob extends TimedJob {
/** @var RetentionService */
private $service;
private RetentionService $service;

public function __construct(ITimeFactory $time,
RetentionService $service) {
Expand Down
3 changes: 1 addition & 2 deletions apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
use OCP\BackgroundJob\TimedJob;

class CleanupDirectLinksJob extends TimedJob {
/** @var DirectMapper */
private $mapper;
private DirectMapper $mapper;

public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) {
parent::__construct($timeFactory);
Expand Down
3 changes: 1 addition & 2 deletions apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

class CleanupInvitationTokenJob extends TimedJob {

/** @var IDBConnection */
private $db;
private IDBConnection $db;

public function __construct(IDBConnection $db, ITimeFactory $time) {
parent::__construct($time);
Expand Down
18 changes: 7 additions & 11 deletions apps/dav/lib/BackgroundJob/EventReminderJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@
*/
namespace OCA\DAV\BackgroundJob;

use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException;
use OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException;
use OCA\DAV\CalDAV\Reminder\ReminderService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;

class EventReminderJob extends TimedJob {

/** @var ReminderService */
private $reminderService;

/** @var IConfig */
private $config;
private ReminderService $reminderService;
private IConfig $config;

public function __construct(ITimeFactory $time,
ReminderService $reminderService,
Expand All @@ -52,12 +50,10 @@ public function __construct(ITimeFactory $time,
}

/**
* @param $arg
* @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
* @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
* @throws \OC\User\NoUserException
* @throws ProviderNotAvailableException
* @throws NotificationTypeDoesNotExistException
*/
public function run($arg):void {
public function run($argument):void {
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\QueuedJob;
use OCP\IConfig;
use Sabre\DAV\Exception\BadRequest;

class GenerateBirthdayCalendarBackgroundJob extends QueuedJob {

/** @var BirthdayService */
private $birthdayService;

/** @var IConfig */
private $config;
private BirthdayService $birthdayService;
private IConfig $config;

public function __construct(ITimeFactory $time,
BirthdayService $birthdayService,
Expand All @@ -49,6 +46,7 @@ public function __construct(ITimeFactory $time,

/**
* @param array $arguments
* @throws BadRequest
*/
public function run($arguments) {
$userId = $arguments['userId'];
Expand Down
32 changes: 7 additions & 25 deletions apps/dav/lib/BackgroundJob/RefreshWebcalJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,18 @@
use OCP\BackgroundJob\Job;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\InvalidDataException;

class RefreshWebcalJob extends Job {

/**
* @var RefreshWebcalService
*/
private $refreshWebcalService;

/**
* @var IConfig
*/
private $config;
private RefreshWebcalService $refreshWebcalService;
private IConfig $config;
private LoggerInterface $logger;
private ITimeFactory $timeFactory;

/** @var ILogger */
private $logger;

/** @var ITimeFactory */
private $timeFactory;

/**
* RefreshWebcalJob constructor.
*
* @param RefreshWebcalService $refreshWebcalService
* @param IConfig $config
* @param ILogger $logger
* @param ITimeFactory $timeFactory
*/
public function __construct(RefreshWebcalService $refreshWebcalService, IConfig $config, ILogger $logger, ITimeFactory $timeFactory) {
public function __construct(RefreshWebcalService $refreshWebcalService, IConfig $config, LoggerInterface $logger, ITimeFactory $timeFactory) {
parent::__construct($timeFactory);
$this->refreshWebcalService = $refreshWebcalService;
$this->config = $config;
Expand Down Expand Up @@ -104,7 +86,7 @@ public function execute(IJobList $jobList, ILogger $logger = null) {
return;
}

parent::execute($jobList, $logger);
parent::execute($jobList);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@
use OCP\IUserManager;

class RegisterRegenerateBirthdayCalendars extends QueuedJob {

/** @var IUserManager */
private $userManager;

/** @var IJobList */
private $jobList;
private IUserManager $userManager;
private IJobList $jobList;

/**
* RegisterRegenerateBirthdayCalendars constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,10 @@

class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {

/** @var IResourceManager */
private $resourceManager;

/** @var IRoomManager */
private $roomManager;

/** @var IDBConnection */
private $dbConnection;

/** @var CalDavBackend */
private $calDavBackend;
private IResourceManager $resourceManager;
private IRoomManager $roomManager;
private IDBConnection $dbConnection;
private CalDavBackend $calDavBackend;

public function __construct(ITimeFactory $time,
IResourceManager $resourceManager,
Expand Down
15 changes: 9 additions & 6 deletions apps/dav/lib/BackgroundJob/UploadCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@
use OCP\BackgroundJob\TimedJob;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\InvalidPathException;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;

class UploadCleanup extends TimedJob {

/** @var IRootFolder */
private $rootFolder;

/** @var IJobList */
private $jobList;
private IRootFolder $rootFolder;
private IJobList $jobList;

public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobList $jobList) {
parent::__construct($time);
Expand All @@ -55,6 +53,11 @@ public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobLis
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
}

/**
* @throws InvalidPathException
* @throws NotFoundException
* @throws NotPermittedException
*/
protected function run($argument) {
$uid = $argument['uid'];
$folder = $argument['folder'];
Expand Down
16 changes: 8 additions & 8 deletions apps/dav/lib/BulkUpload/BulkUploadPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

namespace OCA\DAV\BulkUpload;

use Exception;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
Expand All @@ -32,12 +34,8 @@
use OCA\DAV\Connector\Sabre\MtimeSanitizer;

class BulkUploadPlugin extends ServerPlugin {

/** @var Folder */
private $userFolder;

/** @var LoggerInterface */
private $logger;
private Folder $userFolder;
private LoggerInterface $logger;

public function __construct(Folder $userFolder, LoggerInterface $logger) {
$this->userFolder = $userFolder;
Expand All @@ -57,6 +55,8 @@ public function initialize(Server $server): void {
* - writing is done with the userFolder service
*
* Will respond with an object containing an ETag for every written files.
*
* @throws BadRequest
*/
public function httpPost(RequestInterface $request, ResponseInterface $response): bool {
// Limit bulk upload to the /dav/bulk endpoint
Expand All @@ -70,7 +70,7 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
while (!$multiPartParser->isAtLastBoundary()) {
try {
[$headers, $content] = $multiPartParser->parseNextPart();
} catch (\Exception $e) {
} catch (Exception $e) {
// Return early if an error occurs during parsing.
$this->logger->error($e->getMessage());
$response->setStatus(Http::STATUS_BAD_REQUEST);
Expand All @@ -95,7 +95,7 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
"error" => false,
"etag" => $node->getETag(),
];
} catch (\Exception $e) {
} catch (Exception $e) {
$this->logger->error($e->getMessage(), ['path' => $headers['x-file-path']]);
$writtenFiles[$headers['x-file-path']] = [
"error" => true,
Expand Down
Loading