diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index 3153b556a5c87..7b67cdc76d832 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -38,6 +38,7 @@ use OCP\Files\Template\ICustomTemplateProvider; use OCP\IContainer; use OCP\TextProcessing\IProvider as ITextProcessingProvider; +use OCP\TextProcessing\ITaskType; use OCP\TextToImage\IProvider as ITextToImageProvider; use OCP\Notification\INotifier; use OCP\Preview\IProviderV2; @@ -226,7 +227,8 @@ public function registerSpeechToTextProvider(string $providerClass): void; * through the OCP\TextProcessing APIs * * @param string $providerClass - * @psalm-param class-string $providerClass + * @psalm-template T of ITaskType + * @psalm-param class-string> $providerClass * @since 27.1.0 */ public function registerTextProcessingProvider(string $providerClass): void; diff --git a/lib/public/TextProcessing/IManager.php b/lib/public/TextProcessing/IManager.php index ff1222b094d53..0206d776ad537 100644 --- a/lib/public/TextProcessing/IManager.php +++ b/lib/public/TextProcessing/IManager.php @@ -56,7 +56,8 @@ public function getProviders(): array; public function getAvailableTaskTypes(): array; /** - * @param Task $task The task to run + * @psalm-template T of ITaskType + * @param Task $task The task to run * @throws PreConditionNotMetException If no or not the requested provider was registered but this method was still called * @throws TaskFailureException If running the task failed * @since 27.1.0 @@ -68,7 +69,8 @@ public function runTask(Task $task): string; * with the \OCP\LanguageModel\Events\TaskSuccessfulEvent * If inference fails a \OCP\LanguageModel\Events\TaskFailedEvent will be dispatched instead * - * @param Task $task The task to schedule + * @psalm-template T of ITaskType + * @param Task $task The task to schedule * @throws PreConditionNotMetException If no or not the requested provider was registered but this method was still called * @throws Exception storing the task in the database failed * @since 27.1.0 @@ -80,7 +82,8 @@ public function scheduleTask(Task $task) : void; * max execution time of this php process and run it synchronously if it does, if it doesn't fit (or the provider doesn't provide that information) * execution is deferred to a background job * - * @param Task $task The task to schedule + * @psalm-template T of ITaskType + * @param Task $task The task to schedule * @returns bool A boolean indicating whether the task was run synchronously (`true`) or offloaded to a background job (`false`) * @throws PreConditionNotMetException If no or not the requested provider was registered but this method was still called * @throws TaskFailureException If running the task failed @@ -92,7 +95,8 @@ public function runOrScheduleTask(Task $task): bool; /** * Delete a task that has been scheduled before * - * @param Task $task The task to delete + * @psalm-template T of ITaskType + * @param Task $task The task to delete * @since 27.1.0 */ public function deleteTask(Task $task): void; diff --git a/lib/public/TextProcessing/Task.php b/lib/public/TextProcessing/Task.php index 25b7132ee3112..77ed1ffdd2b4c 100644 --- a/lib/public/TextProcessing/Task.php +++ b/lib/public/TextProcessing/Task.php @@ -29,8 +29,6 @@ * 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 */ 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 {