diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-11-29 10:55:12 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2023-12-01 11:52:42 +0100 |
commit | fe6d9e33b47dfc06e9e161971bd2b62532208fa5 (patch) | |
tree | 8d739c5c918641a645edbfea1bbc1d6b17be5189 | |
parent | 546cf0ed2fa5ca7143953639f3a86b58505498a8 (diff) | |
download | nextcloud-server-fe6d9e33b47dfc06e9e161971bd2b62532208fa5.tar.gz nextcloud-server-fe6d9e33b47dfc06e9e161971bd2b62532208fa5.zip |
fix(TextProcessing): Make task type template param covariant
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
-rw-r--r-- | lib/public/TextProcessing/IProvider.php | 2 | ||||
-rw-r--r-- | 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 6132e60b493..fc57add1835 100644 --- a/lib/public/TextProcessing/IProvider.php +++ b/lib/public/TextProcessing/IProvider.php @@ -31,7 +31,7 @@ use RuntimeException; /** * 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 25b7132ee31..c62b7b2fff8 100644 --- a/lib/public/TextProcessing/Task.php +++ b/lib/public/TextProcessing/Task.php @@ -28,9 +28,7 @@ namespace OCP\TextProcessing; /** * This is a text processing task * @since 27.1.0 - * @psalm-template T of ITaskType - * @psalm-template S as class-string<T> - * @psalm-template P as IProvider<T> + * @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<T> $type * @param string $type * @param string $input * @param string $appId @@ -92,7 +90,7 @@ final class Task implements \JsonSerializable { } /** - * @psalm-param P $provider + * @psalm-param IProvider<T> $provider * @param IProvider $provider * @return string * @since 27.1.0 @@ -109,7 +107,7 @@ final class Task implements \JsonSerializable { } /** - * @psalm-param P $provider + * @psalm-param IProvider<T> $provider * @param IProvider $provider * @return bool * @since 27.1.0 @@ -119,7 +117,7 @@ final class Task implements \JsonSerializable { } /** - * @psalm-return S + * @psalm-return class-string<T> * @since 27.1.0 */ final public function getType(): string { @@ -207,7 +205,7 @@ final class Task implements \JsonSerializable { } /** - * @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<T>, 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 { |