]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(OpenAPI): Adjust array syntax to avoid ambiguities fix/openapi/array-syntax 49015/head
authorprovokateurin <kate@provokateurin.de>
Tue, 24 Sep 2024 13:53:13 +0000 (15:53 +0200)
committerprovokateurin <kate@provokateurin.de>
Tue, 5 Nov 2024 08:58:11 +0000 (09:58 +0100)
Signed-off-by: provokateurin <kate@provokateurin.de>
109 files changed:
apps/cloud_federation_api/lib/Capabilities.php
apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
apps/cloud_federation_api/lib/ResponseDefinitions.php
apps/dashboard/lib/Controller/DashboardApiController.php
apps/dashboard/lib/ResponseDefinitions.php
apps/dav/lib/Controller/UpcomingEventsController.php
apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
apps/federation/lib/Controller/OCSAuthAPIController.php
apps/files/lib/Capabilities.php
apps/files/lib/Controller/DirectEditingController.php
apps/files/lib/Controller/OpenLocalEditorController.php
apps/files/lib/Controller/TemplateController.php
apps/files/lib/Controller/TransferOwnershipController.php
apps/files/lib/Helper.php
apps/files/lib/ResponseDefinitions.php
apps/files/openapi.json
apps/files/tests/HelperTest.php
apps/files_external/lib/Controller/ApiController.php
apps/files_external/lib/Lib/StorageConfig.php
apps/files_external/lib/ResponseDefinitions.php
apps/files_reminders/lib/Controller/ApiController.php
apps/files_sharing/lib/Controller/DeletedShareAPIController.php
apps/files_sharing/lib/Controller/PublicPreviewController.php
apps/files_sharing/lib/Controller/RemoteController.php
apps/files_sharing/lib/Controller/ShareAPIController.php
apps/files_sharing/lib/Controller/ShareInfoController.php
apps/files_sharing/lib/Controller/ShareesAPIController.php
apps/files_sharing/lib/External/Manager.php
apps/files_sharing/lib/ResponseDefinitions.php
apps/files_sharing/openapi.json
apps/files_trashbin/lib/Controller/PreviewController.php
apps/files_versions/lib/Controller/PreviewController.php
apps/provisioning_api/lib/Controller/AUserData.php
apps/provisioning_api/lib/Controller/AppConfigController.php
apps/provisioning_api/lib/Controller/AppsController.php
apps/provisioning_api/lib/Controller/GroupsController.php
apps/provisioning_api/lib/Controller/PreferencesController.php
apps/provisioning_api/lib/Controller/UsersController.php
apps/provisioning_api/lib/ResponseDefinitions.php
apps/sharebymail/lib/Capabilities.php
apps/sharebymail/openapi.json
apps/theming/lib/Controller/ThemingController.php
apps/theming/lib/Controller/UserThemeController.php
apps/updatenotification/lib/Controller/APIController.php
apps/user_ldap/lib/Controller/ConfigAPIController.php
apps/user_ldap/lib/Group_LDAP.php
apps/user_ldap/lib/Group_Proxy.php
apps/user_status/lib/Controller/HeartbeatController.php
apps/user_status/lib/Controller/PredefinedStatusController.php
apps/user_status/lib/Controller/StatusesController.php
apps/user_status/lib/Controller/UserStatusController.php
apps/user_status/lib/Dashboard/UserStatusWidget.php
apps/weather_status/lib/Controller/WeatherStatusController.php
apps/weather_status/lib/Service/WeatherStatusService.php
apps/webhook_listeners/lib/Controller/WebhooksController.php
core/Controller/AppPasswordController.php
core/Controller/AutoCompleteController.php
core/Controller/AvatarController.php
core/Controller/CSRFTokenController.php
core/Controller/ClientFlowLoginV2Controller.php
core/Controller/CollaborationResourcesController.php
core/Controller/HoverCardController.php
core/Controller/LoginController.php
core/Controller/NavigationController.php
core/Controller/OCMController.php
core/Controller/PreviewController.php
core/Controller/ProfileApiController.php
core/Controller/ReferenceApiController.php
core/Controller/TaskProcessingApiController.php
core/Controller/TeamsApiController.php
core/Controller/TextProcessingApiController.php
core/Controller/TextToImageApiController.php
core/Controller/TranslationApiController.php
core/Controller/UnifiedSearchController.php
core/Controller/WhatsNewController.php
core/Controller/WipeController.php
core/ResponseDefinitions.php
core/openapi-ex_app.json
core/openapi-full.json
core/openapi.json
lib/private/AppConfig.php
lib/private/Files/Template/TemplateManager.php
lib/private/Group/Backend.php
lib/private/Group/Database.php
lib/private/Group/Manager.php
lib/private/OCM/Model/OCMProvider.php
lib/private/OCM/Model/OCMResource.php
lib/private/Search/SearchComposer.php
lib/private/Tags.php
lib/private/Teams/TeamManager.php
lib/private/Updater/ChangesCheck.php
lib/private/legacy/OC_App.php
lib/public/Dashboard/IAPIWidget.php
lib/public/Dashboard/IButtonWidget.php
lib/public/Dashboard/Model/WidgetItem.php
lib/public/Files/Template/Field.php
lib/public/Files/Template/Fields/CheckBoxField.php
lib/public/Files/Template/Fields/RichTextField.php
lib/public/Files/Template/ITemplateManager.php
lib/public/Files/Template/Template.php
lib/public/Files/Template/TemplateFileCreator.php
lib/public/GroupInterface.php
lib/public/IAppConfig.php
lib/public/ITags.php
lib/public/OCM/IOCMProvider.php
lib/public/OCM/IOCMResource.php
lib/public/TaskProcessing/IManager.php
lib/public/TaskProcessing/Task.php
lib/public/Teams/ITeamManager.php

index d5cb30bdc3fd435f6d2ad1d0e49ea6c917c0629a..ca4ea928cb823a3380abac2051b901ae06ab7adb 100644 (file)
@@ -31,11 +31,11 @@ class Capabilities implements ICapability {
         *         enabled: bool,
         *         apiVersion: string,
         *         endPoint: string,
-        *         resourceTypes: array{
+        *         resourceTypes: list<array{
         *             name: string,
-        *             shareTypes: string[],
+        *             shareTypes: list<string>,
         *             protocols: array<string, string>
-        *           }[],
+        *           }>,
         *       },
         * }
         * @throws OCMArgumentException
index 4cd668c29a063e224be596d80450b64a97c1de78..a7b17f010cee9e40e4fc678c600302248a94e3f0 100644 (file)
@@ -67,7 +67,7 @@ class RequestHandlerController extends Controller {
         * @param string|null $ownerDisplayName Display name of the user who shared the item
         * @param string|null $sharedBy Provider specific UID of the user who shared the resource
         * @param string|null $sharedByDisplayName Display name of the user who shared the resource
-        * @param array{name: string[], options: array<string, mixed>} $protocol e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]
+        * @param array{name: list<string>, options: array<string, mixed>} $protocol e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]
         * @param string $shareType 'group' or 'user' share
         * @param string $resourceType 'file', 'calendar',...
         *
