From 2d65838af1a5ff97fe01a04f7eb0ecf9a781eb6e Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Wed, 29 Nov 2023 10:55:12 +0100 Subject: [PATCH] fix(TextProcessing): Make task type template param covariant Signed-off-by: Marcel Klehr --- lib/public/TextProcessing/IProvider.php | 2 +- lib/public/TextProcessing/Task.php | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/public/TextProcessing/IProvider.php b/lib/public/TextProcessing/IProvider.php index 6132e60b49371..fc57add183540 100644 --- a/lib/public/TextProcessing/IProvider.php +++ b/lib/public/TextProcessing/IProvider.php @@ -31,7 +31,7 @@ /** * This is the interface that is implemented by apps that * implement a text processing provider - * @template T of ITaskType + * @psalm-template-covariant T of ITaskType * @since 27.1.0 */ interface IProvider { diff --git a/lib/public/TextProcessing/Task.php b/lib/public/TextProcessing/Task.php index 25b7132ee3112..c62b7b2fff86c 100644 --- a/lib/public/TextProcessing/Task.php +++ b/lib/public/TextProcessing/Task.php @@ -28,9 +28,7 @@ /** * This is a text processing task * @since 27.1.0 - * @psalm-template T of ITaskType - * @psalm-template S as class-string - * @psalm-template P as IProvider + * @psalm-template-covariant T of ITaskType */ final class Task implements \JsonSerializable { protected ?int $id = null; @@ -74,7 +72,7 @@ final class Task implements \JsonSerializable { protected int $status = self::STATUS_UNKNOWN; /** - * @psalm-param S $type + * @psalm-param class-string $type * @param string $type * @param string $input * @param string $appId @@ -92,7 +90,7 @@ final public function __construct( } /** - * @psalm-param P $provider + * @psalm-param IProvider $provider * @param IProvider $provider * @return string * @since 27.1.0 @@ -109,7 +107,7 @@ public function visitProvider(IProvider $provider): string { } /** - * @psalm-param P $provider + * @psalm-param IProvider $provider * @param IProvider $provider * @return bool * @since 27.1.0 @@ -119,7 +117,7 @@ public function canUseProvider(IProvider $provider): bool { } /** - * @psalm-return S + * @psalm-return class-string * @since 27.1.0 */ final public function getType(): string { @@ -207,7 +205,7 @@ final public function getUserId(): ?string { } /** - * @psalm-return array{id: ?int, type: S, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, output: ?string, identifier: string, completionExpectedAt: ?int} + * @psalm-return array{id: ?int, type: class-string, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, output: ?string, identifier: string, completionExpectedAt: ?int} * @since 27.1.0 */ public function jsonSerialize(): array {