]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(TextProcessing): Make task type template param covariant 41969/head
authorMarcel Klehr <mklehr@gmx.net>
Wed, 29 Nov 2023 09:55:12 +0000 (10:55 +0100)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Fri, 1 Dec 2023 12:36:42 +0000 (12:36 +0000)
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
lib/public/TextProcessing/IProvider.php
lib/public/TextProcessing/Task.php

index 6132e60b49371208f3174b7ee4dd03ce6c8f88a8..fc57add183540d7a7637e2fdf04332922ae9b328 100644 (file)
@@ -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 {
index 25b7132ee3112266b3aed431812595d8d04334d6..c62b7b2fff86c6060296aa22a7cd2350888dcc37 100644 (file)
@@ -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 {