index 80195c541373b0f98ae81ebbf4595c6bb0a95635..b17f5aadc1d5f0fe6ca2485fb041ed14f3360dc2 100644 (file)
@@ -20,10 +20,10 @@ namespace OCA\CloudFederationAPI;
  * }
  *
  * @psalm-type CloudFederationAPIValidationError = CloudFederationAPIError&array{
- *     validationErrors: array{
+ *     validationErrors: list<array{
  *          name: string,
  *          message: string|null,
- *     }[],
+ *     }>,
  * }
  */
 class ResponseDefinitions {
index c3d91fd9d3457daebd1c6c46b131e9e17daf1f25..d31cede85b790bef4ddff16d29c5150fc79745f6 100644 (file)
@@ -74,8 +74,8 @@ class DashboardApiController extends OCSController {
         * @param array<string, string> $sinceIds Array indexed by widget Ids, contains date/id from which we want the new items
         * @param int $limit Limit number of result items per widget
         * @psalm-param int<1, 30> $limit
-        * @param string[] $widgets Limit results to specific widgets
-        * @return DataResponse<Http::STATUS_OK, array<string, DashboardWidgetItem[]>, array{}>
+        * @param list<string> $widgets Limit results to specific widgets
+        * @return DataResponse<Http::STATUS_OK, array<string, list<DashboardWidgetItem>>, array{}>
         *
         * 200: Widget items returned
         */
@@ -102,7 +102,7 @@ class DashboardApiController extends OCSController {
         * @param array<string, string> $sinceIds Array indexed by widget Ids, contains date/id from which we want the new items
         * @param int $limit Limit number of result items per widget, not more than 30 are allowed
         * @psalm-param int<1, 30> $limit
-        * @param string[] $widgets Limit results to specific widgets
+        * @param list<string> $widgets Limit results to specific widgets
         * @return DataResponse<Http::STATUS_OK, array<string, DashboardWidgetItems>, array{}>
         *
         * 200: Widget items returned
index df76efdab5af642387f63817d9f0a78c4c3b6e91..be5a4d568836f5c3053fea6ba86ad22b6194b39c 100644 (file)
@@ -18,13 +18,13 @@ namespace OCA\Dashboard;
  *     icon_url: string,
  *     widget_url: ?string,
  *     item_icons_round: bool,
- *     item_api_versions: int[],
+ *     item_api_versions: list<int>,
  *     reload_interval: int,
- *     buttons?: array{
+ *     buttons?: list<array{
  *         type: string,
  *         text: string,
  *         link: string,
- *     }[],
+ *     }>,
  * }
  *
  * @psalm-type DashboardWidgetItem = array{
@@ -37,7 +37,7 @@ namespace OCA\Dashboard;
  * }
  *
  * @psalm-type DashboardWidgetItems = array{
- *     items: DashboardWidgetItem[],
+ *     items: list<DashboardWidgetItem>,
  *     emptyContentMessage: string,
  *     halfEmptyContentMessage: string,
  *  }
index c8eb39abb173c8fa005ed3f6ef92ebe8ccf84224..a5d54f44754459bb6906e3151a119ea46a03c34d 100644 (file)
@@ -35,7 +35,7 @@ class UpcomingEventsController extends OCSController {
         * Get information about upcoming events
         *
         * @param string|null $location location/URL to filter by
-        * @return DataResponse<Http::STATUS_OK, array{events: DAVUpcomingEvent[]}, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, null, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{events: list<DAVUpcomingEvent>}, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, null, array{}>
         *
         * 200: Upcoming events
         * 401: When not authenticated
@@ -47,10 +47,10 @@ class UpcomingEventsController extends OCSController {
                }
 
                return new DataResponse([
-                       'events' => array_map(fn (UpcomingEvent $e) => $e->jsonSerialize(), $this->service->getEvents(
+                       'events' => array_values(array_map(fn (UpcomingEvent $e) => $e->jsonSerialize(), $this->service->getEvents(
                                $this->userId,
                                $location,
-                       )),
+                       ))),
                ]);
        }
 
index 222c6490b83c09a39e72af1e17dc43430eaab21c..63de8ff605ea57e564a9b966217f1ea7092433f5 100644 (file)
@@ -72,7 +72,7 @@ class RequestHandlerController extends OCSController {
         * @param int|null $remoteId ID of the remote
         * @param string|null $sharedByFederatedId Federated ID of the sender
         * @param string|null $ownerFederatedId Federated ID of the receiver
-        * @return Http\DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return Http\DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Share created successfully
@@ -186,7 +186,7 @@ class RequestHandlerController extends OCSController {
         *
         * @param int $id ID of the remote share
         * @param string|null $token Shared secret between servers
-        * @return Http\DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return Http\DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         * @throws ShareNotFound
         * @throws HintException
@@ -221,7 +221,7 @@ class RequestHandlerController extends OCSController {
         *
         * @param int $id ID of the remote share
         * @param string|null $token Shared secret between servers
-        * @return Http\DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return Http\DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Share declined successfully
@@ -254,7 +254,7 @@ class RequestHandlerController extends OCSController {
         *
         * @param int $id ID of the share
         * @param string|null $token Shared secret between servers
-        * @return Http\DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return Http\DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Share unshared successfully
@@ -290,7 +290,7 @@ class RequestHandlerController extends OCSController {
         *
         * @param int $id ID of the share
         * @param string|null $token Shared secret between servers
-        * @return Http\DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return Http\DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSBadRequestException Revoking the share is not possible
         *
         * 200: Share revoked successfully
@@ -332,7 +332,7 @@ class RequestHandlerController extends OCSController {
         * @param int $id ID of the share
         * @param string|null $token Shared secret between servers
         * @param int|null $permissions New permissions
-        * @return Http\DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return Http\DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSBadRequestException Updating permissions is not possible
         *
         * 200: Permissions updated successfully
index 0aa3f8bd148cd84fc6f416e59647a231d1713d1e..44725fa0dba9cbedd941d9eb4a98662bb60d4ae6 100644 (file)
@@ -52,7 +52,7 @@ class OCSAuthAPIController extends OCSController {
         *
         * @param string $url URL of the server
         * @param string $token Token of the server
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSForbiddenException Requesting shared secret is not allowed
         *
         * 200: Shared secret requested successfully
@@ -87,7 +87,7 @@ class OCSAuthAPIController extends OCSController {
         *
         * @param string $url URL of the server
         * @param string $token Token of the server
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSForbiddenException Requesting shared secret is not allowed
         *
         * 200: Shared secret requested successfully
index d20d348a9f5df971ac56fb980f7ba2a39566e7ad..16ea42eae22dbcd3c828e6322e2e64b04f3ae55b 100644 (file)
@@ -21,7 +21,7 @@ class Capabilities implements ICapability {
        /**
         * Return this classes capabilities
         *
-        * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: array<mixed>, forbidden_filenames: list<string>, forbidden_filename_basenames: list<string>, forbidden_filename_characters: list<string>, forbidden_filename_extensions: list<string>, chunked_upload: array{max_size: int, max_parallel_count: int}}}
+        * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: list<mixed>, forbidden_filenames: list<string>, forbidden_filename_basenames: list<string>, forbidden_filename_characters: list<string>, forbidden_filename_extensions: list<string>, chunked_upload: array{max_size: int, max_parallel_count: int}}}
         */
        public function getCapabilities(): array {
                return [
index 63f29d3ba2a698c7e879a0b3e3e8cec2c4147ee6..2c910006df5c3fb0b9ec90901e48aa7a29911cc7 100644 (file)
@@ -36,7 +36,7 @@ class DirectEditingController extends OCSController {
 
        /**
         * Get the direct editing capabilities
-        * @return DataResponse<Http::STATUS_OK, array{editors: array<string, array{id: string, name: string, mimetypes: string[], optionalMimetypes: string[], secure: bool}>, creators: array<string, array{id: string, editor: string, name: string, extension: string, templates: bool, mimetypes: string[]}>}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{editors: array<string, array{id: string, name: string, mimetypes: list<string>, optionalMimetypes: list<string>, secure: bool}>, creators: array<string, array{id: string, editor: string, name: string, extension: string, templates: bool, mimetypes: list<string>}>}, array{}>
         *
         * 200: Direct editing capabilities returned
         */
index dae321ae437f8ac94ea227296de0aad9f3fbd208..b000304eef6685c0cea64579045bec90122dba40 100644 (file)
@@ -46,7 +46,7 @@ class OpenLocalEditorController extends OCSController {
         *
         * @param string $path Path of the file
         *
-        * @return DataResponse<Http::STATUS_OK, array{userId: ?string, pathHash: string, expirationTime: int, token: string}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{userId: ?string, pathHash: string, expirationTime: int, token: string}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         *
         * 200: Local editor returned
         */
@@ -91,7 +91,7 @@ class OpenLocalEditorController extends OCSController {
         * @param string $path Path of the file
         * @param string $token Token of the local editor
         *
-        * @return DataResponse<Http::STATUS_OK, array{userId: string, pathHash: string, expirationTime: int, token: string}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{userId: string, pathHash: string, expirationTime: int, token: string}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Local editor validated successfully
         * 404: Local editor not found
index 551c9c54c4b54b5d42790591bc7f8abe6d02ceff..3321fb5f11959ae3f6b46a7bbdf5912383f6d175 100644 (file)
@@ -16,13 +16,16 @@ use OCP\AppFramework\OCS\OCSForbiddenException;
 use OCP\AppFramework\OCSController;
 use OCP\Files\GenericFileException;
 use OCP\Files\Template\ITemplateManager;
+use OCP\Files\Template\Template;
 use OCP\Files\Template\TemplateFileCreator;
 use OCP\IRequest;
 
 /**
  * @psalm-import-type FilesTemplateFile from ResponseDefinitions
  * @psalm-import-type FilesTemplateFileCreator from ResponseDefinitions
+ * @psalm-import-type FilesTemplateFileCreatorWithTemplates from ResponseDefinitions
  * @psalm-import-type FilesTemplateField from ResponseDefinitions
+ * @psalm-import-type FilesTemplate from ResponseDefinitions
  */
 class TemplateController extends OCSController {
        public function __construct(
@@ -36,13 +39,17 @@ class TemplateController extends OCSController {
        /**
         * List the available templates
         *
-        * @return DataResponse<Http::STATUS_OK, array<FilesTemplateFileCreator>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<FilesTemplateFileCreatorWithTemplates>, array{}>
         *
         * 200: Available templates returned
         */
        #[NoAdminRequired]
        public function list(): DataResponse {
-               return new DataResponse($this->templateManager->listTemplates());
+               /* Convert embedded Template instances to arrays to match return type */
+               return new DataResponse(array_map(static function (array $templateFileCreator) {
+                       $templateFileCreator['templates'] = array_map(static fn (Template $template) => $template->jsonSerialize(), $templateFileCreator['templates']);
+                       return $templateFileCreator;
+               }, $this->templateManager->listTemplates()));
        }
 
        /**
@@ -51,7 +58,7 @@ class TemplateController extends OCSController {
         * @param string $filePath Path of the file
         * @param string $templatePath Name of the template
         * @param string $templateType Type of the template
-        * @param FilesTemplateField[] $templateFields Fields of the template
+        * @param list<FilesTemplateField> $templateFields Fields of the template
         *
         * @return DataResponse<Http::STATUS_OK, FilesTemplateFile, array{}>
         * @throws OCSForbiddenException Creating template is not allowed
@@ -82,7 +89,7 @@ class TemplateController extends OCSController {
         * @param string $templatePath Path of the template directory
         * @param bool $copySystemTemplates Whether to copy the system templates to the template directory
         *
-        * @return DataResponse<Http::STATUS_OK, array{template_path: string, templates: FilesTemplateFileCreator[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{template_path: string, templates: list<FilesTemplateFileCreator>}, array{}>
         * @throws OCSForbiddenException Initializing the template directory is not allowed
         *
         * 200: Template directory initialized successfully
@@ -94,7 +101,7 @@ class TemplateController extends OCSController {
                        $templatePath = $this->templateManager->initializeTemplateDirectory($templatePath, null, $copySystemTemplates);
                        return new DataResponse([
                                'template_path' => $templatePath,
-                               'templates' => array_map(fn (TemplateFileCreator $creator) => $creator->jsonSerialize(), $this->templateManager->listCreators()),
+                               'templates' => array_values(array_map(fn (TemplateFileCreator $creator) => $creator->jsonSerialize(), $this->templateManager->listCreators())),
                        ]);
                } catch (\Exception $e) {
                        throw new OCSForbiddenException($e->getMessage());
index 1420e57e987f1a6351b09077131b3a43bb1ef24f..51a25400efb8a4b9bff5d031faac2bb483dad2d7 100644 (file)
@@ -47,7 +47,7 @@ class TransferOwnershipController extends OCSController {
         * @param string $recipient Username of the recipient
         * @param string $path Path of the file
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN, list<empty>, array{}>
         *
         * 200: Ownership transferred successfully
         * 400: Transferring ownership is not possible
@@ -101,7 +101,7 @@ class TransferOwnershipController extends OCSController {
         *
         * @param int $id ID of the ownership transfer
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Ownership transfer accepted successfully
         * 403: Accepting ownership transfer is not allowed
@@ -136,7 +136,7 @@ class TransferOwnershipController extends OCSController {
         *
         * @param int $id ID of the ownership transfer
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Ownership transfer rejected successfully
         * 403: Rejecting ownership transfer is not allowed
index ce33bbb80a6ab2929483e178c81a8a5d661361cb..b66dc9a205610f9743789ac3baf822dc6386a180 100644 (file)
@@ -192,37 +192,34 @@ class Helper {
        /**
         * Populate the result set with file tags
         *
-        * @param array $fileList
-        * @param string $fileIdentifier identifier attribute name for values in $fileList
-        * @param ITagManager $tagManager
-        * @return array file list populated with tags
+        * @psalm-template T of array{tags?: list<string>, file_source: int, ...array<string, mixed>}
+        * @param list<T> $fileList
+        * @return list<T> file list populated with tags
         */
-       public static function populateTags(array $fileList, $fileIdentifier, ITagManager $tagManager) {
-               $ids = [];
-               foreach ($fileList as $fileData) {
-                       $ids[] = $fileData[$fileIdentifier];
-               }
+       public static function populateTags(array $fileList, ITagManager $tagManager) {
                $tagger = $tagManager->load('files');
-               $tags = $tagger->getTagsForObjects($ids);
+               $tags = $tagger->getTagsForObjects(array_map(static fn (array $fileData) => $fileData['file_source'], $fileList));
 
                if (!is_array($tags)) {
                        throw new \UnexpectedValueException('$tags must be an array');
                }
 
                // Set empty tag array
-               foreach ($fileList as $key => $fileData) {
-                       $fileList[$key]['tags'] = [];
+               foreach ($fileList as &$fileData) {
+                       $fileData['tags'] = [];
                }
+               unset($fileData);
 
                if (!empty($tags)) {
                        foreach ($tags as $fileId => $fileTags) {
-                               foreach ($fileList as $key => $fileData) {
-                                       if ($fileId !== $fileData[$fileIdentifier]) {
+                               foreach ($fileList as &$fileData) {
+                                       if ($fileId !== $fileData['file_source']) {
                                                continue;
                                        }
 
-                                       $fileList[$key]['tags'] = $fileTags;
+                                       $fileData['tags'] = $fileTags;
                                }
+                               unset($fileData);
                        }
                }
 
index a05cbb75b210d4ba120fe640e07bb137f798d593..c5d094e7bd8cf5d6ad01d78201afb27d9337bc85 100644 (file)
@@ -22,21 +22,45 @@ namespace OCA\Files;
  *     hasPreview: bool,
  * }
  *
+ * @psalm-type FilesTemplateField = array{
+ *     index: string,
+ *     type: string,
+ *     alias: ?string,
+ *     tag: ?string,
+ *     id: ?int,
+ *     content?: string,
+ *     checked?: bool,
+ * }
+ *
+ * @psalm-type FilesTemplate = 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<FilesTemplateField>,
+ *  }
+ *
  * @psalm-type FilesTemplateFileCreator = array{
  *     app: string,
  *     label: string,
  *     extension: string,
  *     iconClass: ?string,
  *     iconSvgInline: ?string,
- *     mimetypes: string[],
+ *     mimetypes: list<string>,
  *     ratio: ?float,
  *     actionLabel: string,
  * }
  *
- * @psalm-type FilesTemplateField = array{
- *     index: string,
- *     content: string,
- *     type: string,
+ * @psalm-type FilesTemplateFileCreatorWithTemplates = FilesTemplateFileCreator&array{
+ *     templates: list<FilesTemplate>,
  * }
  *
  * @psalm-type FilesFolderTree = list<array{
index ded6ebd95e27b2f48f7daa72d6bec00b2e087e8e..2c33097438f3f5a2f133c41ad410ee435d4a208a 100644 (file)
                     }
                 }
             },
+            "Template": {
+                "type": "object",
+                "required": [
+                    "templateType",
+                    "templateId",
+                    "basename",
+                    "etag",
+                    "fileid",
+                    "filename",
+                    "lastmod",
+                    "mime",
+                    "size",
+                    "type",
+                    "hasPreview",
+                    "previewUrl",
+                    "fields"
+                ],
+                "properties": {
+                    "templateType": {
+                        "type": "string"
+                    },
+                    "templateId": {
+                        "type": "string"
+                    },
+                    "basename": {
+                        "type": "string"
+                    },
+                    "etag": {
+                        "type": "string"
+                    },
+                    "fileid": {
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    "filename": {
+                        "type": "string"
+                    },
+                    "lastmod": {
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    "mime": {
+                        "type": "string"
+                    },
+                    "size": {
+                        "anyOf": [
+                            {
+                                "type": "integer",
+                                "format": "int64"
+                            },
+                            {
+                                "type": "number",
+                                "format": "double"
+                            }
+                        ]
+                    },
+                    "type": {
+                        "type": "string"
+                    },
+                    "hasPreview": {
+                        "type": "boolean"
+                    },
+                    "previewUrl": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "fields": {
+                        "type": "array",
+                        "items": {
+                            "$ref": "#/components/schemas/TemplateField"
+                        }
+                    }
+                }
+            },
             "TemplateField": {
                 "type": "object",
                 "required": [
                     "index",
-                    "content",
-                    "type"
+                    "type",
+                    "alias",
+                    "tag",
+                    "id"
                 ],
                 "properties": {
                     "index": {
                         "type": "string"
                     },
-                    "content": {
+                    "type": {
                         "type": "string"
                     },
-                    "type": {
+                    "alias": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "tag": {
+                        "type": "string",
+                        "nullable": true
+                    },
+                    "id": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "content": {
                         "type": "string"
+                    },
+                    "checked": {
+                        "type": "boolean"
                     }
                 }
             },
                         "type": "string"
                     }
                 }
+            },
+            "TemplateFileCreatorWithTemplates": {
+                "allOf": [
+                    {
+                        "$ref": "#/components/schemas/TemplateFileCreator"
+                    },
+                    {
+                        "type": "object",
+                        "required": [
+                            "templates"
+                        ],
+                        "properties": {
+                            "templates": {
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/Template"
+                                }
+                            }
+                        }
+                    }
+                ]
             }
         }
     },
                                                 "data": {
                                                     "type": "array",
                                                     "items": {
-                                                        "$ref": "#/components/schemas/TemplateFileCreator"
+                                                        "$ref": "#/components/schemas/TemplateFileCreatorWithTemplates"
                                                     }
                                                 }
                                             }
index 27b1de1322f5561420875fab240f5b402aff11e5..0cf2812f816c337e1c97f1bd7583a8e2f4b39c7e 100644 (file)
@@ -104,9 +104,9 @@ class HelperTest extends \Test\TestCase {
                        ->willReturn($tagger);
 
                $data = [
-                       ['id' => 10],
-                       ['id' => 22, 'foo' => 'bar'],
-                       ['id' => 42, 'x' => 'y'],
+                       ['file_source' => 10],
+                       ['file_source' => 22, 'foo' => 'bar'],
+                       ['file_source' => 42, 'x' => 'y'],
                ];
 
                $tags = [
@@ -118,12 +118,12 @@ class HelperTest extends \Test\TestCase {
                        ->with([10, 22, 42])
                        ->willReturn($tags);
 
-               $result = Helper::populateTags($data, 'id', $tagManager);
+               $result = Helper::populateTags($data, $tagManager);
 
                $this->assertSame([
-                       ['id' => 10, 'tags' => ['tag3']],
-                       ['id' => 22, 'foo' => 'bar', 'tags' => []],
-                       ['id' => 42, 'x' => 'y', 'tags' => ['tag1', 'tag2']],
+                       ['file_source' => 10, 'tags' => ['tag3']],
+                       ['file_source' => 22, 'foo' => 'bar', 'tags' => []],
+                       ['file_source' => 42, 'x' => 'y', 'tags' => ['tag1', 'tag2']],
                ], $result);
        }
 }
index 5a7eddf1540836465110af795a06fd47661c95b8..49547357e6bba0bbcc2d77d48d42eb64dc7be6fb 100644 (file)
@@ -74,7 +74,7 @@ class ApiController extends OCSController {
        /**
         * Get the mount points visible for this user
         *
-        * @return DataResponse<Http::STATUS_OK, Files_ExternalMount[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_ExternalMount>, array{}>
         *
         * 200: User mounts returned
         */
index 12523937071b392b4e5a938d6bc37b70b39fb3c8..a9a03528b8ff66483946122c224d53323cf75a48 100644 (file)
@@ -82,14 +82,14 @@ class StorageConfig implements \JsonSerializable {
        /**
         * List of users who have access to this storage
         *
-        * @var string[]
+        * @var list<string>
         */
        private $applicableUsers = [];
 
        /**
         * List of groups that have access to this storage
         *
-        * @var string[]
+        * @var list<string>
         */
        private $applicableGroups = [];
 
@@ -256,7 +256,7 @@ class StorageConfig implements \JsonSerializable {
        /**
         * Returns the users for which to mount this storage
         *
-        * @return string[] applicable users
+        * @return list<string> applicable users
         */
        public function getApplicableUsers() {
                return $this->applicableUsers;
@@ -265,7 +265,7 @@ class StorageConfig implements \JsonSerializable {
        /**
         * Sets the users for which to mount this storage
         *
-        * @param string[]|null $applicableUsers applicable users
+        * @param list<string>|null $applicableUsers applicable users
         */
        public function setApplicableUsers($applicableUsers) {
                if (is_null($applicableUsers)) {
@@ -277,7 +277,7 @@ class StorageConfig implements \JsonSerializable {
        /**
         * Returns the groups for which to mount this storage
         *
-        * @return string[] applicable groups
+        * @return list<string> applicable groups
         */
        public function getApplicableGroups() {
                return $this->applicableGroups;
@@ -286,7 +286,7 @@ class StorageConfig implements \JsonSerializable {
        /**
         * Sets the groups for which to mount this storage
         *
-        * @param string[]|null $applicableGroups applicable groups
+        * @param list<string>|null $applicableGroups applicable groups
         */
        public function setApplicableGroups($applicableGroups) {
                if (is_null($applicableGroups)) {
index e84b985b448d37674a7c9bb1513886fe7313c08e..26a0965f1fc2c4665908687d190aff70f6c27e04 100644 (file)
@@ -11,8 +11,8 @@ namespace OCA\Files_External;
 
 /**
  * @psalm-type Files_ExternalStorageConfig = array{
- *     applicableGroups?: string[],
- *     applicableUsers?: string[],
+ *     applicableGroups?: list<string>,
+ *     applicableUsers?: list<string>,
  *     authMechanism: string,
  *     backend: string,
  *     backendOptions: array<string, mixed>,
index a7d02b936c95fc40ac883a4d272847aecf914401..dbc340610b294bba70f74113d7d8a10b18dc8ba2 100644 (file)
@@ -39,7 +39,7 @@ class ApiController extends OCSController {
         * Get a reminder
         *
         * @param int $fileId ID of the file
-        * @return DataResponse<Http::STATUS_OK, array{dueDate: ?string}, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{dueDate: ?string}, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, list<empty>, array{}>
         *
         * 200: Reminder returned
         * 401: Account not found
@@ -71,7 +71,7 @@ class ApiController extends OCSController {
         * @param int $fileId ID of the file
         * @param string $dueDate ISO 8601 formatted date time string
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_CREATED|Http::STATUS_BAD_REQUEST|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_CREATED|Http::STATUS_BAD_REQUEST|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Reminder updated
         * 201: Reminder created successfully
@@ -109,7 +109,7 @@ class ApiController extends OCSController {
         *
         * @param int $fileId ID of the file
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Reminder deleted successfully
         * 401: Account not found
index 9f80d285d4dd3b3868886a1e2589ef37e8ff9feb..8d93afa4e04d7ea15f0f70c4a21a6ebdf5683a3d 100644 (file)
@@ -135,7 +135,7 @@ class DeletedShareAPIController extends OCSController {
        /**
         * Get a list of all deleted shares
         *
-        * @return DataResponse<Http::STATUS_OK, Files_SharingDeletedShare[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingDeletedShare>, array{}>
         *
         * 200: Deleted shares returned
         */
@@ -148,9 +148,9 @@ class DeletedShareAPIController extends OCSController {
 
                $shares = array_merge($groupShares, $roomShares, $deckShares, $sciencemeshShares);
 
-               $shares = array_map(function (IShare $share) {
+               $shares = array_values(array_map(function (IShare $share) {
                        return $this->formatShare($share);
-               }, $shares);
+               }, $shares));
 
                return new DataResponse($shares);
        }
@@ -159,7 +159,7 @@ class DeletedShareAPIController extends OCSController {
         * Undelete a deleted share
         *
         * @param string $id ID of the share
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         * @throws OCSNotFoundException Share not found
         *
index da71aca904c260ecf973d8581862ed8b0d2ee796..8e8ee3768cbc0b665671321d84868e958e2437d7 100644 (file)
@@ -62,7 +62,7 @@ class PublicPreviewController extends PublicShareController {
         * @param int $x Width of the preview
         * @param int $y Height of the preview
         * @param bool $a Whether to not crop the preview
-        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Preview returned
         * 400: Getting preview is not possible
@@ -134,7 +134,7 @@ class PublicPreviewController extends PublicShareController {
         * Get a direct link preview for a shared file
         *
         * @param string $token Token of the share
-        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Preview returned
         * 400: Getting preview is not possible
index cdac35e0d9ccb88e0b847bd1dcb2e069fe90f452..e23ae51f21998983073d181bc54dc1f7095f58cc 100644 (file)
@@ -41,7 +41,7 @@ class RemoteController extends OCSController {
        /**
         * Get list of pending remote shares
         *
-        * @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingRemoteShare>, array{}>
         *
         * 200: Pending remote shares returned
         */
@@ -54,7 +54,7 @@ class RemoteController extends OCSController {
         * Accept a remote share
         *
         * @param int $id ID of the share
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSNotFoundException Share not found
         *
         * 200: Share accepted successfully
@@ -75,7 +75,7 @@ class RemoteController extends OCSController {
         * Decline a remote share
         *
         * @param int $id ID of the share
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSNotFoundException Share not found
         *
         * 200: Share declined successfully
@@ -116,14 +116,14 @@ class RemoteController extends OCSController {
        /**
         * Get a list of accepted remote shares
         *
-        * @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingRemoteShare>, array{}>
         *
         * 200: Accepted remote shares returned
         */
        #[NoAdminRequired]
        public function getShares() {
                $shares = $this->externalManager->getAcceptedShares();
-               $shares = array_map('self::extendShareInfo', $shares);
+               $shares = array_map(self::extendShareInfo(...), $shares);
 
                return new DataResponse($shares);
        }
@@ -153,7 +153,7 @@ class RemoteController extends OCSController {
         * Unshare a remote share
         *
         * @param int $id ID of the share
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSNotFoundException Share not found
         * @throws OCSForbiddenException Unsharing is not possible
         *
index 077eb4b35a360fa30629cc7861ba9614bcfd0465..71f73f777a5d9c4428a55870fb680fb1adbf49d7 100644 (file)
@@ -351,10 +351,10 @@ class ShareAPIController extends OCSController {
 
 
        /**
-        * @param array $shares
-        * @param array|null $updatedDisplayName
+        * @param list<Files_SharingShare> $shares
+        * @param array<string, string>|null $updatedDisplayName
         *
-        * @return array
+        * @return list<Files_SharingShare>
         */
        private function fixMissingDisplayName(array $shares, ?array $updatedDisplayName = null): array {
                $userIds = $updated = [];
@@ -450,7 +450,7 @@ class ShareAPIController extends OCSController {
         *
         * @param string $id ID of the share
         * @param bool $include_tags Include tags in the share
-        * @return DataResponse<Http::STATUS_OK, Files_SharingShare, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingShare>, array{}>
         * @throws OCSNotFoundException Share not found
         *
         * 200: Share returned
@@ -468,7 +468,7 @@ class ShareAPIController extends OCSController {
                                $share = $this->formatShare($share);
 
                                if ($include_tags) {
-                                       $share = Helper::populateTags([$share], 'file_source', \OC::$server->getTagManager());
+                                       $share = Helper::populateTags([$share], \OC::$server->getTagManager());
                                } else {
                                        $share = [$share];
                                }
@@ -486,7 +486,7 @@ class ShareAPIController extends OCSController {
         * Delete a share
         *
         * @param string $id ID of the share
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSNotFoundException Share not found
         * @throws OCSForbiddenException Missing permissions to delete the share
         *
@@ -828,7 +828,7 @@ class ShareAPIController extends OCSController {
         * @param null|Node $node
         * @param boolean $includeTags
         *
-        * @return Files_SharingShare[]
+        * @return list<Files_SharingShare>
         */
        private function getSharedWithMe($node, bool $includeTags): array {
                $userShares = $this->shareManager->getSharedWith($this->userId, IShare::TYPE_USER, $node, -1, 0);
@@ -856,7 +856,7 @@ class ShareAPIController extends OCSController {
                }
 
                if ($includeTags) {
-                       $formatted = Helper::populateTags($formatted, 'file_source', \OC::$server->getTagManager());
+                       $formatted = Helper::populateTags($formatted, \OC::$server->getTagManager());
                }
 
                return $formatted;
@@ -865,7 +865,7 @@ class ShareAPIController extends OCSController {
        /**
         * @param Node $folder
         *
-        * @return Files_SharingShare[]
+        * @return list<Files_SharingShare>
         * @throws OCSBadRequestException
         * @throws NotFoundException
         */
@@ -925,7 +925,7 @@ class ShareAPIController extends OCSController {
         * @param string $path Get shares for a specific path
         * @param string $include_tags Include tags in the share
         *
-        * @return DataResponse<Http::STATUS_OK, Files_SharingShare[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingShare>, array{}>
         * @throws OCSNotFoundException The folder was not found or is inaccessible
         *
         * 200: Shares returned
@@ -974,7 +974,7 @@ class ShareAPIController extends OCSController {
         * @param bool $subFiles
         * @param bool $includeTags
         *
-        * @return Files_SharingShare[]
+        * @return list<Files_SharingShare>
         * @throws NotFoundException
         * @throws OCSBadRequestException
         */
@@ -1045,7 +1045,7 @@ class ShareAPIController extends OCSController {
 
                if ($includeTags) {
                        $formatted =
-                               Helper::populateTags($formatted, 'file_source', \OC::$server->getTagManager());
+                               Helper::populateTags($formatted, \OC::$server->getTagManager());
                }
 
                return $formatted;
@@ -1057,7 +1057,7 @@ class ShareAPIController extends OCSController {
         *
         * @param string $path Path all shares will be relative to
         *
-        * @return DataResponse<Http::STATUS_OK, Files_SharingShare[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingShare>, array{}>
         * @throws InvalidPathException
         * @throws NotFoundException
         * @throws OCSNotFoundException The given path is invalid
@@ -1371,7 +1371,7 @@ class ShareAPIController extends OCSController {
        /**
         * Get all shares that are still pending
         *
-        * @return DataResponse<Http::STATUS_OK, Files_SharingShare[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<Files_SharingShare>, array{}>
         *
         * 200: Pending shares returned
         */
@@ -1394,7 +1394,7 @@ class ShareAPIController extends OCSController {
                        }
                }
 
-               $result = array_filter(array_map(function (IShare $share) {
+               $result = array_values(array_filter(array_map(function (IShare $share) {
                        $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy());
                        $node = $userFolder->getFirstNodeById($share->getNodeId());
                        if (!$node) {
@@ -1415,7 +1415,7 @@ class ShareAPIController extends OCSController {
                        }
                }, $pendingShares), function ($entry) {
                        return $entry !== null;
-               });
+               }));
 
                return new DataResponse($result);
        }
@@ -1424,7 +1424,7 @@ class ShareAPIController extends OCSController {
         * Accept a share
         *
         * @param string $id ID of the share
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSNotFoundException Share not found
         * @throws OCSException
         * @throws OCSBadRequestException Share could not be accepted
@@ -2095,7 +2095,7 @@ class ShareAPIController extends OCSController {
         * @throws OCSForbiddenException You are not allowed to send mail notifications
         * @throws OCSBadRequestException Invalid request or wrong password
         * @throws OCSException Error while sending mail notification
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         *
         * 200: The email notification was sent successfully
         */
index 05816a986f72f8dacf1b366edb6a518dfc932468..7805973f3c5f605ed31362dc14ced005db514a09 100644 (file)
@@ -48,7 +48,7 @@ class ShareInfoController extends ApiController {
         * @param string|null $password Password of the share
         * @param string|null $dir Subdirectory to get info about
         * @param int $depth Maximum depth to get info about
-        * @return JSONResponse<Http::STATUS_OK, Files_SharingShareInfo, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return JSONResponse<Http::STATUS_OK, Files_SharingShareInfo, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Share info returned
         * 403: Getting share info is not allowed
index 606a3d11de6dd61b49ba2498d7cb0606b30f7206..3a04dda72a19901a1e840ecab858ea38bb5e9fb9 100644 (file)
@@ -94,7 +94,7 @@ class ShareesAPIController extends OCSController {
         * @param string|null $itemType Limit to specific item types
         * @param int $page Page offset for searching
         * @param int $perPage Limit amount of search results per page
-        * @param int|int[]|null $shareType Limit to specific share types
+        * @param int|list<int>|null $shareType Limit to specific share types
         * @param bool $lookup If a global lookup should be performed too
         * @return DataResponse<Http::STATUS_OK, Files_SharingShareesSearchResult, array{Link?: string}>
         * @throws OCSBadRequestException Invalid search parameters
@@ -300,7 +300,7 @@ class ShareesAPIController extends OCSController {
         * Find recommended sharees
         *
         * @param string $itemType Limit to specific item types
-        * @param int|int[]|null $shareType Limit to specific share types
+        * @param int|list<int>|null $shareType Limit to specific share types
         * @return DataResponse<Http::STATUS_OK, Files_SharingShareesRecommendedResult, array{}>
         *
         * 200: Recommended sharees returned
index e0d7f96cb90eb4080714097eeacdb5ebca0db3ae..e10b6c1c91f059b47911fdf7a26344854e56bff7 100644 (file)
@@ -11,6 +11,7 @@ use Doctrine\DBAL\Driver\Exception;
 use OC\Files\Filesystem;
 use OCA\FederatedFileSharing\Events\FederatedShareAddedEvent;
 use OCA\Files_Sharing\Helper;
+use OCA\Files_Sharing\ResponseDefinitions;
 use OCP\DB\QueryBuilder\IQueryBuilder;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Federation\ICloudFederationFactory;
@@ -30,6 +31,9 @@ use OCP\Share;
 use OCP\Share\IShare;
 use Psr\Log\LoggerInterface;
 
+/**
+ * @psalm-import-type Files_SharingRemoteShare from ResponseDefinitions
+ */
 class Manager {
        public const STORAGE = '\OCA\Files_Sharing\External\Storage';
 
@@ -686,7 +690,7 @@ class Manager {
        /**
         * return a list of shares which are not yet accepted by the user
         *
-        * @return array list of open server-to-server shares
+        * @return list<Files_SharingRemoteShare> list of open server-to-server shares
         */
        public function getOpenShares() {
                return $this->getShares(false);
@@ -695,7 +699,7 @@ class Manager {
        /**
         * return a list of shares which are accepted by the user
         *
-        * @return array list of accepted server-to-server shares
+        * @return list<Files_SharingRemoteShare> list of accepted server-to-server shares
         */
        public function getAcceptedShares() {
                return $this->getShares(true);
@@ -707,7 +711,7 @@ class Manager {
         * @param bool|null $accepted True for accepted only,
         *                            false for not accepted,
         *                            null for all shares of the user
-        * @return array list of open server-to-server shares
+        * @return list<Files_SharingRemoteShare> list of open server-to-server shares
         */
        private function getShares($accepted) {
                $user = $this->userManager->get($this->uid);
index d412b93a1355d0c0e3df0b9c1badb88c55e7973a..0edf67fe042dc0368fa108fde7e855790462b86b 100644 (file)
@@ -178,38 +178,38 @@ namespace OCA\Files_Sharing;
  *
  * @psalm-type Files_SharingShareesSearchResult = array{
  *     exact: array{
- *         circles: Files_SharingShareeCircle[],
- *         emails: Files_SharingShareeEmail[],
- *         groups: Files_SharingSharee[],
- *         remote_groups: Files_SharingShareeRemoteGroup[],
- *         remotes: Files_SharingShareeRemote[],
- *         rooms: Files_SharingSharee[],
- *         users: Files_SharingShareeUser[],
+ *         circles: list<Files_SharingShareeCircle>,
+ *         emails: list<Files_SharingShareeEmail>,
+ *         groups: list<Files_SharingSharee>,
+ *         remote_groups: list<Files_SharingShareeRemoteGroup>,
+ *         remotes: list<Files_SharingShareeRemote>,
+ *         rooms: list<Files_SharingSharee>,
+ *         users: list<Files_SharingShareeUser>,
  *     },
- *     circles: Files_SharingShareeCircle[],
- *     emails: Files_SharingShareeEmail[],
- *     groups: Files_SharingSharee[],
- *     lookup: Files_SharingShareeLookup[],
- *     remote_groups: Files_SharingShareeRemoteGroup[],
- *     remotes: Files_SharingShareeRemote[],
- *     rooms: Files_SharingSharee[],
- *     users: Files_SharingShareeUser[],
+ *     circles: list<Files_SharingShareeCircle>,
+ *     emails: list<Files_SharingShareeEmail>,
+ *     groups: list<Files_SharingSharee>,
+ *     lookup: list<Files_SharingShareeLookup>,
+ *     remote_groups: list<Files_SharingShareeRemoteGroup>,
+ *     remotes: list<Files_SharingShareeRemote>,
+ *     rooms: list<Files_SharingSharee>,
+ *     users: list<Files_SharingShareeUser>,
  *     lookupEnabled: bool,
  * }
  *
  * @psalm-type Files_SharingShareesRecommendedResult = array{
  *     exact: array{
- *         emails: Files_SharingShareeEmail[],
- *         groups: Files_SharingSharee[],
- *         remote_groups: Files_SharingShareeRemoteGroup[],
- *         remotes: Files_SharingShareeRemote[],
- *         users: Files_SharingShareeUser[],
+ *         emails: list<Files_SharingShareeEmail>,
+ *         groups: list<Files_SharingSharee>,
+ *         remote_groups: list<Files_SharingShareeRemoteGroup>,
+ *         remotes: list<Files_SharingShareeRemote>,
+ *         users: list<Files_SharingShareeUser>,
  *     },
- *     emails: Files_SharingShareeEmail[],
- *     groups: Files_SharingSharee[],
- *     remote_groups: Files_SharingShareeRemoteGroup[],
- *     remotes: Files_SharingShareeRemote[],
- *     users: Files_SharingShareeUser[],
+ *     emails: list<Files_SharingShareeEmail>,
+ *     groups: list<Files_SharingSharee>,
+ *     remote_groups: list<Files_SharingShareeRemoteGroup>,
+ *     remotes: list<Files_SharingShareeRemote>,
+ *     users: list<Files_SharingShareeUser>,
  * }
  *
  * @psalm-type Files_SharingShareInfo = array{
@@ -222,7 +222,7 @@ namespace OCA\Files_Sharing;
  *     size: int|float,
  *     type: string,
  *     etag: string,
- *     children?: array<string, mixed>[],
+ *     children?: list<array<string, mixed>>,
  * }
  */
 class ResponseDefinitions {
index 848b6293cc8337696256904815e989b8d593ebcb..76063ad3f93495ee6990ddc39ebc522030c3f96f 100644 (file)
                                                     "$ref": "#/components/schemas/OCSMeta"
                                                 },
                                                 "data": {
-                                                    "$ref": "#/components/schemas/Share"
+                                                    "type": "array",
+                                                    "items": {
+                                                        "$ref": "#/components/schemas/Share"
+                                                    }
                                                 }
                                             }
                                         }
index d376ce80fdaa6cbcc80199d1b8e6cf58b19f6411..a71bc4f01c792bcd56da9063bb219ee74a0f3a45 100644 (file)
@@ -46,7 +46,7 @@ class PreviewController extends Controller {
         * @param int $y Height of the preview
         * @param bool $a Whether to not crop the preview
         *
-        * @return Http\FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return Http\FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Preview returned
         * 400: Getting preview is not possible
index e1d87b4b9f51775401efe55a65f1442a7fb5835d..fe984376d29ebfa2aaff45dda84d14de3d7b127e 100644 (file)
@@ -38,7 +38,7 @@ class PreviewController extends Controller {
         * @param int $x Width of the preview
         * @param int $y Height of the preview
         * @param string $version Version of the file to get the preview for
-        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Preview returned
         * 400: Getting preview is not possible
index 603c63062273f972f49e47061df3f434f0d39a6b..61459e40b8b4b036ae33fdfcff3ab9ceaae7f0af 100644 (file)
@@ -222,7 +222,7 @@ abstract class AUserData extends OCSController {
         * Get the groups a user is a subadmin of
         *
         * @param string $userId
-        * @return string[]
+        * @return list<string>
         * @throws OCSException
         */
        protected function getUserSubAdminGroupsData(string $userId): array {
index bb161f6cb8c8a7edd266d88f8d54b3eb4cc9f3e3..d8af1f38d950980d4d98c0df3de2a81ba7d0ea38 100644 (file)
@@ -44,7 +44,7 @@ class AppConfigController extends OCSController {
        /**
         * Get a list of apps
         *
-        * @return DataResponse<Http::STATUS_OK, array{data: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{data: list<string>}, array{}>
         *
         * 200: Apps returned
         */
@@ -58,7 +58,7 @@ class AppConfigController extends OCSController {
         * Get the config keys of an app
         *
         * @param string $app ID of the app
-        * @return DataResponse<Http::STATUS_OK, array{data: string[]}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{data: list<string>}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}>
         *
         * 200: Keys returned
         * 403: App is not allowed
@@ -105,7 +105,7 @@ class AppConfigController extends OCSController {
         * @param string $app ID of the app
         * @param string $key Key to update
         * @param string $value New value for the key
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}>
         *
         * 200: Value updated successfully
         * 403: App or key is not allowed
@@ -154,7 +154,7 @@ class AppConfigController extends OCSController {
         *
         * @param string $app ID of the app
         * @param string $key Key to delete
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array{data: array{message: string}}, array{}>
         *
         * 200: Key deleted successfully
         * 403: App or key is not allowed
index ae08a9cade00a60d9d5c12d9f6545fc436ccdc3a..04dfd8f29b190d62bf7ac6cbbc970354a2db75d5 100644 (file)
@@ -31,18 +31,18 @@ class AppsController extends OCSController {
         * Get a list of installed apps
         *
         * @param ?string $filter Filter for enabled or disabled apps
-        * @return DataResponse<Http::STATUS_OK, array{apps: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{apps: list<string>}, array{}>
         * @throws OCSException
         *
         * 200: Installed apps returned
         */
        public function getApps(?string $filter = null): DataResponse {
                $apps = (new OC_App())->listAllApps();
+               /** @var list<string> $list */
                $list = [];
                foreach ($apps as $app) {
                        $list[] = $app['id'];
                }
-               /** @var string[] $list */
                if ($filter) {
                        switch ($filter) {
                                case 'enabled':
@@ -50,7 +50,7 @@ class AppsController extends OCSController {
                                        break;
                                case 'disabled':
                                        $enabled = OC_App::getEnabledApps();
-                                       return new DataResponse(['apps' => array_diff($list, $enabled)]);
+                                       return new DataResponse(['apps' => array_values(array_diff($list, $enabled))]);
                                        break;
                                default:
                                        // Invalid filter variable
@@ -83,7 +83,7 @@ class AppsController extends OCSController {
         * Enable an app
         *
         * @param string $app ID of the app
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: App enabled successfully
@@ -102,7 +102,7 @@ class AppsController extends OCSController {
         * Disable an app
         *
         * @param string $app ID of the app
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         *
         * 200: App disabled successfully
         */
index 0b16c319f1dc001220e67620cae1529feda06ff6..87544cc899274b0efcc110e0abe8ad537b44f47f 100644 (file)
@@ -68,17 +68,17 @@ class GroupsController extends AUserData {
         * @param string $search Text to search for
         * @param ?int $limit Limit the amount of groups returned
         * @param int $offset Offset for searching for groups
-        * @return DataResponse<Http::STATUS_OK, array{groups: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{groups: list<string>}, array{}>
         *
         * 200: Groups returned
         */
        #[NoAdminRequired]
        public function getGroups(string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
                $groups = $this->groupManager->search($search, $limit, $offset);
-               $groups = array_map(function ($group) {
+               $groups = array_values(array_map(function ($group) {
                        /** @var IGroup $group */
                        return $group->getGID();
-               }, $groups);
+               }, $groups));
 
                return new DataResponse(['groups' => $groups]);
        }
@@ -89,7 +89,7 @@ class GroupsController extends AUserData {
         * @param string $search Text to search for
         * @param ?int $limit Limit the amount of groups returned
         * @param int $offset Offset for searching for groups
-        * @return DataResponse<Http::STATUS_OK, array{groups: Provisioning_APIGroupDetails[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{groups: list<Provisioning_APIGroupDetails>}, array{}>
         *
         * 200: Groups details returned
         */
@@ -97,7 +97,7 @@ class GroupsController extends AUserData {
        #[AuthorizedAdminSetting(settings: Sharing::class)]
        public function getGroupsDetails(string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
                $groups = $this->groupManager->search($search, $limit, $offset);
-               $groups = array_map(function ($group) {
+               $groups = array_values(array_map(function ($group) {
                        /** @var IGroup $group */
                        return [
                                'id' => $group->getGID(),
@@ -107,7 +107,7 @@ class GroupsController extends AUserData {
                                'canAdd' => $group->canAddUser(),
                                'canRemove' => $group->canRemoveUser(),
                        ];
-               }, $groups);
+               }, $groups));
 
                return new DataResponse(['groups' => $groups]);
        }
@@ -116,7 +116,7 @@ class GroupsController extends AUserData {
         * Get a list of users in the specified group
         *
         * @param string $groupId ID of the group
-        * @return DataResponse<Http::STATUS_OK, array{users: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{users: list<string>}, array{}>
         * @throws OCSException
         *
         * @deprecated 14 Use getGroupUsers
@@ -132,7 +132,7 @@ class GroupsController extends AUserData {
         * Get a list of users in the specified group
         *
         * @param string $groupId ID of the group
-        * @return DataResponse<Http::STATUS_OK, array{users: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{users: list<string>}, array{}>
         * @throws OCSException
         * @throws OCSNotFoundException Group not found
         * @throws OCSForbiddenException Missing permissions to get users in the group
@@ -163,7 +163,7 @@ class GroupsController extends AUserData {
                                /** @var IUser $user */
                                return $user->getUID();
                        }, $users);
-                       /** @var string[] $users */
+                       /** @var list<string> $users */
                        $users = array_values($users);
                        return new DataResponse(['users' => $users]);
                }
@@ -233,7 +233,7 @@ class GroupsController extends AUserData {
         *
         * @param string $groupid ID of the group
         * @param string $displayname Display name of the group
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Group created successfully
@@ -266,7 +266,7 @@ class GroupsController extends AUserData {
         * @param string $groupId ID of the group
         * @param string $key Key to update, only 'displayname'
         * @param string $value New value for the key
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Group updated successfully
@@ -295,7 +295,7 @@ class GroupsController extends AUserData {
         * Delete a group
         *
         * @param string $groupId ID of the group
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Group deleted successfully
@@ -320,7 +320,7 @@ class GroupsController extends AUserData {
         * Get the list of user IDs that are a subadmin of the group
         *
         * @param string $groupId ID of the group
-        * @return DataResponse<Http::STATUS_OK, string[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<string>, array{}>
         * @throws OCSException
         *
         * 200: Sub admins returned
@@ -336,7 +336,7 @@ class GroupsController extends AUserData {
                /** @var IUser[] $subadmins */
                $subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup);
                // New class returns IUser[] so convert back
-               /** @var string[] $uids */
+               /** @var list<string> $uids */
                $uids = [];
                foreach ($subadmins as $user) {
                        $uids[] = $user->getUID();
index 672aec7756c83e22b8418f9dbe8488852e275fa9..8ae64e65b81d9ea16da3e76f284a36a0a9896395 100644 (file)
@@ -40,7 +40,7 @@ class PreferencesController extends OCSController {
         * @param string $appId ID of the app
         * @param array<string, string> $configs Key-value pairs of the preferences
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}>
         *
         * 200: Preferences updated successfully
         * 400: Preference invalid
@@ -85,7 +85,7 @@ class PreferencesController extends OCSController {
         * @param string $appId ID of the app
         * @param string $configKey Key of the preference
         * @param string $configValue New value
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}>
         *
         * 200: Preference updated successfully
         * 400: Preference invalid
@@ -124,9 +124,9 @@ class PreferencesController extends OCSController {
         * Delete multiple preferences for an app
         *
         * @param string $appId ID of the app
-        * @param string[] $configKeys Keys to delete
+        * @param list<string> $configKeys Keys to delete
         *
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}>
         *
         * 200: Preferences deleted successfully
         * 400: Preference invalid
@@ -168,7 +168,7 @@ class PreferencesController extends OCSController {
         *
         * @param string $appId ID of the app
         * @param string $configKey Key to delete
-        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, list<empty>, array{}>
         *
         * 200: Preference deleted successfully
         * 400: Preference invalid
index b0cd9bfb448f9a13c77bf0d7a23b431c9f637191..9363b4ca9352ca28b88297a7156b69dd4a44c0fe 100644 (file)
@@ -97,7 +97,7 @@ class UsersController extends AUserData {
         * @param string $search Text to search for
         * @param int|null $limit Limit the amount of groups returned
         * @param int $offset Offset for searching for groups
-        * @return DataResponse<Http::STATUS_OK, array{users: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{users: list<string>}, array{}>
         *
         * 200: Users returned
         */
@@ -125,7 +125,7 @@ class UsersController extends AUserData {
                        }
                }
 
-               /** @var string[] $users */
+               /** @var list<string> $users */
                $users = array_keys($users);
 
                return new DataResponse([
@@ -341,8 +341,8 @@ class UsersController extends AUserData {
         * Search users by their phone numbers
         *
         * @param string $location Location of the phone number (for country code)
-        * @param array<string, string[]> $search Phone numbers to search for
-        * @return DataResponse<Http::STATUS_OK, array<string, string>, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array<empty>, array{}>
+        * @param array<string, list<string>> $search Phone numbers to search for
+        * @return DataResponse<Http::STATUS_OK, array<string, string>, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, list<empty>, array{}>
         *
         * 200: Users returned
         * 400: Invalid location
@@ -433,8 +433,8 @@ class UsersController extends AUserData {
         * @param string $password Password of the user
         * @param string $displayName Display name of the user
         * @param string $email Email of the user
-        * @param string[] $groups Groups of the user
-        * @param string[] $subadmin Groups where the user is subadmin
+        * @param list<string> $groups Groups of the user
+        * @param list<string> $subadmin Groups where the user is subadmin
         * @param string $quota Quota of the user
         * @param string $language Language of the user
         * @param ?string $manager Manager of the user
@@ -689,7 +689,7 @@ class UsersController extends AUserData {
         *
         * Get a list of fields that are editable for the current user
         *
-        * @return DataResponse<Http::STATUS_OK, string[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<string>, array{}>
         * @throws OCSException
         *
         * 200: Editable fields returned
@@ -710,7 +710,7 @@ class UsersController extends AUserData {
         * Get a list of fields that are editable for a user
         *
         * @param string $userId ID of the user
-        * @return DataResponse<Http::STATUS_OK, string[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<string>, array{}>
         * @throws OCSException
         *
         * 200: Editable fields for user returned
@@ -779,7 +779,7 @@ class UsersController extends AUserData {
         * @param string $collectionName Collection to update
         * @param string $key Key that will be updated
         * @param string $value New value for the key
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User values edited successfully
@@ -884,7 +884,7 @@ class UsersController extends AUserData {
         * @param string $userId ID of the user
         * @param string $key Key that will be updated
         * @param string $value New value for the key
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User value edited successfully
@@ -1222,7 +1222,7 @@ class UsersController extends AUserData {
         *
         * @param string $userId ID of the user
         *
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         *
         * @throws OCSException
         *
@@ -1261,7 +1261,7 @@ class UsersController extends AUserData {
         * Delete a user
         *
         * @param string $userId ID of the user
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User deleted successfully
@@ -1301,7 +1301,7 @@ class UsersController extends AUserData {
         * Disable a user
         *
         * @param string $userId ID of the user
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User disabled successfully
@@ -1316,7 +1316,7 @@ class UsersController extends AUserData {
         * Enable a user
         *
         * @param string $userId ID of the user
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User enabled successfully
@@ -1330,7 +1330,7 @@ class UsersController extends AUserData {
        /**
         * @param string $userId
         * @param bool $value
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         */
        private function setEnabled(string $userId, bool $value): DataResponse {
@@ -1360,7 +1360,7 @@ class UsersController extends AUserData {
         * Get a list of groups the user belongs to
         *
         * @param string $userId ID of the user
-        * @return DataResponse<Http::STATUS_OK, array{groups: string[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{groups: list<string>}, array{}>
         * @throws OCSException
         *
         * 200: Users groups returned
@@ -1387,16 +1387,10 @@ class UsersController extends AUserData {
                        // Looking up someone else
                        if ($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) {
                                // Return the group that the method caller is subadmin of for the user in question
-                               /** @var IGroup[] $getSubAdminsGroups */
-                               $getSubAdminsGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
-                               foreach ($getSubAdminsGroups as $key => $group) {
-                                       $getSubAdminsGroups[$key] = $group->getGID();
-                               }
-                               /** @var string[] $groups */
-                               $groups = array_intersect(
-                                       $getSubAdminsGroups,
+                               $groups = array_values(array_intersect(
+                                       array_map(static fn (IGroup $group) => $group->getGID(), $subAdminManager->getSubAdminsGroups($loggedInUser)),
                                        $this->groupManager->getUserGroupIds($targetUser)
-                               );
+                               ));
                                return new DataResponse(['groups' => $groups]);
                        } else {
                                // Not permitted
@@ -1410,7 +1404,7 @@ class UsersController extends AUserData {
         *
         * @param string $userId ID of the user
         * @param string $groupid ID of the group
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User added to group successfully
@@ -1450,7 +1444,7 @@ class UsersController extends AUserData {
         *
         * @param string $userId ID of the user
         * @param string $groupid ID of the group
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User removed from group successfully
@@ -1517,7 +1511,7 @@ class UsersController extends AUserData {
         *
         * @param string $userId ID of the user
         * @param string $groupid ID of the group
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User added as group subadmin successfully
@@ -1557,7 +1551,7 @@ class UsersController extends AUserData {
         *
         * @param string $userId ID of the user
         * @param string $groupid ID of the group
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: User removed as group subadmin successfully
@@ -1591,7 +1585,7 @@ class UsersController extends AUserData {
         * Get the groups a user is a subadmin of
         *
         * @param string $userId ID if the user
-        * @return DataResponse<Http::STATUS_OK, string[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<string>, array{}>
         * @throws OCSException
         *
         * 200: User subadmin groups returned
@@ -1606,7 +1600,7 @@ class UsersController extends AUserData {
         * Resend the welcome message
         *
         * @param string $userId ID if the user
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         *
         * 200: Resent welcome message successfully
index fec68021209a75861e964795654fb51edec4e8cd..afa725c110acebcc7c026b0f7a3709489cb09dcb 100644 (file)
@@ -21,8 +21,8 @@ namespace OCA\Provisioning_API;
  * @psalm-type Provisioning_APIUserDetailsScope = 'v2-private'|'v2-local'|'v2-federated'|'v2-published'|'private'|'contacts'|'public'
  *
  * @psalm-type Provisioning_APIUserDetails = array{
- *     additional_mail: string[],
- *     additional_mailScope?: Provisioning_APIUserDetailsScope[],
+ *     additional_mail: list<string>,
+ *     additional_mailScope?: list<Provisioning_APIUserDetailsScope>,
  *     address: string,
  *     addressScope?: Provisioning_APIUserDetailsScope,
  *     avatarScope?: Provisioning_APIUserDetailsScope,
@@ -41,7 +41,7 @@ namespace OCA\Provisioning_API;
  *     enabled?: bool,
  *     fediverse: string,
  *     fediverseScope?: Provisioning_APIUserDetailsScope,
- *     groups: string[],
+ *     groups: list<string>,
  *     headline: string,
  *     headlineScope?: Provisioning_APIUserDetailsScope,
  *     id: string,
@@ -62,7 +62,7 @@ namespace OCA\Provisioning_API;
  *     role: string,
  *     roleScope?: Provisioning_APIUserDetailsScope,
  *     storageLocation?: string,
- *     subadmin: string[],
+ *     subadmin: list<string>,
  *     twitter: string,
  *     twitterScope?: Provisioning_APIUserDetailsScope,
  *     website: string,
index 5b489b7d7901f56c084d82c32d0de1cca88c68bd..67a0ec7a9dedce508dc77aeb3d20484ac8809f8b 100644 (file)
@@ -24,7 +24,7 @@ class Capabilities implements ICapability {
 
        /**
         * @return array{
-        *     files_sharing: array{
+        *     files_sharing?: array{
         *         sharebymail: array{
         *             enabled: bool,
         *             send_password_by_mail: bool,
@@ -41,7 +41,7 @@ class Capabilities implements ICapability {
         *             },
         *         }
         *     }
-        * }|array<empty>
+        * }
         */
        public function getCapabilities(): array {
                if (!$this->appManager->isEnabledForUser('files_sharing')) {
index 7bc231c07706b8dbd49258875c9495e475b63a48..a64013b19240392becb3b94b25d67c8ac5012398 100644 (file)
         },
         "schemas": {
             "Capabilities": {
-                "oneOf": [
-                    {
+                "type": "object",
+                "properties": {
+                    "files_sharing": {
                         "type": "object",
                         "required": [
-                            "files_sharing"
+                            "sharebymail"
                         ],
                         "properties": {
-                            "files_sharing": {
+                            "sharebymail": {
                                 "type": "object",
                                 "required": [
-                                    "sharebymail"
+                                    "enabled",
+                                    "send_password_by_mail",
+                                    "upload_files_drop",
+                                    "password",
+                                    "expire_date"
                                 ],
                                 "properties": {
-                                    "sharebymail": {
+                                    "enabled": {
+                                        "type": "boolean"
+                                    },
+                                    "send_password_by_mail": {
+                                        "type": "boolean"
+                                    },
+                                    "upload_files_drop": {
+                                        "type": "object",
+                                        "required": [
+                                            "enabled"
+                                        ],
+                                        "properties": {
+                                            "enabled": {
+                                                "type": "boolean"
+                                            }
+                                        }
+                                    },
+                                    "password": {
                                         "type": "object",
                                         "required": [
                                             "enabled",
-                                            "send_password_by_mail",
-                                            "upload_files_drop",
-                                            "password",
-                                            "expire_date"
+                                            "enforced"
                                         ],
                                         "properties": {
                                             "enabled": {
                                                 "type": "boolean"
                                             },
-                                            "send_password_by_mail": {
+                                            "enforced": {
+                                                "type": "boolean"
+                                            }
+                                        }
+                                    },
+                                    "expire_date": {
+                                        "type": "object",
+                                        "required": [
+                                            "enabled",
+                                            "enforced"
+                                        ],
+                                        "properties": {
+                                            "enabled": {
                                                 "type": "boolean"
                                             },
-                                            "upload_files_drop": {
-                                                "type": "object",
-                                                "required": [
-                                                    "enabled"
-                                                ],
-                                                "properties": {
-                                                    "enabled": {
-                                                        "type": "boolean"
-                                                    }
-                                                }
-                                            },
-                                            "password": {
-                                                "type": "object",
-                                                "required": [
-                                                    "enabled",
-                                                    "enforced"
-                                                ],
-                                                "properties": {
-                                                    "enabled": {
-                                                        "type": "boolean"
-                                                    },
-                                                    "enforced": {
-                                                        "type": "boolean"
-                                                    }
-                                                }
-                                            },
-                                            "expire_date": {
-                                                "type": "object",
-                                                "required": [
-                                                    "enabled",
-                                                    "enforced"
-                                                ],
-                                                "properties": {
-                                                    "enabled": {
-                                                        "type": "boolean"
-                                                    },
-                                                    "enforced": {
-                                                        "type": "boolean"
-                                                    }
-                                                }
+                                            "enforced": {
+                                                "type": "boolean"
                                             }
                                         }
                                     }
                                 }
                             }
                         }
-                    },
-                    {
-                        "type": "array",
-                        "maxItems": 0
                     }
-                ]
+                }
             }
         }
     },
index 1b02595fa39a6ae7866f0beb308aef2a9c9b9ec8..d748a6278b41dbc7f45e9a1b5fd7e683bf30395d 100644 (file)
@@ -417,7 +417,7 @@ class ThemingController extends Controller {
         *
         * @param string $app ID of the app
         * @psalm-suppress LessSpecificReturnStatement The content of the Manifest doesn't need to be described in the return type
-        * @return JSONResponse<Http::STATUS_OK, array{name: string, short_name: string, start_url: string, theme_color: string, background_color: string, description: string, icons: array{src: non-empty-string, type: string, sizes: string}[], display: string}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array{}, array{}>
+        * @return JSONResponse<Http::STATUS_OK, array{name: string, short_name: string, start_url: string, theme_color: string, background_color: string, description: string, icons: list<array{src: non-empty-string, type: string, sizes: string}>, display: string}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array{}, array{}>
         *
         * 200: Manifest returned
         * 404: App not found
index 9bcf32daa9cb4e4d60b76aa5f07aa2a8aaac3945..1ead97f5d37b1bc05aff98d8e5fbbd18f201ab1c 100644 (file)
@@ -58,7 +58,7 @@ class UserThemeController extends OCSController {
         * Enable theme
         *
         * @param string $themeId the theme ID
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSBadRequestException Enabling theme is not possible
         * @throws PreConditionNotMetException
         *
@@ -77,7 +77,7 @@ class UserThemeController extends OCSController {
         * Disable theme
         *
         * @param string $themeId the theme ID
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSBadRequestException Disabling theme is not possible
         * @throws PreConditionNotMetException
         *
index 59643e935d19093fb165103958d08f99861dd70e..6b4f559f6506774b9b747f4fb5b76ff52e1e293a 100644 (file)
@@ -62,7 +62,7 @@ class APIController extends OCSController {
         *
         * @param string $newVersion Server version to check updates for
         *
-        * @return DataResponse<Http::STATUS_OK, array{missing: UpdateNotificationApp[], available: UpdateNotificationApp[]}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array{appstore_disabled: bool, already_on_latest?: bool}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{missing: list<UpdateNotificationApp>, available: list<UpdateNotificationApp>}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array{appstore_disabled: bool, already_on_latest?: bool}, array{}>
         *
         * 200: Apps returned
         * 404: New versions not found
index 8ce2486c153abbf5eb2da4c3ab0f77db13b193b3..0a019312e355e07b7a943cd0113719b336575230 100644 (file)
@@ -74,7 +74,7 @@ class ConfigAPIController extends OCSController {
         * Delete a LDAP configuration
         *
         * @param string $configID ID of the config
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         * @throws OCSNotFoundException Config not found
         *
@@ -102,7 +102,7 @@ class ConfigAPIController extends OCSController {
         *
         * @param string $configID ID of the config
         * @param array<string, mixed> $configData New config
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSException
         * @throws OCSBadRequestException Modifying config is not possible
         * @throws OCSNotFoundException Config not found
index 2c99fadfcc94d2bfd16284cd17509aa9c5299985..0cd263edec8c2a72577f1706682347d58da24311 100644 (file)
@@ -638,6 +638,10 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis
                return false;
        }
 
+       /**
+        * @param string $uid
+        * @return list<string>
+        */
        protected function getCachedGroupsForUserId(string $uid): array {
                $groupStr = $this->config->getUserValue($uid, 'user_ldap', 'cached-group-memberships-' . $this->access->connection->getConfigPrefix(), '[]');
                return json_decode($groupStr, true) ?? [];
@@ -650,7 +654,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis
         * This function includes groups based on dynamic group membership.
         *
         * @param string $uid Name of the user
-        * @return string[] Group names
+        * @return list<string> Group names
         * @throws Exception
         * @throws ServerNotAvailableException
         */
index 11b7498fbed7e7d913d76a858f96bae9063ee547..8ed3a5dd87d8021f9563dd94471a1df16da31f7b 100644 (file)
@@ -133,7 +133,7 @@ class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDispl
         * Get all groups a user belongs to
         *
         * @param string $uid Name of the user
-        * @return string[] with group names
+        * @return list<string> with group names
         *
         * This function fetches all groups a user belongs to. It does not check
         * if the user exists at all.
index d1da035329e0f19e2177bd9d6e8de8c4e6847b90..30f4af6572a7f16abc1e060a790584c07e05d6bf 100644 (file)
@@ -44,7 +44,7 @@ class HeartbeatController extends OCSController {
         *
         * @param string $status Only online, away
         *
-        * @return DataResponse<Http::STATUS_OK, UserStatusPrivate, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NO_CONTENT, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, UserStatusPrivate, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NO_CONTENT, list<empty>, array{}>
         *
         * 200: Status successfully updated
         * 204: User has no status to keep alive
index 143003608806726ff107f1bd7d880772314a4c0a..70262d1108ad7ba54f6961f102c9ee83cffad4e9 100644 (file)
@@ -42,7 +42,7 @@ class PredefinedStatusController extends OCSController {
        /**
         * Get all predefined messages
         *
-        * @return DataResponse<Http::STATUS_OK, UserStatusPredefined[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<UserStatusPredefined>, array{}>
         *
         * 200: Predefined statuses returned
         */
@@ -50,8 +50,8 @@ class PredefinedStatusController extends OCSController {
        #[ApiRoute(verb: 'GET', url: '/api/v1/predefined_statuses/')]
        public function findAll():DataResponse {
                // Filtering out the invisible one, that should only be set by API
-               return new DataResponse(array_filter($this->predefinedStatusService->getDefaultStatuses(), function (array $status) {
+               return new DataResponse(array_values(array_filter($this->predefinedStatusService->getDefaultStatuses(), function (array $status) {
                        return !array_key_exists('visible', $status) || $status['visible'] === true;
-               }));
+               })));
        }
 }
index f9c64c075bf8f67ae6a7a5506f01863e42a1a57b..e27a0fabbed998665643db19082074caceefed0f 100644 (file)
@@ -47,7 +47,7 @@ class StatusesController extends OCSController {
         *
         * @param int|null $limit Maximum number of statuses to find
         * @param int|null $offset Offset for finding statuses
-        * @return DataResponse<Http::STATUS_OK, UserStatusPublic[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<UserStatusPublic>, array{}>
         *
         * 200: Statuses returned
         */
@@ -56,9 +56,9 @@ class StatusesController extends OCSController {
        public function findAll(?int $limit = null, ?int $offset = null): DataResponse {
                $allStatuses = $this->service->findAll($limit, $offset);
 
-               return new DataResponse(array_map(function ($userStatus) {
+               return new DataResponse(array_values(array_map(function ($userStatus) {
                        return $this->formatStatus($userStatus);
-               }, $allStatuses));
+               }, $allStatuses)));
        }
 
        /**
index bc2efaf86e6960f68e41fb9fa3be9d18b7d2b6dc..a65f9a75c9f98986890f6ed5064fe819eb102329 100644 (file)
@@ -155,7 +155,7 @@ class UserStatusController extends OCSController {
        /**
         * Clear the message of the current user
         *
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         *
         * 200: Message cleared successfully
         */
@@ -171,7 +171,7 @@ class UserStatusController extends OCSController {
         *
         * @param string $messageId ID of the message to delete
         *
-        * @return DataResponse<Http::STATUS_OK, UserStatusPrivate|array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, UserStatusPrivate|list<empty>, array{}>
         *
         * 200: Status reverted
         */
index 9dce2b1412a9ecb9bfffdb6bcd0941d2f94c8127..c1091d4bb21198bc09bf8eb0542cad8d4e52b268 100644 (file)
@@ -143,7 +143,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption
        public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
                $widgetItemsData = $this->getWidgetData($userId, $since, $limit);
 
-               return array_map(function (array $widgetData) {
+               return array_values(array_map(function (array $widgetData) {
                        $formattedDate = $this->dateTimeFormatter->formatTimeSpan($widgetData['timestamp']);
                        return new WidgetItem(
                                $widgetData['displayName'],
@@ -157,7 +157,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption
                                ),
                                (string)$widgetData['timestamp']
                        );
-               }, $widgetItemsData);
+               }, $widgetItemsData));
        }
 
        /**
index 953e09f2f2de4a319537f02b352f79349b326e63..c56ea3b97b37e7e16f83fe4aceca3fdf88758bbd 100644 (file)
@@ -93,7 +93,7 @@ class WeatherStatusController extends OCSController {
        /**
         * Get forecast for current location
         *
-        * @return DataResponse<Http::STATUS_OK, WeatherStatusForecast[]|array{error: string}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, WeatherStatusSuccess, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<WeatherStatusForecast>|array{error: string}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, WeatherStatusSuccess, array{}>
         *
         * 200: Forecast returned
         * 404: Forecast not found
@@ -111,7 +111,7 @@ class WeatherStatusController extends OCSController {
        /**
         * Get favorites list
         *
-        * @return DataResponse<Http::STATUS_OK, string[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<string>, array{}>
         *
         * 200: Favorites returned
         */
@@ -123,7 +123,7 @@ class WeatherStatusController extends OCSController {
        /**
         * Set favorites list
         *
-        * @param string[] $favorites Favorite addresses
+        * @param list<string> $favorites Favorite addresses
         * @return DataResponse<Http::STATUS_OK, WeatherStatusSuccess, array{}>
         *
         * 200: Favorites updated
index 9d9972e84efc9df8cac2893b6be308694034fac7..04500cf66a541bcfd4abd7e01b2c4e945ea72475 100644 (file)
@@ -70,7 +70,7 @@ class WeatherStatusService {
 
        /**
         * Get favorites list
-        * @return string[]
+        * @return list<string>
         */
        public function getFavorites(): array {
                $favoritesJson = $this->config->getUserValue($this->userId, Application::APP_ID, 'favorites', '');
@@ -79,7 +79,7 @@ class WeatherStatusService {
 
        /**
         * Set favorites list
-        * @param string[] $favorites
+        * @param list<string> $favorites
         * @return WeatherStatusSuccess success state
         */
        public function setFavorites(array $favorites): array {
@@ -287,7 +287,7 @@ class WeatherStatusService {
        /**
         * Get forecast for current location
         *
-        * @return WeatherStatusForecast[]|array{error: string}|WeatherStatusSuccess which contains success state and filtered forecast data
+        * @return list<WeatherStatusForecast>|array{error: string}|WeatherStatusSuccess which contains success state and filtered forecast data
         */
        public function getForecast(): array {
                $lat = $this->config->getUserValue($this->userId, Application::APP_ID, 'lat', '');
@@ -310,7 +310,7 @@ class WeatherStatusService {
         * @param float $lon Longitude of requested forecast, in decimal degree format
         * @param float $altitude Altitude of requested forecast, in meter
         * @param int $nbValues Number of forecast values (hours)
-        * @return WeatherStatusForecast[]|array{error: string} Filtered forecast data
+        * @return list<WeatherStatusForecast>|array{error: string} Filtered forecast data
         */
        private function forecastRequest(float $lat, float $lon, float $altitude, int $nbValues = 10): array {
                $params = [
index 1d5e37cb373b079caacd42c32ba47d5387a9c09e..ef8e2e1e2444c1290ff5fbb5d7988f51ea008169 100644 (file)
@@ -50,7 +50,7 @@ class WebhooksController extends OCSController {
         * List registered webhooks
         *
         * @param string|null $uri The callback URI to filter by
-        * @return DataResponse<Http::STATUS_OK, WebhookListenersWebhookInfo[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<WebhookListenersWebhookInfo>, array{}>
         * @throws OCSException Other internal error
         *
         * 200: Webhook registrations returned
@@ -66,12 +66,10 @@ class WebhooksController extends OCSController {
                                $webhookListeners = $this->mapper->getAll();
                        }
 
-                       return new DataResponse(
-                               array_map(
-                                       fn (WebhookListener $listener): array => $listener->jsonSerialize(),
-                                       $webhookListeners
-                               )
-                       );
+                       return new DataResponse(array_values(array_map(
+                               fn (WebhookListener $listener): array => $listener->jsonSerialize(),
+                               $webhookListeners
+                       )));
                } catch (\Exception $e) {
                        $this->logger->error('Error when listing webhooks', ['exception' => $e]);
                        throw new OCSException('An internal error occurred', Http::STATUS_INTERNAL_SERVER_ERROR, $e);
index b43f0077507d38de1452f07d026cd58d77fbd153..16ec124e23a732c37e13e0c279df79984d85222a 100644 (file)
@@ -102,7 +102,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
        /**
         * Delete app password
         *
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSForbiddenException Deleting app password is not allowed
         *
         * 200: App password deleted successfully
@@ -162,7 +162,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
         *
         * @param string $password The password of the user
         *
-        * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, list<empty>, array{}>
         *
         * 200: Password confirmation succeeded
         * 403: Password confirmation failed
index 654570e66ec1498d18191b77b536510a97b9ae2f..692fe1b7297cb8d5971dd6fdd229c3e21851e8d3 100644 (file)
@@ -43,10 +43,10 @@ class AutoCompleteController extends OCSController {
         * @param string|null $itemType Type of the items to search for
         * @param string|null $itemId ID of the items to search for
         * @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients"
-        * @param int[] $shareTypes Types of shares to search for
+        * @param list<int> $shareTypes Types of shares to search for
         * @param int $limit Maximum number of results to return
         *
-        * @return DataResponse<Http::STATUS_OK, CoreAutocompleteResult[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreAutocompleteResult>, array{}>
         *
         * 200: Autocomplete results returned
         */
@@ -100,7 +100,7 @@ class AutoCompleteController extends OCSController {
        }
 
        /**
-        * @return CoreAutocompleteResult[]
+        * @return list<CoreAutocompleteResult>
         */
        protected function prepareResultArray(array $results): array {
                $output = [];
index 5003d5824e35bf7efa2745e705eb321c0d12ab70..4d5e810ddb95434a8813e8f8ab96e155b2533c38 100644 (file)
@@ -57,7 +57,7 @@ class AvatarController extends Controller {
         * @param string $userId ID of the user
         * @param 64|512 $size Size of the avatar
         * @param bool $guestFallback Fallback to guest avatar if not found
-        * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}>
         *
         * 200: Avatar returned
         * 201: Avatar returned
@@ -108,7 +108,7 @@ class AvatarController extends Controller {
         * @param string $userId ID of the user
         * @param 64|512 $size Size of the avatar
         * @param bool $guestFallback Fallback to guest avatar if not found
-        * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}>
         *
         * 200: Avatar returned
         * 201: Avatar returned
index c3d1a7f842b28a9f885c806e9b679befae3e86aa..8ea475941c8d1fc878a0332e1bb6d9376e4539c8 100644 (file)
@@ -29,7 +29,7 @@ class CSRFTokenController extends Controller {
        /**
         * Returns a new CSRF token.
         *
-        * @return JSONResponse<Http::STATUS_OK, array{token: string}, array{}>|JSONResponse<Http::STATUS_FORBIDDEN, array<empty>, array{}>
+        * @return JSONResponse<Http::STATUS_OK, array{token: string}, array{}>|JSONResponse<Http::STATUS_FORBIDDEN, list<empty>, array{}>
         *
         * 200: CSRF token returned
         * 403: Strict cookie check failed
index 43eac012be1a06babf50eaec3b5f0130c387faba..b973a57924e6e35a2561e4d2a1731e3eddb0ef91 100644 (file)
@@ -61,7 +61,7 @@ class ClientFlowLoginV2Controller extends Controller {
         * Poll the login flow credentials
         *
         * @param string $token Token of the flow
-        * @return JSONResponse<Http::STATUS_OK, CoreLoginFlowV2Credentials, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return JSONResponse<Http::STATUS_OK, CoreLoginFlowV2Credentials, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Login flow credentials returned
         * 404: Login flow not found or completed
index 6f27789c56633a7c1e890f95dd45dcbba2815c47..e160d733176999192162d6b08ae3991d6e0c041c 100644 (file)
@@ -59,7 +59,7 @@ class CollaborationResourcesController extends OCSController {
         * Get a collection
         *
         * @param int $collectionId ID of the collection
-        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         *
         * 200: Collection returned
         * 404: Collection not found
@@ -80,7 +80,7 @@ class CollaborationResourcesController extends OCSController {
         * Search for collections
         *
         * @param string $filter Filter collections
-        * @return DataResponse<Http::STATUS_OK, CoreCollection[], array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreCollection>, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Collections returned
         * 404: Collection not found
@@ -103,7 +103,7 @@ class CollaborationResourcesController extends OCSController {
         * @param int $collectionId ID of the collection
         * @param string $resourceType Name of the resource
         * @param string $resourceId ID of the resource
-        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         *
         * 200: Collection returned
         * 404: Collection not found or resource inaccessible
@@ -137,7 +137,7 @@ class CollaborationResourcesController extends OCSController {
         * @param int $collectionId ID of the collection
         * @param string $resourceType Name of the resource
         * @param string $resourceId ID of the resource
-        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         *
         * 200: Collection returned
         * 404: Collection or resource not found
@@ -167,7 +167,7 @@ class CollaborationResourcesController extends OCSController {
         *
         * @param string $resourceType Type of the resource
         * @param string $resourceId ID of the resource
-        * @return DataResponse<Http::STATUS_OK, CoreCollection[], array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreCollection>, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Collections returned
         * 404: Resource not accessible
@@ -194,7 +194,7 @@ class CollaborationResourcesController extends OCSController {
         * @param string $baseResourceType Type of the base resource
         * @param string $baseResourceId ID of the base resource
         * @param string $name Name of the collection
-        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         *
         * 200: Collection returned
         * 400: Creating collection is not possible
@@ -228,7 +228,7 @@ class CollaborationResourcesController extends OCSController {
         *
         * @param int $collectionId ID of the collection
         * @param string $collectionName New name
-        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         *
         * 200: Collection returned
         * 404: Collection not found
@@ -248,7 +248,7 @@ class CollaborationResourcesController extends OCSController {
        }
 
        /**
-        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}>
         */
        protected function respondCollection(ICollection $collection): DataResponse {
                try {
@@ -262,7 +262,7 @@ class CollaborationResourcesController extends OCSController {
        }
 
        /**
-        * @return CoreCollection[]
+        * @return list<CoreCollection>
         */
        protected function prepareCollections(array $collections): array {
                $result = [];
@@ -295,7 +295,7 @@ class CollaborationResourcesController extends OCSController {
        }
 
        /**
-        * @return CoreResource[]
+        * @return list<CoreResource>
         */
        protected function prepareResources(array $resources): array {
                $result = [];
index 588cef2a72d09de35791b0466e1d66ff913f08ce..7a816e21d14b3ec4c091fb14cf6fb2bcbae25371 100644 (file)
@@ -33,7 +33,7 @@ class HoverCardController extends \OCP\AppFramework\OCSController {
         * Get the account details for a hovercard
         *
         * @param string $userId ID of the user
-        * @return DataResponse<Http::STATUS_OK, array{userId: string, displayName: string, actions: CoreContactsAction[]}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{userId: string, displayName: string, actions: list<CoreContactsAction>}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Account details returned
         * 404: Account not found
@@ -54,7 +54,7 @@ class HoverCardController extends \OCP\AppFramework\OCSController {
                        array_unshift($actions, $data['topAction']);
                }
 
-               /** @var CoreContactsAction[] $actions */
+               /** @var list<CoreContactsAction> $actions */
                return new DataResponse([
                        'userId' => $userId,
                        'displayName' => $contact->getFullName(),
index a433c3073b4098a9b7e0eab438d07b2106e87907..d4d6a17db796ad5761bc369c21dc03b9e9ffd348 100644 (file)
@@ -381,7 +381,7 @@ class LoginController extends Controller {
         *
         * @param string $password The password of the user
         *
-        * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, list<empty>, array{}>
         *
         * 200: Password confirmation succeeded
         * 403: Password confirmation failed
index 44c8ef0880b20adc64f616818528d8a880bca9ab..de72e41294535fa15764aab497fd078581c2e8c3 100644 (file)
@@ -33,7 +33,7 @@ class NavigationController extends OCSController {
         * Get the apps navigation
         *
         * @param bool $absolute Rewrite URLs to absolute ones
-        * @return DataResponse<Http::STATUS_OK, CoreNavigationEntry[], array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreNavigationEntry>, array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, list<empty>, array{}>
         *
         * 200: Apps navigation returned
         * 304: No apps navigation changed
@@ -60,7 +60,7 @@ class NavigationController extends OCSController {
         * Get the settings navigation
         *
         * @param bool $absolute Rewrite URLs to absolute ones
-        * @return DataResponse<Http::STATUS_OK, CoreNavigationEntry[], array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreNavigationEntry>, array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, list<empty>, array{}>
         *
         * 200: Apps navigation returned
         * 304: No apps navigation changed
index b53dc08fecf322a617636916125282cb0b591b99..59529b66e121abf88e6a897652eb3f1556105d58 100644 (file)
@@ -43,7 +43,7 @@ class OCMController extends Controller {
         *
         * @psalm-suppress MoreSpecificReturnType
         * @psalm-suppress LessSpecificReturnStatement
-        * @return DataResponse<Http::STATUS_OK, array{enabled: bool, apiVersion: string, endPoint: string, resourceTypes: array{name: string, shareTypes: string[], protocols: array{webdav: string}}[]}, array{X-NEXTCLOUD-OCM-PROVIDERS: true, Content-Type: 'application/json'}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{enabled: bool, apiVersion: string, endPoint: string, resourceTypes: list<array{name: string, shareTypes: list<string>, protocols: array{webdav: string}}>}, array{X-NEXTCLOUD-OCM-PROVIDERS: true, Content-Type: 'application/json'}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
         *
         * 200: OCM Provider details returned
         * 500: OCM not supported
index 807df4a2ebcbd829f3b672ca7142d4b47e776ef3..2720da671be094a1d633136e732510fc5353b070 100644 (file)
@@ -47,7 +47,7 @@ class PreviewController extends Controller {
         * @param bool $forceIcon Force returning an icon
         * @param 'fill'|'cover' $mode How to crop the image
         * @param bool $mimeFallback Whether to fallback to the mime icon if no preview is available
-        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
         *
         * 200: Preview returned
         * 303: Redirect to the mime icon url if mimeFallback is true
@@ -90,7 +90,7 @@ class PreviewController extends Controller {
         * @param bool $forceIcon Force returning an icon
         * @param 'fill'|'cover' $mode How to crop the image
         * @param bool $mimeFallback Whether to fallback to the mime icon if no preview is available
-        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
         *
         * 200: Preview returned
         * 303: Redirect to the mime icon url if mimeFallback is true
@@ -124,7 +124,7 @@ class PreviewController extends Controller {
        }
 
        /**
-        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
+        * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
         */
        private function fetchPreview(
                Node $node,
index bbfb9cc4153824cb5a3ebe1379dcd0295873c46c..c807ecb72d4201230d466133fdb9760badda5e6f 100644 (file)
@@ -44,7 +44,7 @@ class ProfileApiController extends OCSController {
         * @param string $targetUserId ID of the user
         * @param string $paramId ID of the parameter
         * @param string $visibility New visibility
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws OCSBadRequestException Updating visibility is not possible
         * @throws OCSForbiddenException Not allowed to edit other users visibility
         * @throws OCSNotFoundException Account not found
index cba91b976e26118fa6a36c417499e11698afa5d7..0d34e6244f5964914de636930d38090b536a9aab 100644 (file)
@@ -141,7 +141,7 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
        /**
         * Resolve multiple references
         *
-        * @param string[] $references References to resolve
+        * @param list<string> $references References to resolve
         * @param int $limit Maximum amount of references to resolve
         * @return DataResponse<Http::STATUS_OK, array{references: array<string, CoreReference|null>}, array{}>
         *
@@ -168,7 +168,7 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
        /**
         * Resolve multiple references from a public page
         *
-        * @param string[] $references References to resolve
+        * @param list<string> $references References to resolve
         * @param string $sharingToken Token of the public share
         * @param int $limit Maximum amount of references to resolve, limited to 15
         * @return DataResponse<Http::STATUS_OK, array{references: array<string, CoreReference|null>}, array{}>
@@ -197,7 +197,7 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
        /**
         * Get the providers
         *
-        * @return DataResponse<Http::STATUS_OK, CoreReferenceProvider[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreReferenceProvider>, array{}>
         *
         * 200: Providers returned
         */
@@ -205,9 +205,9 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
        #[ApiRoute(verb: 'GET', url: '/providers', root: '/references')]
        public function getProvidersInfo(): DataResponse {
                $providers = $this->referenceManager->getDiscoverableProviders();
-               $jsonProviders = array_map(static function (IDiscoverableReferenceProvider $provider) {
+               $jsonProviders = array_values(array_map(static function (IDiscoverableReferenceProvider $provider) {
                        return $provider->jsonSerialize();
-               }, $providers);
+               }, $providers));
                return new DataResponse($jsonProviders);
        }
 
index 7ee5e7068af4d83370417330204d4c5ad7c123da..e41c178f44d7b0ed27cd0d85a6c883093b6ec1a8 100644 (file)
@@ -68,30 +68,30 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
        #[ApiRoute(verb: 'GET', url: '/tasktypes', root: '/taskprocessing')]
        public function taskTypes(): DataResponse {
                $taskTypes = array_map(function (array $tt) {
-                       $tt['inputShape'] = array_map(function ($descriptor) {
+                       $tt['inputShape'] = array_values(array_map(function ($descriptor) {
                                return $descriptor->jsonSerialize();
-                       }, $tt['inputShape']);
-                       $tt['outputShape'] = array_map(function ($descriptor) {
+                       }, $tt['inputShape']));
+                       $tt['outputShape'] = array_values(array_map(function ($descriptor) {
                                return $descriptor->jsonSerialize();
-                       }, $tt['outputShape']);
-                       $tt['optionalInputShape'] = array_map(function ($descriptor) {
+                       }, $tt['outputShape']));
+                       $tt['optionalInputShape'] = array_values(array_map(function ($descriptor) {
                                return $descriptor->jsonSerialize();
-                       }, $tt['optionalInputShape']);
-                       $tt['optionalOutputShape'] = array_map(function ($descriptor) {
+                       }, $tt['optionalInputShape']));
+                       $tt['optionalOutputShape'] = array_values(array_map(function ($descriptor) {
                                return $descriptor->jsonSerialize();
-                       }, $tt['optionalOutputShape']);
-                       $tt['inputShapeEnumValues'] = array_map(function (array $enumValues) {
-                               return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues);
-                       }, $tt['inputShapeEnumValues']);
-                       $tt['optionalInputShapeEnumValues'] = array_map(function (array $enumValues) {
-                               return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues);
-                       }, $tt['optionalInputShapeEnumValues']);
-                       $tt['outputShapeEnumValues'] = array_map(function (array $enumValues) {
-                               return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues);
-                       }, $tt['outputShapeEnumValues']);
-                       $tt['optionalOutputShapeEnumValues'] = array_map(function (array $enumValues) {
-                               return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues);
-                       }, $tt['optionalOutputShapeEnumValues']);
+                       }, $tt['optionalOutputShape']));
+                       $tt['inputShapeEnumValues'] = array_values(array_map(function (array $enumValues) {
+                               return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues));
+                       }, $tt['inputShapeEnumValues']));
+                       $tt['optionalInputShapeEnumValues'] = array_values(array_map(function (array $enumValues) {
+                               return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues));
+                       }, $tt['optionalInputShapeEnumValues']));
+                       $tt['outputShapeEnumValues'] = array_values(array_map(function (array $enumValues) {
+                               return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues));
+                       }, $tt['outputShapeEnumValues']));
+                       $tt['optionalOutputShapeEnumValues'] = array_values(array_map(function (array $enumValues) {
+                               return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues));
+                       }, $tt['optionalOutputShapeEnumValues']));
                        return $tt;
                }, $this->taskProcessingManager->getAvailableTaskTypes());
                return new DataResponse([
@@ -208,7 +208,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
         *
         * @param string $appId ID of the app
         * @param string|null $customId An arbitrary identifier for the task
-        * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTaskProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
         *
         * 200: Tasks returned
         */
@@ -217,7 +217,6 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
        public function listTasksByApp(string $appId, ?string $customId = null): DataResponse {
                try {
                        $tasks = $this->taskProcessingManager->getUserTasksByApp($this->userId, $appId, $customId);
-                       /** @var CoreTaskProcessingTask[] $json */
                        $json = array_map(static function (Task $task) {
                                return $task->jsonSerialize();
                        }, $tasks);
@@ -235,7 +234,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
         *
         * @param string|null $taskType The task type to filter by
         * @param string|null $customId An arbitrary identifier for the task
-        * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTaskProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
         *
         * 200: Tasks returned
         */
@@ -244,7 +243,6 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
        public function listTasks(?string $taskType, ?string $customId = null): DataResponse {
                try {
                        $tasks = $this->taskProcessingManager->getUserTasks($this->userId, $taskType, $customId);
-                       /** @var CoreTaskProcessingTask[] $json */
                        $json = array_map(static function (Task $task) {
                                return $task->jsonSerialize();
                        }, $tasks);
index a27f6deff760fd7f7390c7f6f4e7396d1bba0044..36685555d4df20b63380a6a1ebfaff07caa65139 100644 (file)
@@ -36,7 +36,7 @@ class TeamsApiController extends \OCP\AppFramework\OCSController {
         * Get all resources of a team
         *
         * @param string $teamId Unique id of the team
-        * @return DataResponse<Http::STATUS_OK, array{resources: CoreTeamResource[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{resources: list<CoreTeamResource>}, array{}>
         *
         * 200: Resources returned
         */
@@ -44,7 +44,7 @@ class TeamsApiController extends \OCP\AppFramework\OCSController {
        #[ApiRoute(verb: 'GET', url: '/{teamId}/resources', root: '/teams')]
        public function resolveOne(string $teamId): DataResponse {
                /**
-                * @var CoreTeamResource[] $resolvedResources
+                * @var list<CoreTeamResource> $resolvedResources
                 * @psalm-suppress PossiblyNullArgument The route is limited to logged-in users
                 */
                $resolvedResources = $this->teamManager->getSharedWith($teamId, $this->userId);
@@ -57,7 +57,7 @@ class TeamsApiController extends \OCP\AppFramework\OCSController {
         *
         * @param string $providerId Identifier of the provider (e.g. deck, talk, collectives)
         * @param string $resourceId Unique id of the resource to list teams for (e.g. deck board id)
-        * @return DataResponse<Http::STATUS_OK, array{teams: CoreTeam[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{teams: list<CoreTeam>}, array{}>
         *
         * 200: Teams returned
         */
@@ -66,13 +66,13 @@ class TeamsApiController extends \OCP\AppFramework\OCSController {
        public function listTeams(string $providerId, string $resourceId): DataResponse {
                /** @psalm-suppress PossiblyNullArgument The route is limited to logged-in users */
                $teams = $this->teamManager->getTeamsForResource($providerId, $resourceId, $this->userId);
-               /** @var CoreTeam[] $teams */
-               $teams = array_map(function (Team $team) {
+               /** @var list<CoreTeam> $teams */
+               $teams = array_values(array_map(function (Team $team) {
                        $response = $team->jsonSerialize();
                        /** @psalm-suppress PossiblyNullArgument The route is limited to logged in users */
                        $response['resources'] = $this->teamManager->getSharedWith($team->getId(), $this->userId);
                        return $response;
-               }, $teams);
+               }, $teams));
 
                return new DataResponse([
                        'teams' => $teams,
index a0acf1932897d14dbc837a7b26d6cbc8406399f3..cdf39563167cdfa8362d10b0d6e23233340b51d1 100644 (file)
@@ -52,7 +52,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController {
        /**
         * This endpoint returns all available LanguageModel task types
         *
-        * @return DataResponse<Http::STATUS_OK, array{types: array{id: string, name: string, description: string}[]}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{types: list<array{id: string, name: string, description: string}>}, array{}>
         *
         * 200: Task types returned
         */
@@ -191,7 +191,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController {
         *
         * @param string $appId ID of the app
         * @param string|null $identifier An arbitrary identifier for the task
-        * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTextProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTextProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
         *
         * 200: Task list returned
         */
@@ -200,10 +200,9 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController {
        public function listTasksByApp(string $appId, ?string $identifier = null): DataResponse {
                try {
                        $tasks = $this->textProcessingManager->getUserTasksByApp($this->userId, $appId, $identifier);
-                       /** @var CoreTextProcessingTask[] $json */
-                       $json = array_map(static function (Task $task) {
+                       $json = array_values(array_map(static function (Task $task) {
                                return $task->jsonSerialize();
-                       }, $tasks);
+                       }, $tasks));
 
                        return new DataResponse([
                                'tasks' => $json,
index 241c752ea013d1fa7ce22973748bbf74456a1ab4..3ffc868e80f23f1f6e79d7be04f314aeaebc2c99 100644 (file)
@@ -212,7 +212,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
         *
         * @param string $appId ID of the app
         * @param string|null $identifier An arbitrary identifier for the task
-        * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTextToImageTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTextToImageTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
         *
         * 200: Task list returned
         */
@@ -222,10 +222,9 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
        public function listTasksByApp(string $appId, ?string $identifier = null): DataResponse {
                try {
                        $tasks = $this->textToImageManager->getUserTasksByApp($this->userId, $appId, $identifier);
-                       /** @var CoreTextToImageTask[] $json */
-                       $json = array_map(static function (Task $task) {
+                       $json = array_values(array_map(static function (Task $task) {
                                return $task->jsonSerialize();
-                       }, $tasks);
+                       }, $tasks));
 
                        return new DataResponse([
                                'tasks' => $json,
index 81ed190277ba6f2562c08465f63bb6c6aac53df6..294251baa47b13a8c14d902013375fbabd4b6c4c 100644 (file)
@@ -36,7 +36,7 @@ class TranslationApiController extends \OCP\AppFramework\OCSController {
        /**
         * Get the list of supported languages
         *
-        * @return DataResponse<Http::STATUS_OK, array{languages: array{from: string, fromLabel: string, to: string, toLabel: string}[], languageDetection: bool}, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{languages: list<array{from: string, fromLabel: string, to: string, toLabel: string}>, languageDetection: bool}, array{}>
         *
         * 200: Supported languages returned
         */
@@ -44,7 +44,7 @@ class TranslationApiController extends \OCP\AppFramework\OCSController {
        #[ApiRoute(verb: 'GET', url: '/languages', root: '/translation')]
        public function languages(): DataResponse {
                return new DataResponse([
-                       'languages' => array_map(fn ($lang) => $lang->jsonSerialize(), $this->translationManager->getLanguages()),
+                       'languages' => array_values(array_map(fn ($lang) => $lang->jsonSerialize(), $this->translationManager->getLanguages())),
                        'languageDetection' => $this->translationManager->canDetectLanguage(),
                ]);
        }
index 20d6fb5e59c23a6c25e04387a56ffda772e5ed21..c770c6240df6fb21b99cea4fd85274f07edf7f96 100644 (file)
@@ -45,7 +45,7 @@ class UnifiedSearchController extends OCSController {
         * Get the providers for unified search
         *
         * @param string $from the url the user is currently at
-        * @return DataResponse<Http::STATUS_OK, CoreUnifiedSearchProvider[], array{}>
+        * @return DataResponse<Http::STATUS_OK, list<CoreUnifiedSearchProvider>, array{}>
         *
         * 200: Providers returned
         */
index 98c5e77964b2cf740d1e6751342ce96bc9058f49..86192d8f4667ac3ca1a5aff9671c827d43f7ddad 100644 (file)
@@ -41,7 +41,7 @@ class WhatsNewController extends OCSController {
        /**
         * Get the changes
         *
-        * @return DataResponse<Http::STATUS_OK, array{changelogURL: string, product: string, version: string, whatsNew?: array{regular: string[], admin: string[]}}, array{}>|DataResponse<Http::STATUS_NO_CONTENT, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, array{changelogURL: string, product: string, version: string, whatsNew?: array{regular: list<string>, admin: list<string>}}, array{}>|DataResponse<Http::STATUS_NO_CONTENT, list<empty>, array{}>
         *
         * 200: Changes returned
         * 204: No changes
@@ -87,7 +87,7 @@ class WhatsNewController extends OCSController {
         *
         * @param string $version Version to dismiss the changes for
         *
-        * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
+        * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
         * @throws \OCP\PreConditionNotMetException
         * @throws DoesNotExistException
         *
index fe9ee79f3b46b609b6e68600e44f16cdf30ac6a8..d364e6399d948391f804b13b0602592c57b4d733 100644 (file)
@@ -33,7 +33,7 @@ class WipeController extends Controller {
         *
         * @param string $token App password
         *
-        * @return JSONResponse<Http::STATUS_OK, array{wipe: bool}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return JSONResponse<Http::STATUS_OK, array{wipe: bool}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Device should be wiped
         * 404: Device should not be wiped
@@ -62,7 +62,7 @@ class WipeController extends Controller {
         *
         * @param string $token App password
         *
-        * @return JSONResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, array<empty>, array{}>
+        * @return JSONResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, list<empty>, array{}>
         *
         * 200: Wipe finished successfully
         * 404: Device should not be wiped
index 4edde2dde3608e87f3ee67ac6a0aaef51b612de5..7dfd3b7da9be5b2636942698822e342ca61c13ea 100644 (file)
@@ -63,7 +63,7 @@ namespace OC\Core;
  * @psalm-type CoreCollection = array{
  *     id: int,
  *     name: string,
- *     resources: CoreResource[],
+ *     resources: list<CoreResource>,
  * }
  *
  * @psalm-type CoreReference = array{
@@ -78,7 +78,7 @@ namespace OC\Core;
  *     title: string,
  *     icon_url: string,
  *     order: int,
- *     search_providers_ids: ?string[]
+ *     search_providers_ids: ?list<string>,
  * }
  *
  * @psalm-type CoreUnifiedSearchProvider = array{
@@ -87,7 +87,7 @@ namespace OC\Core;
  *     name: string,
  *     icon: string,
  *     order: int,
- *     triggers: string[],
+ *     triggers: list<string>,
  *     filters: array<string, string>,
  *     inAppSearch: bool,
  * }
@@ -99,13 +99,13 @@ namespace OC\Core;
  *     resourceUrl: string,
  *     icon: string,
  *     rounded: bool,
- *     attributes: string[],
+ *     attributes: list<string>,
  * }
  *
  * @psalm-type CoreUnifiedSearchResult = array{
  *     name: string,
  *     isPaginated: bool,
- *     entries: CoreUnifiedSearchResultEntry[],
+ *     entries: list<CoreUnifiedSearchResultEntry>,
  *     cursor: int|string|null,
  * }
  *
@@ -171,16 +171,16 @@ namespace OC\Core;
  * @psalm-type CoreTaskProcessingTaskType = array{
  *     name: string,
  *     description: string,
- *     inputShape: CoreTaskProcessingShape[],
- *     inputShapeEnumValues: array{name: string, value: string}[][],
+ *     inputShape: list<CoreTaskProcessingShape>,
+ *     inputShapeEnumValues: list<list<array{name: string, value: string}>>,
  *     inputShapeDefaults: array<string, numeric|string>,
- *     optionalInputShape: CoreTaskProcessingShape[],
- *     optionalInputShapeEnumValues: array{name: string, value: string}[][],
+ *     optionalInputShape: list<CoreTaskProcessingShape>,
+ *     optionalInputShapeEnumValues: list<list<array{name: string, value: string}>>,
  *     optionalInputShapeDefaults: array<string, numeric|string>,
- *     outputShape: CoreTaskProcessingShape[],
- *     outputShapeEnumValues: array{name: string, value: string}[][],
- *     optionalOutputShape: CoreTaskProcessingShape[],
- *     optionalOutputShapeEnumValues: array{name: string, value: string}[][]}
+ *     outputShape: list<CoreTaskProcessingShape>,
+ *     outputShapeEnumValues: list<list<array{name: string, value: string}>>,
+ *     optionalOutputShape: list<CoreTaskProcessingShape>,
+ *     optionalOutputShapeEnumValues: list<list<array{name: string, value: string}>>,
  * }
  *
  * @psalm-type CoreTaskProcessingIO = array<string, numeric|list<numeric>|string|list<string>>
@@ -196,7 +196,10 @@ namespace OC\Core;
  *     output: null|CoreTaskProcessingIO,
  *     customId: ?string,
  *     completionExpectedAt: ?int,
- *     progress: ?float
+ *     progress: ?float,
+ *     scheduledAt: ?int,
+ *     startedAt: ?int,
+ *     endedAt: ?int,
  * }
  *
  */
index cc4a53e10b19d79844ccb2fd8e3881bdc539c73e..95a86e8e112ccc55196f10c834f716954521c1a2 100644 (file)
                     "output",
                     "customId",
                     "completionExpectedAt",
-                    "progress"
+                    "progress",
+                    "scheduledAt",
+                    "startedAt",
+                    "endedAt"
                 ],
                 "properties": {
                     "id": {
                         "type": "number",
                         "format": "double",
                         "nullable": true
+                    },
+                    "scheduledAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "startedAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "endedAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
                     }
                 }
             }
index 36ff35d55b95f84f648ebde298ebd000dee40fd2..d6f9837b1c60258c60c4a0d0cdac162769ec069f 100644 (file)
                     "output",
                     "customId",
                     "completionExpectedAt",
-                    "progress"
+                    "progress",
+                    "scheduledAt",
+                    "startedAt",
+                    "endedAt"
                 ],
                 "properties": {
                     "id": {
                         "type": "number",
                         "format": "double",
                         "nullable": true
+                    },
+                    "scheduledAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "startedAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "endedAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
                     }
                 }
             },
index 582b01fd050b68fb42f99081b4f2668e4ca79c50..bf8f2478fbda5e2101cd7e6af10db6d3107c355e 100644 (file)
                     "output",
                     "customId",
                     "completionExpectedAt",
-                    "progress"
+                    "progress",
+                    "scheduledAt",
+                    "startedAt",
+                    "endedAt"
                 ],
                 "properties": {
                     "id": {
                         "type": "number",
                         "format": "double",
                         "nullable": true
+                    },
+                    "scheduledAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "startedAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
+                    },
+                    "endedAt": {
+                        "type": "integer",
+                        "format": "int64",
+                        "nullable": true
                     }
                 }
             },
index 312b6973403444427b58b8187c57ffaa3c0a055e..a0e5d7e28e8455570ffcb99a5bc671e6f8d882fb 100644 (file)
@@ -76,7 +76,7 @@ class AppConfig implements IAppConfig {
        /**
         * @inheritDoc
         *
-        * @return string[] list of app ids
+        * @return list<string> list of app ids
         * @since 7.0.0
         */
        public function getApps(): array {
@@ -92,7 +92,7 @@ class AppConfig implements 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 {
index 865af4eb90c96ab9abb9fc98c737c272a9017644..47011f875ae12221d69aa7596e2b7d04cc4f8092 100644 (file)
@@ -118,11 +118,11 @@ class TemplateManager implements ITemplateManager {
        }
 
        public function listTemplates(): array {
-               return array_map(function (TemplateFileCreator $entry) {
+               return array_values(array_map(function (TemplateFileCreator $entry) {
                        return array_merge($entry->jsonSerialize(), [
                                'templates' => $this->getTemplateFiles($entry)
                        ]);
-               }, $this->listCreators());
+               }, $this->listCreators()));
        }
 
        /**
@@ -180,6 +180,9 @@ class TemplateManager implements ITemplateManager {
                throw new NotFoundException();
        }
 
+       /**
+        * @return list<Template>
+        */
        private function getTemplateFiles(TemplateFileCreator $type): array {
                $templates = [];
                foreach ($this->getRegisteredProviders() as $provider) {
index f6844308a1582e0c96dd65620b4b788dbf86f673..f4a90018b5a98a0888310a07a07c26f8f1869e42 100644 (file)
@@ -71,7 +71,7 @@ abstract class Backend implements \OCP\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
         *
         * This function fetches all groups a user belongs to. It does not check
         * if the user exists at all.
index 095cbe24316a6648ea4f2e2226bee971b802a1c6..0cb571a39356cf4abe459c9baf538bd66650b583 100644 (file)
@@ -194,7 +194,7 @@ class Database extends ABackend implements
        /**
         * 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
         *
         * This function fetches all groups a user belongs to. It does not check
         * if the user exists at all.
index bd46780a602a3b49f0fc2a9c981779503f9a350d..e58a1fe65856f77552222fcb4eb4ac92178a9078 100644 (file)
@@ -361,7 +361,7 @@ class Manager extends PublicEmitter implements IGroupManager {
         * get a list of group ids for a user
         *
         * @param IUser $user
-        * @return string[] with group ids
+        * @return list<string> with group ids
         */
        public function getUserGroupIds(IUser $user): array {
                return $this->getUserIdGroupIds($user->getUID());
@@ -369,7 +369,7 @@ class Manager extends PublicEmitter implements IGroupManager {
 
        /**
         * @param string $uid the user id
-        * @return string[]
+        * @return list<string>
         */
        private function getUserIdGroupIds(string $uid): array {
                if (!isset($this->cachedUserGroups[$uid])) {
index 9bda95ebc17b0ce22335fab5877f24ec42cebd31..73002ae668de1a23e0e30b43f9c4f19067b9e4ad 100644 (file)
@@ -194,12 +194,12 @@ class OCMProvider implements IOCMProvider {
         *     enabled: bool,
         *     apiVersion: string,
         *     endPoint: string,
-        *     resourceTypes: array{
-        *              name: string,
-        *              shareTypes: string[],
-        *              protocols: array<string, string>
-        *            }[]
-        *   }
+        *     resourceTypes: list<array{
+        *         name: string,
+        *         shareTypes: list<string>,
+        *         protocols: array<string, string>
+        *     }>,
+        * }
         */
        public function jsonSerialize(): array {
                $resourceTypes = [];
index 68f9ee18f791f0ad9fee7327d48f49cf989d33cf..3d619db1927ba4f47cd7005a9c56dcddf040a9d2 100644 (file)
@@ -16,7 +16,7 @@ use OCP\OCM\IOCMResource;
  */
 class OCMResource implements IOCMResource {
        private string $name = '';
-       /** @var string[] */
+       /** @var list<string> */
        private array $shareTypes = [];
        /** @var array<string, string> */
        private array $protocols = [];
@@ -40,7 +40,7 @@ class OCMResource implements IOCMResource {
        }
 
        /**
-        * @param string[] $shareTypes
+        * @param list<string> $shareTypes
         *
         * @return $this
         */
@@ -51,7 +51,7 @@ class OCMResource implements IOCMResource {
        }
 
        /**
-        * @return string[]
+        * @return list<string>
         */
        public function getShareTypes(): array {
                return $this->shareTypes;
@@ -92,7 +92,7 @@ class OCMResource implements IOCMResource {
        /**
         * @return array{
         *     name: string,
-        *     shareTypes: string[],
+        *     shareTypes: list<string>,
         *     protocols: array<string, string>
         * }
         */
index d23662f7055ff74c5a1e62e28297b0fae846e885..71fd003717c0183fcea11728db815f25533150ba 100644 (file)
@@ -10,6 +10,7 @@ namespace OC\Search;
 
 use InvalidArgumentException;
 use OC\AppFramework\Bootstrap\Coordinator;
+use OC\Core\ResponseDefinitions;
 use OCP\IURLGenerator;
 use OCP\IUser;
 use OCP\Search\FilterDefinition;
@@ -43,6 +44,7 @@ use function array_map;
  * results are awaited or shown as they come in.
  *
  * @see IProvider::search() for the arguments of the individual search requests
+ * @psalm-import-type CoreUnifiedSearchProvider from ResponseDefinitions
  */
 class SearchComposer {
        /**
@@ -156,7 +158,7 @@ class SearchComposer {
         * @param string $route the route the user is currently at
         * @param array $routeParameters the parameters of the route the user is currently at
         *
-        * @return array
+        * @return list<CoreUnifiedSearchProvider>
         */
        public function getProviders(string $route, array $routeParameters): array {
                $this->loadLazyProviders();
@@ -183,7 +185,7 @@ class SearchComposer {
                                        'name' => $provider->getName(),
                                        'icon' => $this->fetchIcon($appId, $provider->getId()),
                                        'order' => $order,
-                                       'triggers' => $triggers,
+                                       'triggers' => array_values($triggers),
                                        'filters' => $this->getFiltersType($filters, $provider->getId()),
                                        'inAppSearch' => $provider instanceof IInAppSearch,
                                ];
index 1f22a4c6a337fa38ebc790377e8b9c94f850d818..d59c1bd692853982431b3587e012eedaab1de01a 100644 (file)
@@ -147,9 +147,9 @@ class Tags implements ITags {
        /**
         * Get the list of tags for the given ids.
         *
-        * @param array $objIds array of object ids
-        * @return array|false of tags id as key to array of tag names
-        *                     or false if an error occurred
+        * @param list<int> $objIds array of object ids
+        * @return array<int, list<string>>|false of tags id as key to array of tag names
+        *                                        or false if an error occurred
         */
        public function getTagsForObjects(array $objIds) {
                $entries = [];
index 223579a11821a2a8092c220957f1dcd3c59178ba..d75b0209c7187f34458f05bc8780044c5ded8ced 100644 (file)
@@ -80,7 +80,7 @@ class TeamManager implements ITeamManager {
                        array_push($resources, ...$provider->getSharedWith($teamId));
                }
 
-               return $resources;
+               return array_values($resources);
        }
 
        public function getTeamsForResource(string $providerId, string $resourceId, string $userId): array {
index df017b09040b4b5fc4cd15b58eb52cf430967c2c..e88969f62a84abdaa477b584f7a8ffe9dbfd8ffa 100644 (file)
@@ -32,7 +32,7 @@ class ChangesCheck {
 
        /**
         * @throws DoesNotExistException
-        * @return array{changelogURL: string, whatsNew: array<string, array{admin: string[], regular: string[]}>}
+        * @return array{changelogURL: string, whatsNew: array<string, array{admin: list<string>, regular: list<string>}>}
         */
        public function getChangesForVersion(string $version): array {
                $version = $this->normalizeVersion($version);
index 6afd4086cb3eb5503b306d2daffc9baf1d28fad4..544938b6ff9dd0e050b64d2f2a06728c6e85af4b 100644 (file)
@@ -169,7 +169,7 @@ class OC_App {
         * @param bool $forceRefresh whether to refresh the cache
         * @param bool $all whether to return apps for all users, not only the
         *                  currently logged in one
-        * @return string[]
+        * @return list<string>
         */
        public static function getEnabledApps(bool $forceRefresh = false, bool $all = false): array {
                if (!\OC::$server->getSystemConfig()->getValue('installed', false)) {
index 8fec40cf1b1c41922baeba1b495b4a7622e29741..c8f98290a0e9311642a116c2c72c5e70a98a9585 100644 (file)
@@ -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;
index fa8d6bc36a6516c939fe57ab67c78bd6e131639c..f4ebd9253c77d535e12137c0307204f86586b6df 100644 (file)
@@ -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;
index be5fba82323b144c2cf11dcfd4097222b9b5cf5a..680daf1b114c6070e6e0659f98971cc87752c7cc 100644 (file)
@@ -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 [
index ec195ca35049708761889c6a6e573dbc81e05113..e047e83a29e1e173ab390b50365912d47202f2f6 100644 (file)
@@ -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 {
index 48ccb04336ae5f50946e6d3359a6f08a4665ba95..6fab3ce66a6bb707dee87aa877042e2e93b892f8 100644 (file)
@@ -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 {
index 14539bc9dbdc8ab9790782c34336e7c55abda8e0..93ead68747c64b32e0a26d11866f84016555a191 100644 (file)
@@ -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 {
index 94e0db935e7e4d8badd62faf63232e12451a14e8..9a81aa51cebed0dbc5649d1c0b59c075bce41b36 100644 (file)
@@ -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;
index 634935d212e29c299ca534092e01000183b4c711..7f01c2afa48fef910c7e82dd4ad4d71b9b0b754c 100644 (file)
@@ -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),
                ];
        }
 }
index 9a4bd2fae43e6fb17cf64e4c3e97982580d9a413..809bd3d0bc28c670a971fa1bed9cf789bc0db1d2 100644 (file)
@@ -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 [
index a6c01fa1d11301608fe3fb080c5ff7d8599ef06e..cbfd74a068af00472f83bc6f4cf842a5f1d65f36 100644 (file)
@@ -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
index 49f5146730883a7335722349b2fa4174c8a68c31..fe894da8d315668f5e4cde440e9c94fb70af8be2 100644 (file)
@@ -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;
index 0da4522c86c22daca8af093614f86ae1baa11514..633cec72085e2117e53cab1d3b376bc256824072 100644 (file)
@@ -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);
index 58b50aca17215e558d2e881dc0e1f5cee9bd64b5..ba2ab6ce759ba0341945e6b573c4ba79ba7ef470 100644 (file)
@@ -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
         */
index 788b5563cfc986e76f419f146707d09f67cc9131..60bf701e8ea55cb582ac99f53ba050797aea045d 100644 (file)
@@ -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
index 2d5fe1d9ba69c5340795494132d3296b7064cd78..1b59bb12ad4ae3f05ab7ce1df9fabc142e996889 100644 (file)
@@ -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;
index db8e4d7fab50b13eae50da3f29dc2ea5c38c12da..71c271cd43d525903b27355164c6095392ae63c6 100644 (file)
@@ -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()),
index 5c4c63b4f233126fa3e4a9c48f5320255d24a243..144a141f93eb74e2a8a34c0815613a55d038eed1 100644 (file)
@@ -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;