fix: Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
pull/61689/head
Marcel Klehr 2 months ago
parent de4de30aa2
commit 4e01aaaf01
  1. 6
      lib/public/TaskProcessing/EShapeType.php
  2. 6
      lib/public/TaskProcessing/FileShaped.php
  3. 2
      lib/public/TaskProcessing/IInternalTaskType.php
  4. 2
      lib/public/TaskProcessing/ITriggerableProvider.php

@ -161,19 +161,19 @@ enum EShapeType: int {
if ($this === EShapeType::Image && !is_string($value) && !($value instanceof FileShaped && $value->getShapeType() === EShapeType::Image)) {
throw new ValidationException('Non-image item provided for Image slot');
}
if ($this === EShapeType::ListOfImages && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item) && !($value instanceof FileShaped && $value->getShapeType() === EShapeType::Image))) > 0)) {
if ($this === EShapeType::ListOfImages && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item) && !($item instanceof FileShaped && $item->getShapeType() === EShapeType::Image))) > 0)) {
throw new ValidationException('Non-image list item provided for ListOfImages slot');
}
if ($this === EShapeType::Audio && !is_string($value) && !($value instanceof FileShaped && $value->getShapeType() === EShapeType::Audio)) {
throw new ValidationException('Non-audio item provided for Audio slot');
}
if ($this === EShapeType::ListOfAudios && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item) && !($value instanceof FileShaped && $value->getShapeType() === EShapeType::Audio))) > 0)) {
if ($this === EShapeType::ListOfAudios && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item) && !($item instanceof FileShaped && $item->getShapeType() === EShapeType::Audio))) > 0)) {
throw new ValidationException('Non-audio list item provided for ListOfAudio slot');
}
if ($this === EShapeType::Video && !is_string($value) && !($value instanceof FileShaped && $value->getShapeType() === EShapeType::Video)) {
throw new ValidationException('Non-video item provided for Video slot');
}
if ($this === EShapeType::ListOfVideos && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item) && !($value instanceof FileShaped && $value->getShapeType() === EShapeType::Video))) > 0)) {
if ($this === EShapeType::ListOfVideos && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item) && !($item instanceof FileShaped && $item->getShapeType() === EShapeType::Video))) > 0)) {
throw new ValidationException('Non-video list item provided for ListOfVideos slot');
}
if ($this === EShapeType::File && !is_string($value)) {

@ -12,7 +12,7 @@ use OCP\AppFramework\Attribute\Consumable;
/**
* Data object for file-shaped output entries
*
* @since 50.0.0
* @since 35.0.0
*/
#[Consumable(since: '35.0.0')]
class FileShaped {
@ -22,13 +22,13 @@ class FileShaped {
* @param string $mimeType (optional)
* @param string $extension (optional)
*
* @since 30.0.0
* @since 35.0.0
*/
public function __construct(
private EShapeType $shapeType,
private string $data,
private string $mimeType = 'application/octet-stream',
private string $extension = '.bin',
private string $extension = 'bin',
) {
}

@ -17,7 +17,7 @@ use OCP\AppFramework\Attribute\Implementable;
*
* @since 33.0.0
*/
#[Implementable(since:'33.0.0')]
#[Implementable(since: '33.0.0')]
interface IInternalTaskType extends ITaskType {
}

@ -17,7 +17,7 @@ use OCP\AppFramework\Attribute\Implementable;
*
* @since 33.0.0
*/
#[Implementable(since: '30.0.0')]
#[Implementable(since: '33.0.0')]
interface ITriggerableProvider extends IProvider {
/**

Loading…
Cancel
Save