diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-24 15:53:13 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-11-05 09:58:11 +0100 |
commit | 77114fb3277742fc69ddcf2432311ecb263af97e (patch) | |
tree | 0f360660038c65acc5f9cd014f183e45b0c5355b /lib/public | |
parent | 1140e41db2ef6241f806eb605df48642a2a32c62 (diff) | |
download | nextcloud-server-77114fb3277742fc69ddcf2432311ecb263af97e.tar.gz nextcloud-server-77114fb3277742fc69ddcf2432311ecb263af97e.zip |
fix(OpenAPI): Adjust array syntax to avoid ambiguitiesfix/openapi/array-syntax
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Dashboard/IAPIWidget.php | 4 | ||||
-rw-r--r-- | lib/public/Dashboard/IButtonWidget.php | 2 | ||||
-rw-r--r-- | lib/public/Dashboard/Model/WidgetItem.php | 10 | ||||
-rw-r--r-- | lib/public/Files/Template/Field.php | 9 | ||||
-rw-r--r-- | lib/public/Files/Template/Fields/CheckBoxField.php | 9 | ||||
-rw-r--r-- | lib/public/Files/Template/Fields/RichTextField.php | 9 | ||||
-rw-r--r-- | lib/public/Files/Template/ITemplateManager.php | 2 | ||||
-rw-r--r-- | lib/public/Files/Template/Template.php | 28 | ||||
-rw-r--r-- | lib/public/Files/Template/TemplateFileCreator.php | 4 | ||||
-rw-r--r-- | lib/public/GroupInterface.php | 2 | ||||
-rw-r--r-- | lib/public/IAppConfig.php | 4 | ||||
-rw-r--r-- | lib/public/ITags.php | 6 | ||||
-rw-r--r-- | lib/public/OCM/IOCMProvider.php | 6 | ||||
-rw-r--r-- | lib/public/OCM/IOCMResource.php | 6 | ||||
-rw-r--r-- | lib/public/TaskProcessing/IManager.php | 2 | ||||
-rw-r--r-- | lib/public/TaskProcessing/Task.php | 4 | ||||
-rw-r--r-- | lib/public/Teams/ITeamManager.php | 2 |
17 files changed, 84 insertions, 25 deletions
diff --git a/lib/public/Dashboard/IAPIWidget.php b/lib/public/Dashboard/IAPIWidget.php index 8fec40cf1b1..c8f98290a0e 100644 --- a/lib/public/Dashboard/IAPIWidget.php +++ b/lib/public/Dashboard/IAPIWidget.php @@ -9,6 +9,8 @@ declare(strict_types=1); namespace OCP\Dashboard; +use OCP\Dashboard\Model\WidgetItem; + /** * interface IAPIWidget * @@ -16,7 +18,7 @@ namespace OCP\Dashboard; */ interface IAPIWidget extends IWidget { /** - * @return \OCP\Dashboard\Model\WidgetItem[] The widget items + * @return list<WidgetItem> The widget items * @since 22.0.0 */ public function getItems(string $userId, ?string $since = null, int $limit = 7): array; diff --git a/lib/public/Dashboard/IButtonWidget.php b/lib/public/Dashboard/IButtonWidget.php index fa8d6bc36a6..f4ebd9253c7 100644 --- a/lib/public/Dashboard/IButtonWidget.php +++ b/lib/public/Dashboard/IButtonWidget.php @@ -19,7 +19,7 @@ interface IButtonWidget extends IWidget { * Get the buttons to show on the widget * * @param string $userId - * @return WidgetButton[] + * @return list<WidgetButton> * @since 25.0.0 */ public function getWidgetButtons(string $userId): array; diff --git a/lib/public/Dashboard/Model/WidgetItem.php b/lib/public/Dashboard/Model/WidgetItem.php index be5fba82323..680daf1b114 100644 --- a/lib/public/Dashboard/Model/WidgetItem.php +++ b/lib/public/Dashboard/Model/WidgetItem.php @@ -134,8 +134,14 @@ final class WidgetItem implements JsonSerializable { /** * @since 22.0.0 - * - * @return array + * @return array{ + * subtitle: string, + * title: string, + * link: string, + * iconUrl: string, + * overlayIconUrl: string, + * sinceId: string, + * } */ public function jsonSerialize(): array { return [ diff --git a/lib/public/Files/Template/Field.php b/lib/public/Files/Template/Field.php index ec195ca3504..e047e83a29e 100644 --- a/lib/public/Files/Template/Field.php +++ b/lib/public/Files/Template/Field.php @@ -32,6 +32,15 @@ abstract class Field implements \JsonSerializable { abstract public function setValue(mixed $value): void; /** + * @return array{ + * index: string, + * type: string, + * alias: ?string, + * tag: ?string, + * id: ?int, + * content?: string, + * checked?: bool, + * } * @since 30.0.0 */ public function jsonSerialize(): array { diff --git a/lib/public/Files/Template/Fields/CheckBoxField.php b/lib/public/Files/Template/Fields/CheckBoxField.php index 48ccb04336a..6fab3ce66a6 100644 --- a/lib/public/Files/Template/Fields/CheckBoxField.php +++ b/lib/public/Files/Template/Fields/CheckBoxField.php @@ -37,6 +37,15 @@ class CheckBoxField extends Field { } /** + * @return array{ + * index: string, + * type: string, + * alias: ?string, + * tag: ?string, + * id: ?int, + * content?: string, + * checked?: bool, + * } * @since 30.0.0 */ public function jsonSerialize(): array { diff --git a/lib/public/Files/Template/Fields/RichTextField.php b/lib/public/Files/Template/Fields/RichTextField.php index 14539bc9dbd..93ead68747c 100644 --- a/lib/public/Files/Template/Fields/RichTextField.php +++ b/lib/public/Files/Template/Fields/RichTextField.php @@ -37,6 +37,15 @@ class RichTextField extends Field { } /** + * @return array{ + * index: string, + * type: string, + * alias: ?string, + * tag: ?string, + * id: ?int, + * content?: string, + * checked?: bool, + * } * @since 30.0.0 */ public function jsonSerialize(): array { diff --git a/lib/public/Files/Template/ITemplateManager.php b/lib/public/Files/Template/ITemplateManager.php index 94e0db935e7..9a81aa51ceb 100644 --- a/lib/public/Files/Template/ITemplateManager.php +++ b/lib/public/Files/Template/ITemplateManager.php @@ -33,7 +33,7 @@ interface ITemplateManager { /** * Get a list of available file creators and their offered templates * - * @return array + * @return list<array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: list<string>, ratio: ?float, actionLabel: string, templates: list<Template>}> * @since 21.0.0 */ public function listTemplates(): array; diff --git a/lib/public/Files/Template/Template.php b/lib/public/Files/Template/Template.php index 634935d212e..7f01c2afa48 100644 --- a/lib/public/Files/Template/Template.php +++ b/lib/public/Files/Template/Template.php @@ -24,7 +24,7 @@ final class Template implements \JsonSerializable { private $hasPreview = false; /** @var string|null */ private $previewUrl = null; - /** @var array */ + /** @var list<Field> */ private $fields = []; /** @@ -51,6 +51,7 @@ final class Template implements \JsonSerializable { } /** + * @param list<Field> $fields * @since 30.0.0 */ public function setFields(array $fields): void { @@ -58,6 +59,29 @@ final class Template implements \JsonSerializable { } /** + * @return array{ + * templateType: string, + * templateId: string, + * basename: string, + * etag: string, + * fileid: int, + * filename: string, + * lastmod: int, + * mime: string, + * size: int|float, + * type: string, + * hasPreview: bool, + * previewUrl: ?string, + * fields: list<array{ + * index: string, + * type: string, + * alias: ?string, + * tag: ?string, + * id: ?int, + * content?: string, + * checked?: bool, + * }>, + * } * @since 21.0.0 */ public function jsonSerialize(): array { @@ -74,7 +98,7 @@ final class Template implements \JsonSerializable { 'type' => $this->file->getType(), 'hasPreview' => $this->hasPreview, 'previewUrl' => $this->previewUrl, - 'fields' => $this->fields + 'fields' => array_map(static fn (Field $field) => $field->jsonSerialize(), $this->fields), ]; } } diff --git a/lib/public/Files/Template/TemplateFileCreator.php b/lib/public/Files/Template/TemplateFileCreator.php index 9a4bd2fae43..809bd3d0bc2 100644 --- a/lib/public/Files/Template/TemplateFileCreator.php +++ b/lib/public/Files/Template/TemplateFileCreator.php @@ -13,7 +13,7 @@ namespace OCP\Files\Template; */ final class TemplateFileCreator implements \JsonSerializable { protected $appId; - /** @var string[] $mimetypes */ + /** @var list<string> $mimetypes */ protected $mimetypes = []; protected $actionName; protected $fileExtension; @@ -121,7 +121,7 @@ final class TemplateFileCreator implements \JsonSerializable { /** * @since 21.0.0 - * @return array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: string[], ratio: ?float, actionLabel: string} + * @return array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: list<string>, ratio: ?float, actionLabel: string} */ public function jsonSerialize(): array { return [ diff --git a/lib/public/GroupInterface.php b/lib/public/GroupInterface.php index a6c01fa1d11..cbfd74a068a 100644 --- a/lib/public/GroupInterface.php +++ b/lib/public/GroupInterface.php @@ -86,7 +86,7 @@ interface GroupInterface { /** * Get all groups a user belongs to * @param string $uid Name of the user - * @return array an array of group names + * @return list<string> an array of group names * @since 4.5.0 * * This function fetches all groups a user belongs to. It does not check diff --git a/lib/public/IAppConfig.php b/lib/public/IAppConfig.php index 49f51467308..fe894da8d31 100644 --- a/lib/public/IAppConfig.php +++ b/lib/public/IAppConfig.php @@ -50,7 +50,7 @@ interface IAppConfig { * * **WARNING:** ignore lazy filtering, all config values are loaded from database * - * @return string[] list of app ids + * @return list<string> list of app ids * @since 7.0.0 */ public function getApps(): array; @@ -63,7 +63,7 @@ interface IAppConfig { * * @param string $app id of the app * - * @return string[] list of stored config keys + * @return list<string> list of stored config keys * @since 29.0.0 */ public function getKeys(string $app): array; diff --git a/lib/public/ITags.php b/lib/public/ITags.php index 0da4522c86c..633cec72085 100644 --- a/lib/public/ITags.php +++ b/lib/public/ITags.php @@ -76,9 +76,9 @@ interface ITags { * ] * ``` * - * @param array $objIds item ids - * @return array|false with object id as key and an array - * of tag names as value or false if an error occurred + * @param list<int> $objIds item ids + * @return array<int, list<string>>|false with object id as key and an array + * of tag names as value or false if an error occurred * @since 8.0.0 */ public function getTagsForObjects(array $objIds); diff --git a/lib/public/OCM/IOCMProvider.php b/lib/public/OCM/IOCMProvider.php index 58b50aca172..ba2ab6ce759 100644 --- a/lib/public/OCM/IOCMProvider.php +++ b/lib/public/OCM/IOCMProvider.php @@ -136,11 +136,11 @@ interface IOCMProvider extends JsonSerializable { * enabled: bool, * apiVersion: string, * endPoint: string, - * resourceTypes: array{ + * resourceTypes: list<array{ * name: string, - * shareTypes: string[], + * shareTypes: list<string>, * protocols: array<string, string> - * }[] + * }>, * } * @since 28.0.0 */ diff --git a/lib/public/OCM/IOCMResource.php b/lib/public/OCM/IOCMResource.php index 788b5563cfc..60bf701e8ea 100644 --- a/lib/public/OCM/IOCMResource.php +++ b/lib/public/OCM/IOCMResource.php @@ -39,7 +39,7 @@ interface IOCMResource extends JsonSerializable { /** * set share types * - * @param string[] $shareTypes + * @param list<string> $shareTypes * * @return $this * @since 28.0.0 @@ -49,7 +49,7 @@ interface IOCMResource extends JsonSerializable { /** * get share types * - * @return string[] + * @return list<string> * @since 28.0.0 */ public function getShareTypes(): array; @@ -85,7 +85,7 @@ interface IOCMResource extends JsonSerializable { /** * @return array{ * name: string, - * shareTypes: string[], + * shareTypes: list<string>, * protocols: array<string, string> * } * @since 28.0.0 diff --git a/lib/public/TaskProcessing/IManager.php b/lib/public/TaskProcessing/IManager.php index 2d5fe1d9ba6..1b59bb12ad4 100644 --- a/lib/public/TaskProcessing/IManager.php +++ b/lib/public/TaskProcessing/IManager.php @@ -46,7 +46,7 @@ interface IManager { public function getPreferredProvider(string $taskTypeId); /** - * @return array<array-key,array{name: string, description: string, inputShape: ShapeDescriptor[], inputShapeEnumValues: ShapeEnumValue[][], inputShapeDefaults: array<array-key, numeric|string>, optionalInputShape: ShapeDescriptor[], optionalInputShapeEnumValues: ShapeEnumValue[][], optionalInputShapeDefaults: array<array-key, numeric|string>, outputShape: ShapeDescriptor[], outputShapeEnumValues: ShapeEnumValue[][], optionalOutputShape: ShapeDescriptor[], optionalOutputShapeEnumValues: ShapeEnumValue[][]}> + * @return array<string, array{name: string, description: string, inputShape: ShapeDescriptor[], inputShapeEnumValues: ShapeEnumValue[][], inputShapeDefaults: array<array-key, numeric|string>, optionalInputShape: ShapeDescriptor[], optionalInputShapeEnumValues: ShapeEnumValue[][], optionalInputShapeDefaults: array<array-key, numeric|string>, outputShape: ShapeDescriptor[], outputShapeEnumValues: ShapeEnumValue[][], optionalOutputShape: ShapeDescriptor[], optionalOutputShapeEnumValues: ShapeEnumValue[][]}> * @since 30.0.0 */ public function getAvailableTaskTypes(): array; diff --git a/lib/public/TaskProcessing/Task.php b/lib/public/TaskProcessing/Task.php index db8e4d7fab5..71c271cd43d 100644 --- a/lib/public/TaskProcessing/Task.php +++ b/lib/public/TaskProcessing/Task.php @@ -253,12 +253,12 @@ final class Task implements \JsonSerializable { } /** - * @psalm-return array{id: ?int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array<array-key, list<numeric|string>|numeric|string>, output: ?array<array-key, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int} + * @psalm-return array{id: int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array<string, list<numeric|string>|numeric|string>, output: ?array<string, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int} * @since 30.0.0 */ final public function jsonSerialize(): array { return [ - 'id' => $this->getId(), + 'id' => (int)$this->getId(), 'type' => $this->getTaskTypeId(), 'lastUpdated' => $this->getLastUpdated(), 'status' => self::statusToString($this->getStatus()), diff --git a/lib/public/Teams/ITeamManager.php b/lib/public/Teams/ITeamManager.php index 5c4c63b4f23..144a141f93e 100644 --- a/lib/public/Teams/ITeamManager.php +++ b/lib/public/Teams/ITeamManager.php @@ -28,7 +28,7 @@ interface ITeamManager { /** * Returns all team resources for a given team and user * - * @return TeamResource[] + * @return list<TeamResource> * @since 29.0.0 */ public function getSharedWith(string $teamId, string $userId): array; |