diff options
author | Thomas Citharel <tcit@tcit.fr> | 2021-09-16 12:10:27 +0300 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2021-09-16 12:16:34 +0300 |
commit | 6a29e765d25784575f6eb3b13ee6ebfa938ad4d7 (patch) | |
tree | 59ad7722a16c20625467320b99e13738836d627f | |
parent | 0b21cbdc6093849f99e79ac6ee08884ed7ee66f8 (diff) |
Add types to OCP/Calendarcleanup-depreciated-methods-in-dav
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
-rw-r--r-- | lib/private/Calendar/Manager.php | 24 | ||||
-rw-r--r-- | lib/private/Calendar/Room/Manager.php | 4 | ||||
-rw-r--r-- | lib/public/Calendar/ICalendar.php | 10 | ||||
-rw-r--r-- | lib/public/Calendar/IManager.php | 18 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IBackend.php | 2 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IManager.php | 8 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IBackend.php | 4 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IManager.php | 8 |
8 files changed, 41 insertions, 37 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index ab22c3ba7b8..97f1c6d14c4 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -23,9 +23,11 @@ */ namespace OC\Calendar; +use Closure; use OCP\Calendar\ICalendar; +use OCP\Calendar\IManager; -class Manager implements \OCP\Calendar\IManager { +class Manager implements IManager { /** * @var ICalendar[] holds all registered calendars @@ -33,7 +35,7 @@ class Manager implements \OCP\Calendar\IManager { private $calendars = []; /** - * @var \Closure[] to call to load/register calendar providers + * @var Closure[] to call to load/register calendar providers */ private $calendarLoaders = []; @@ -50,7 +52,7 @@ class Manager implements \OCP\Calendar\IManager { * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs * @since 13.0.0 */ - public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null) { + public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array { $this->loadCalendars(); $result = []; foreach ($this->calendars as $calendar) { @@ -70,7 +72,7 @@ class Manager implements \OCP\Calendar\IManager { * @return bool true if enabled, false if not * @since 13.0.0 */ - public function isEnabled() { + public function isEnabled(): bool { return !empty($this->calendars) || !empty($this->calendarLoaders); } @@ -81,7 +83,7 @@ class Manager implements \OCP\Calendar\IManager { * @return void * @since 13.0.0 */ - public function registerCalendar(ICalendar $calendar) { + public function registerCalendar(ICalendar $calendar): void { $this->calendars[$calendar->getKey()] = $calendar; } @@ -92,7 +94,7 @@ class Manager implements \OCP\Calendar\IManager { * @return void * @since 13.0.0 */ - public function unregisterCalendar(ICalendar $calendar) { + public function unregisterCalendar(ICalendar $calendar): void { unset($this->calendars[$calendar->getKey()]); } @@ -100,11 +102,11 @@ class Manager implements \OCP\Calendar\IManager { * In order to improve lazy loading a closure can be registered which will be called in case * calendars are actually requested * - * @param \Closure $callable + * @param Closure $callable * @return void * @since 13.0.0 */ - public function register(\Closure $callable) { + public function register(Closure $callable): void { $this->calendarLoaders[] = $callable; } @@ -112,7 +114,7 @@ class Manager implements \OCP\Calendar\IManager { * @return ICalendar[] * @since 13.0.0 */ - public function getCalendars() { + public function getCalendars(): array { $this->loadCalendars(); return array_values($this->calendars); @@ -123,7 +125,7 @@ class Manager implements \OCP\Calendar\IManager { * @return void * @since 13.0.0 */ - public function clear() { + public function clear(): void { $this->calendars = []; $this->calendarLoaders = []; } @@ -131,7 +133,7 @@ class Manager implements \OCP\Calendar\IManager { /** * loads all calendars */ - private function loadCalendars() { + private function loadCalendars(): void { foreach ($this->calendarLoaders as $callable) { $callable($this); } diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php index 25db5197ef2..9c923e690f5 100644 --- a/lib/private/Calendar/Room/Manager.php +++ b/lib/private/Calendar/Room/Manager.php @@ -88,10 +88,10 @@ class Manager implements \OCP\Calendar\Room\IManager { /** * @param string $backendId - * @throws \OCP\AppFramework\QueryException * @return IBackend|null + *@throws \OCP\AppFramework\QueryException */ - public function getBackend($backendId) { + public function getBackend(string $backendId) { $backends = $this->getBackends(); foreach ($backends as $backend) { if ($backend->getBackendIdentifier() === $backendId) { diff --git a/lib/public/Calendar/ICalendar.php b/lib/public/Calendar/ICalendar.php index ebaa7c50f84..d0208136245 100644 --- a/lib/public/Calendar/ICalendar.php +++ b/lib/public/Calendar/ICalendar.php @@ -34,21 +34,21 @@ interface ICalendar { * @return string defining the technical unique key * @since 13.0.0 */ - public function getKey(); + public function getKey(): string; /** * In comparison to getKey() this function returns a human readable (maybe translated) name * @return null|string * @since 13.0.0 */ - public function getDisplayName(); + public function getDisplayName(): ?string; /** * Calendar color * @return null|string * @since 13.0.0 */ - public function getDisplayColor(); + public function getDisplayColor(): ?string; /** * @param string $pattern which should match within the $searchProperties @@ -60,11 +60,11 @@ interface ICalendar { * @return array an array of events/journals/todos which are arrays of key-value-pairs * @since 13.0.0 */ - public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null); + public function search(string $pattern, array $searchProperties = [], array $options = [], int $limit = null, int $offset = null); /** * @return integer build up using \OCP\Constants * @since 13.0.0 */ - public function getPermissions(); + public function getPermissions(): int; } diff --git a/lib/public/Calendar/IManager.php b/lib/public/Calendar/IManager.php index df4c993b2b5..27f3aa55fce 100644 --- a/lib/public/Calendar/IManager.php +++ b/lib/public/Calendar/IManager.php @@ -23,6 +23,8 @@ */ namespace OCP\Calendar; +use Closure; + /** * This class provides access to the Nextcloud CalDAV backend. * Use this class exclusively if you want to access calendars. @@ -68,7 +70,7 @@ interface IManager { * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs * @since 13.0.0 */ - public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null); + public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array; /** * Check if calendars are available @@ -76,7 +78,7 @@ interface IManager { * @return bool true if enabled, false if not * @since 13.0.0 */ - public function isEnabled(); + public function isEnabled(): bool; /** * Registers a calendar @@ -85,7 +87,7 @@ interface IManager { * @return void * @since 13.0.0 */ - public function registerCalendar(ICalendar $calendar); + public function registerCalendar(ICalendar $calendar): void; /** * Unregisters a calendar @@ -94,28 +96,28 @@ interface IManager { * @return void * @since 13.0.0 */ - public function unregisterCalendar(ICalendar $calendar); + public function unregisterCalendar(ICalendar $calendar): void; /** * In order to improve lazy loading a closure can be registered which will be called in case * calendars are actually requested * - * @param \Closure $callable + * @param Closure $callable * @return void * @since 13.0.0 */ - public function register(\Closure $callable); + public function register(Closure $callable): void; /** * @return ICalendar[] * @since 13.0.0 */ - public function getCalendars(); + public function getCalendars(): array; /** * removes all registered calendar instances * @return void * @since 13.0.0 */ - public function clear(); + public function clear(): void; } diff --git a/lib/public/Calendar/Resource/IBackend.php b/lib/public/Calendar/Resource/IBackend.php index a1e050df60a..17e72679a82 100644 --- a/lib/public/Calendar/Resource/IBackend.php +++ b/lib/public/Calendar/Resource/IBackend.php @@ -58,7 +58,7 @@ interface IBackend { * @return IResource|null * @since 14.0.0 */ - public function getResource($id); + public function getResource(string $id): IResource; /** * Get unique identifier of the backend diff --git a/lib/public/Calendar/Resource/IManager.php b/lib/public/Calendar/Resource/IManager.php index 6910ecb164c..2c9df4a76e7 100644 --- a/lib/public/Calendar/Resource/IManager.php +++ b/lib/public/Calendar/Resource/IManager.php @@ -36,7 +36,7 @@ interface IManager { * @return void * @since 14.0.0 */ - public function registerBackend(string $backendClass); + public function registerBackend(string $backendClass): void; /** * Unregisters a resource backend @@ -45,7 +45,7 @@ interface IManager { * @return void * @since 14.0.0 */ - public function unregisterBackend(string $backendClass); + public function unregisterBackend(string $backendClass): void; /** * @return IBackend[] @@ -58,12 +58,12 @@ interface IManager { * @return IBackend|null * @since 14.0.0 */ - public function getBackend($backendId); + public function getBackend(string $backendId): IBackend; /** * removes all registered backend instances * @return void * @since 14.0.0 */ - public function clear(); + public function clear(): void; } diff --git a/lib/public/Calendar/Room/IBackend.php b/lib/public/Calendar/Room/IBackend.php index 095240202bf..acd46e00f0b 100644 --- a/lib/public/Calendar/Room/IBackend.php +++ b/lib/public/Calendar/Room/IBackend.php @@ -54,11 +54,11 @@ interface IBackend { * get a room by it's id * * @param string $id - * @throws BackendTemporarilyUnavailableException * @return IRoom|null + * @throws BackendTemporarilyUnavailableException * @since 14.0.0 */ - public function getRoom($id); + public function getRoom(string $id): ?IRoom; /** * Get unique identifier of the backend diff --git a/lib/public/Calendar/Room/IManager.php b/lib/public/Calendar/Room/IManager.php index 6529ad265b6..c9444ad5464 100644 --- a/lib/public/Calendar/Room/IManager.php +++ b/lib/public/Calendar/Room/IManager.php @@ -36,7 +36,7 @@ interface IManager { * @return void * @since 14.0.0 */ - public function registerBackend(string $backendClass); + public function registerBackend(string $backendClass): void; /** * Unregisters a room backend @@ -45,7 +45,7 @@ interface IManager { * @return void * @since 14.0.0 */ - public function unregisterBackend(string $backendClass); + public function unregisterBackend(string $backendClass): void; /** * @return IBackend[] @@ -58,12 +58,12 @@ interface IManager { * @return IBackend|null * @since 14.0.0 */ - public function getBackend($backendId); + public function getBackend(string $backendId): ?IBackend; /** * removes all registered backend instances * @return void * @since 14.0.0 */ - public function clear(); + public function clear(): void; } |