fix: Fix psalm issues

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
pull/45094/head
Marcel Klehr 4 weeks ago
parent 843bb62d6d
commit c9ea5375d8

@ -38,7 +38,9 @@ use OCP\Files\GenericFileException;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;
use OCP\IL10N;
use OCP\IServerContainer;
use OCP\L10N\IFactory;
use OCP\Lock\LockedException;
use OCP\PreConditionNotMetException;
use OCP\SpeechToText\ISpeechToTextProvider;
@ -180,10 +182,12 @@ class Manager implements IManager {
$taskType = new class($oldProvider->getTaskType()) implements ITaskType {
private string $oldTaskTypeClass;
private \OCP\TextProcessing\ITaskType $oldTaskType;
private IL10N $l;
public function __construct(string $oldTaskTypeClass) {
$this->oldTaskTypeClass = $oldTaskTypeClass;
$this->oldTaskType = \OCP\Server::get($oldTaskTypeClass);
$this->l = \OCP\Server::get(IFactory::class)->get('core');
}
public function getId(): string {
@ -199,11 +203,11 @@ class Manager implements IManager {
}
public function getInputShape(): array {
return ['input' => EShapeType::Text];
return ['input' => new ShapeDescriptor($this->l->t('Input text'), $this->l->t('The input text'), EShapeType::Text)];
}
public function getOutputShape(): array {
return ['output' => EShapeType::Text];
return ['output' => new ShapeDescriptor($this->l->t('Input text'), $this->l->t('The input text'), EShapeType::Text)];
}
};
$newTaskTypes[$taskType->getId()] = $taskType;
@ -283,7 +287,7 @@ class Manager implements IManager {
} catch (\RuntimeException $e) {
throw new ProcessingException($e->getMessage(), 0, $e);
}
return ['images' => array_map(fn (File $file) => base64_encode($file->getContent()), $files)];
return ['images' => array_map(fn (File $file) => $file->getContent(), $files)];
}
};
$newProviders[$newProvider->getId()] = $newProvider;

@ -50,6 +50,7 @@ enum EShapeType: int {
* @param mixed $value
* @return void
* @throws ValidationException
* @since 30.0.0
*/
private function validateNonFileType(mixed $value): void {
if ($this === EShapeType::Text && !is_string($value)) {

@ -46,6 +46,7 @@ class ShapeDescriptor implements \JsonSerializable {
/**
* @return array{name: string, description: string, type: int}
* @since 30.0.0
*/
public function jsonSerialize(): array {
return [

Loading…
Cancel
Save