From 69f7edabafddc3b5dd2d96c8a4960e4963aa4438 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Wed, 17 Jun 2026 12:37:16 -0400 Subject: [PATCH] chore: psalm fix InvalidReturnType Signed-off-by: SebastianKrupinski --- lib/Service/CoreService.php | 8 +++---- lib/Service/Local/LocalContactsService.php | 2 +- lib/Service/Local/LocalEventsService.php | 2 +- lib/Service/Remote/RemoteClient.php | 8 +++++-- lib/Service/Remote/RemoteContactsService.php | 4 +++- lib/Service/Remote/RemoteEventsService.php | 4 +++- lib/Store/Common/Range/IRangeTally.php | 15 ++++-------- lib/Store/Common/Range/RangeDate.php | 20 ---------------- lib/Store/Common/Range/RangeTallyAbsolute.php | 24 ------------------- lib/Store/Common/Range/RangeTallyRelative.php | 24 ------------------- 10 files changed, 23 insertions(+), 88 deletions(-) diff --git a/lib/Service/CoreService.php b/lib/Service/CoreService.php index 3450173..139c859 100644 --- a/lib/Service/CoreService.php +++ b/lib/Service/CoreService.php @@ -44,7 +44,9 @@ public function __construct( * @param string $account_bauth_id account username * @param string $account_bauth_secret account secret * - * @return object + * @return (mixed|string)[]|null + * + * @psalm-return array{location_host: mixed|string, location_path: '.well-known/caldav'|mixed,...}|null */ public function locateAccount(array $configuration): ?array { $dnsTarget = null; @@ -362,7 +364,7 @@ public function localCollectionsFetch(string $uid, int $sid): array { * @param array $cc contacts collection(s) correlations * @param array $ec events collection(s) correlations * - * @return array of collection correlation(s) and attributes + * @return void of collection correlation(s) and attributes */ public function localCollectionsDeposit(string $uid, int $sid, array $cc, array $ec): void { @@ -487,8 +489,6 @@ public function localCollectionsDeposit(string $uid, int $sid, array $cc, array * @param string $uid nextcloud user id * @param string $subject notification type * @param array $params notification parameters to pass - * - * @return array of collection correlation(s) and attributes */ public function publishNotice(string $uid, string $subject, array $params): void { // construct notification object diff --git a/lib/Service/Local/LocalContactsService.php b/lib/Service/Local/LocalContactsService.php index a8fe397..3215107 100644 --- a/lib/Service/Local/LocalContactsService.php +++ b/lib/Service/Local/LocalContactsService.php @@ -59,7 +59,7 @@ public function collectionFetch(int $id): ?Collection { return $co instanceof CollectionEntity ? $this->toCollectionModel($co) : null; } - public function collectionDelta(int $id): string { + public function collectionDelta(int $id): int|float|string { return $this->_Store->chronicleApex($id, true); } diff --git a/lib/Service/Local/LocalEventsService.php b/lib/Service/Local/LocalEventsService.php index df3af87..d12855f 100644 --- a/lib/Service/Local/LocalEventsService.php +++ b/lib/Service/Local/LocalEventsService.php @@ -61,7 +61,7 @@ public function collectionFetch(int $id): ?Collection { return $co instanceof CollectionEntity ? $this->toCollectionModel($co) : null; } - public function collectionDelta(int $id): string { + public function collectionDelta(int $id): int|float|string { return $this->_Store->chronicleApex($id, true); } diff --git a/lib/Service/Remote/RemoteClient.php b/lib/Service/Remote/RemoteClient.php index 0df1a24..50efe40 100644 --- a/lib/Service/Remote/RemoteClient.php +++ b/lib/Service/Remote/RemoteClient.php @@ -279,7 +279,9 @@ public function multiGet(string $collectionPath, array $hrefs, string $reportTyp } /** - * @return array{etag: string|null, statusCode: int, location: string|null, lastModified: string|null, response: IResponse} + * @return (int|null|string)[] + * + * @psalm-return array{etag: null|string, status: int, location: null|string, lastModified: null|string} */ public function create(string $path, string $payload, string $contentType): array { $url = $this->constructUrl($path); @@ -296,7 +298,9 @@ public function create(string $path, string $payload, string $contentType): arra } /** - * @return array{etag: string|null, statusCode: int, location: string|null, lastModified: string|null, response: IResponse} + * @return (int|null|string)[] + * + * @psalm-return array{etag: null|string, status: int, location: null|string, lastModified: null|string} */ public function update(string $path, string $payload, string $contentType, ?string $etag = null): array { $url = $this->constructUrl($path); diff --git a/lib/Service/Remote/RemoteContactsService.php b/lib/Service/Remote/RemoteContactsService.php index 3b61f26..c0fb72f 100644 --- a/lib/Service/Remote/RemoteContactsService.php +++ b/lib/Service/Remote/RemoteContactsService.php @@ -60,7 +60,9 @@ public function initialize(RemoteClient $dataStore) { /** * list of collections in remote storage * - * @return array + * @return Collection[] + * + * @psalm-return list */ public function collectionList(string $granularity = 'basic'): array { // transceive diff --git a/lib/Service/Remote/RemoteEventsService.php b/lib/Service/Remote/RemoteEventsService.php index 25dd3b4..f3d60da 100644 --- a/lib/Service/Remote/RemoteEventsService.php +++ b/lib/Service/Remote/RemoteEventsService.php @@ -61,7 +61,9 @@ public function initialize(RemoteClient $dataStore) { /** * list of collections in remote storage * - * @return array + * @return Collection[] + * + * @psalm-return list */ public function collectionList(string $granularity = 'basic'): array { // transceive diff --git a/lib/Store/Common/Range/IRangeTally.php b/lib/Store/Common/Range/IRangeTally.php index adc2726..ceec9c4 100644 --- a/lib/Store/Common/Range/IRangeTally.php +++ b/lib/Store/Common/Range/IRangeTally.php @@ -12,32 +12,27 @@ interface IRangeTally extends IRange { /** - * - * @since 1.0.0 + * range anchor type (relative or absolute) */ public function anchor(): RangeAnchorType; /** - * - * @since 1.0.0 + * position within the range */ public function getPosition(): string|int; /** - * - * @since 1.0.0 + * set the position within the range */ public function setPosition(string|int $value): void; /** - * - * @since 1.0.0 + * get count within the range */ public function getCount(): int; /** - * - * @since 1.0.0 + * set the count within the range */ public function setCount(int $value): void; diff --git a/lib/Store/Common/Range/RangeDate.php b/lib/Store/Common/Range/RangeDate.php index 288431a..b152be2 100644 --- a/lib/Store/Common/Range/RangeDate.php +++ b/lib/Store/Common/Range/RangeDate.php @@ -30,46 +30,26 @@ public function __construct( } - /** - * - * @since 1.0.0 - */ #[\Override] public function type(): string { return 'date'; } - /** - * - * @since 1.0.0 - */ #[\Override] public function getStart(): DateTimeInterface { return $this->start; } - /** - * - * @since 1.0.0 - */ #[\Override] public function setStart(DateTimeInterface $value): void { $this->start = $value; } - /** - * - * @since 1.0.0 - */ #[\Override] public function getEnd(): DateTimeInterface { return $this->end; } - /** - * - * @since 1.0.0 - */ #[\Override] public function setEnd(DateTimeInterface $value): void { $this->end = $value; diff --git a/lib/Store/Common/Range/RangeTallyAbsolute.php b/lib/Store/Common/Range/RangeTallyAbsolute.php index 3a805f8..5f60b92 100644 --- a/lib/Store/Common/Range/RangeTallyAbsolute.php +++ b/lib/Store/Common/Range/RangeTallyAbsolute.php @@ -17,55 +17,31 @@ public function __construct( ) { } - /** - * - * @since 1.0.0 - */ #[\Override] public function type(): string { return 'tally'; } - /** - * - * @since 1.0.0 - */ #[\Override] public function anchor(): RangeAnchorType { return RangeAnchorType::ABSOLUTE; } - /** - * - * @since 1.0.0 - */ #[\Override] public function getPosition(): string|int { return $this->position; } - /** - * - * @since 1.0.0 - */ #[\Override] public function setPosition(string|int $value): void { $this->position = $value; } - /** - * - * @since 1.0.0 - */ #[\Override] public function getCount(): int { return $this->count; } - /** - * - * @since 1.0.0 - */ #[\Override] public function setCount(int $value): void { $this->count = $value; diff --git a/lib/Store/Common/Range/RangeTallyRelative.php b/lib/Store/Common/Range/RangeTallyRelative.php index 583976f..0458678 100644 --- a/lib/Store/Common/Range/RangeTallyRelative.php +++ b/lib/Store/Common/Range/RangeTallyRelative.php @@ -17,55 +17,31 @@ public function __construct( ) { } - /** - * - * @since 1.0.0 - */ #[\Override] public function type(): string { return 'tally'; } - /** - * - * @since 1.0.0 - */ #[\Override] public function anchor(): RangeAnchorType { return RangeAnchorType::RELATIVE; } - /** - * - * @since 1.0.0 - */ #[\Override] public function getPosition(): string|int { return $this->position; } - /** - * - * @since 1.0.0 - */ #[\Override] public function setPosition(string|int $value): void { $this->position = $value; } - /** - * - * @since 1.0.0 - */ #[\Override] public function getCount(): int { return $this->count; } - /** - * - * @since 1.0.0 - */ #[\Override] public function setCount(int $value): void { $this->count = $value;