diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index d5cb30bdc3fd4..ca4ea928cb823 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -31,11 +31,11 @@ public function __construct( * enabled: bool, * apiVersion: string, * endPoint: string, - * resourceTypes: array{ + * resourceTypes: list, * protocols: array - * }[], + * }>, * }, * } * @throws OCMArgumentException diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php index 4cd668c29a063..a7b17f010cee9 100644 --- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php +++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php @@ -67,7 +67,7 @@ public function __construct( * @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} $protocol e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]] + * @param array{name: list, options: array} $protocol e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]] * @param string $shareType 'group' or 'user' share * @param string $resourceType 'file', 'calendar',... * diff --git a/apps/cloud_federation_api/lib/ResponseDefinitions.php b/apps/cloud_federation_api/lib/ResponseDefinitions.php index 80195c541373b..b17f5aadc1d5f 100644 --- a/apps/cloud_federation_api/lib/ResponseDefinitions.php +++ b/apps/cloud_federation_api/lib/ResponseDefinitions.php @@ -20,10 +20,10 @@ * } * * @psalm-type CloudFederationAPIValidationError = CloudFederationAPIError&array{ - * validationErrors: array{ + * validationErrors: list, * } */ class ResponseDefinitions { diff --git a/apps/dashboard/lib/Controller/DashboardApiController.php b/apps/dashboard/lib/Controller/DashboardApiController.php index c3d91fd9d3457..d31cede85b790 100644 --- a/apps/dashboard/lib/Controller/DashboardApiController.php +++ b/apps/dashboard/lib/Controller/DashboardApiController.php @@ -74,8 +74,8 @@ static function (IWidget $widget) use ($widgetIds) { * @param array $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, array{}> + * @param list $widgets Limit results to specific widgets + * @return DataResponse>, array{}> * * 200: Widget items returned */ @@ -102,7 +102,7 @@ public function getWidgetItems(array $sinceIds = [], int $limit = 7, array $widg * @param array $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 $widgets Limit results to specific widgets * @return DataResponse, array{}> * * 200: Widget items returned diff --git a/apps/dashboard/lib/ResponseDefinitions.php b/apps/dashboard/lib/ResponseDefinitions.php index df76efdab5af6..be5a4d568836f 100644 --- a/apps/dashboard/lib/ResponseDefinitions.php +++ b/apps/dashboard/lib/ResponseDefinitions.php @@ -18,13 +18,13 @@ * icon_url: string, * widget_url: ?string, * item_icons_round: bool, - * item_api_versions: int[], + * item_api_versions: list, * reload_interval: int, - * buttons?: array{ + * buttons?: list, * } * * @psalm-type DashboardWidgetItem = array{ @@ -37,7 +37,7 @@ * } * * @psalm-type DashboardWidgetItems = array{ - * items: DashboardWidgetItem[], + * items: list, * emptyContentMessage: string, * halfEmptyContentMessage: string, * } diff --git a/apps/dav/lib/Controller/UpcomingEventsController.php b/apps/dav/lib/Controller/UpcomingEventsController.php index c8eb39abb173c..a5d54f4475445 100644 --- a/apps/dav/lib/Controller/UpcomingEventsController.php +++ b/apps/dav/lib/Controller/UpcomingEventsController.php @@ -35,7 +35,7 @@ public function __construct( * Get information about upcoming events * * @param string|null $location location/URL to filter by - * @return DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse * * 200: Upcoming events * 401: When not authenticated @@ -47,10 +47,10 @@ public function getEvents(?string $location = null): DataResponse { } 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, - )), + ))), ]); } diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index 222c6490b83c0..63de8ff605ea5 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -72,7 +72,7 @@ public function __construct( * @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, array{}> + * @return Http\DataResponse, array{}> * @throws OCSException * * 200: Share created successfully @@ -186,7 +186,7 @@ public function reShare(int $id, ?string $token = null, ?string $shareWith = nul * * @param int $id ID of the remote share * @param string|null $token Shared secret between servers - * @return Http\DataResponse, array{}> + * @return Http\DataResponse, array{}> * @throws OCSException * @throws ShareNotFound * @throws HintException @@ -221,7 +221,7 @@ public function acceptShare(int $id, ?string $token = null) { * * @param int $id ID of the remote share * @param string|null $token Shared secret between servers - * @return Http\DataResponse, array{}> + * @return Http\DataResponse, array{}> * @throws OCSException * * 200: Share declined successfully @@ -254,7 +254,7 @@ public function declineShare(int $id, ?string $token = null) { * * @param int $id ID of the share * @param string|null $token Shared secret between servers - * @return Http\DataResponse, array{}> + * @return Http\DataResponse, array{}> * @throws OCSException * * 200: Share unshared successfully @@ -290,7 +290,7 @@ private function cleanupRemote($remote) { * * @param int $id ID of the share * @param string|null $token Shared secret between servers - * @return Http\DataResponse, array{}> + * @return Http\DataResponse, array{}> * @throws OCSBadRequestException Revoking the share is not possible * * 200: Share revoked successfully @@ -332,7 +332,7 @@ private function isS2SEnabled($incoming = false) { * @param int $id ID of the share * @param string|null $token Shared secret between servers * @param int|null $permissions New permissions - * @return Http\DataResponse, array{}> + * @return Http\DataResponse, array{}> * @throws OCSBadRequestException Updating permissions is not possible * * 200: Permissions updated successfully diff --git a/apps/federation/lib/Controller/OCSAuthAPIController.php b/apps/federation/lib/Controller/OCSAuthAPIController.php index 0aa3f8bd148cd..44725fa0dba9c 100644 --- a/apps/federation/lib/Controller/OCSAuthAPIController.php +++ b/apps/federation/lib/Controller/OCSAuthAPIController.php @@ -52,7 +52,7 @@ public function __construct( * * @param string $url URL of the server * @param string $token Token of the server - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSForbiddenException Requesting shared secret is not allowed * * 200: Shared secret requested successfully @@ -87,7 +87,7 @@ public function getSharedSecretLegacy(string $url, string $token): DataResponse * * @param string $url URL of the server * @param string $token Token of the server - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSForbiddenException Requesting shared secret is not allowed * * 200: Shared secret requested successfully diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php index d20d348a9f5df..16ea42eae22db 100644 --- a/apps/files/lib/Capabilities.php +++ b/apps/files/lib/Capabilities.php @@ -21,7 +21,7 @@ public function __construct( /** * Return this classes capabilities * - * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: array, forbidden_filenames: list, forbidden_filename_basenames: list, forbidden_filename_characters: list, forbidden_filename_extensions: list, chunked_upload: array{max_size: int, max_parallel_count: int}}} + * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: list, forbidden_filenames: list, forbidden_filename_basenames: list, forbidden_filename_characters: list, forbidden_filename_extensions: list, chunked_upload: array{max_size: int, max_parallel_count: int}}} */ public function getCapabilities(): array { return [ diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php index 63f29d3ba2a69..2c910006df5c3 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -36,7 +36,7 @@ public function __construct( /** * Get the direct editing capabilities - * @return DataResponse, creators: array}, array{}> + * @return DataResponse, optionalMimetypes: list, secure: bool}>, creators: array}>}, array{}> * * 200: Direct editing capabilities returned */ diff --git a/apps/files/lib/Controller/OpenLocalEditorController.php b/apps/files/lib/Controller/OpenLocalEditorController.php index dae321ae437f8..b000304eef668 100644 --- a/apps/files/lib/Controller/OpenLocalEditorController.php +++ b/apps/files/lib/Controller/OpenLocalEditorController.php @@ -46,7 +46,7 @@ public function __construct( * * @param string $path Path of the file * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Local editor returned */ @@ -91,7 +91,7 @@ public function create(string $path): DataResponse { * @param string $path Path of the file * @param string $token Token of the local editor * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Local editor validated successfully * 404: Local editor not found diff --git a/apps/files/lib/Controller/TemplateController.php b/apps/files/lib/Controller/TemplateController.php index 551c9c54c4b54..ee5aa488bb430 100644 --- a/apps/files/lib/Controller/TemplateController.php +++ b/apps/files/lib/Controller/TemplateController.php @@ -16,13 +16,16 @@ 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,16 @@ public function __construct( /** * List the available templates * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Available templates returned */ #[NoAdminRequired] public function list(): DataResponse { - return new DataResponse($this->templateManager->listTemplates()); + return new DataResponse(array_map(static function (array $template) { + $template['templates'] = array_map(static fn (Template $template) => $template->jsonSerialize(), $template['templates']); + return $template; + }, $this->templateManager->listTemplates())); } /** @@ -51,7 +57,7 @@ public function list(): DataResponse { * @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 $templateFields Fields of the template * * @return DataResponse * @throws OCSForbiddenException Creating template is not allowed @@ -82,7 +88,7 @@ public function create( * @param string $templatePath Path of the template directory * @param bool $copySystemTemplates Whether to copy the system templates to the template directory * - * @return DataResponse + * @return DataResponse}, array{}> * @throws OCSForbiddenException Initializing the template directory is not allowed * * 200: Template directory initialized successfully @@ -94,7 +100,7 @@ public function path(string $templatePath = '', bool $copySystemTemplates = fals $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()); diff --git a/apps/files/lib/Controller/TransferOwnershipController.php b/apps/files/lib/Controller/TransferOwnershipController.php index 1420e57e987f1..51a25400efb8a 100644 --- a/apps/files/lib/Controller/TransferOwnershipController.php +++ b/apps/files/lib/Controller/TransferOwnershipController.php @@ -47,7 +47,7 @@ public function __construct( * @param string $recipient Username of the recipient * @param string $path Path of the file * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Ownership transferred successfully * 400: Transferring ownership is not possible @@ -101,7 +101,7 @@ public function transfer(string $recipient, string $path): DataResponse { * * @param int $id ID of the ownership transfer * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Ownership transfer accepted successfully * 403: Accepting ownership transfer is not allowed @@ -136,7 +136,7 @@ public function accept(int $id): DataResponse { * * @param int $id ID of the ownership transfer * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Ownership transfer rejected successfully * 403: Rejecting ownership transfer is not allowed diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index ce33bbb80a6ab..b66dc9a205610 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -192,37 +192,34 @@ public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = /** * 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, file_source: int, ...array} + * @param list $fileList + * @return list 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); } } diff --git a/apps/files/lib/ResponseDefinitions.php b/apps/files/lib/ResponseDefinitions.php index a05cbb75b210d..c5d094e7bd8cf 100644 --- a/apps/files/lib/ResponseDefinitions.php +++ b/apps/files/lib/ResponseDefinitions.php @@ -22,21 +22,45 @@ * 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, + * } + * * @psalm-type FilesTemplateFileCreator = array{ * app: string, * label: string, * extension: string, * iconClass: ?string, * iconSvgInline: ?string, - * mimetypes: string[], + * mimetypes: list, * ratio: ?float, * actionLabel: string, * } * - * @psalm-type FilesTemplateField = array{ - * index: string, - * content: string, - * type: string, + * @psalm-type FilesTemplateFileCreatorWithTemplates = FilesTemplateFileCreator&array{ + * templates: list, * } * * @psalm-type FilesFolderTree = listwillReturn($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 @@ public function testPopulateTags(): void { ->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); } } diff --git a/apps/files_external/lib/Controller/ApiController.php b/apps/files_external/lib/Controller/ApiController.php index 5a7eddf154083..49547357e6bba 100644 --- a/apps/files_external/lib/Controller/ApiController.php +++ b/apps/files_external/lib/Controller/ApiController.php @@ -74,7 +74,7 @@ private function formatMount(string $mountPoint, StorageConfig $mountConfig): ar /** * Get the mount points visible for this user * - * @return DataResponse + * @return DataResponse, array{}> * * 200: User mounts returned */ diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php index 12523937071b3..a9a03528b8ff6 100644 --- a/apps/files_external/lib/Lib/StorageConfig.php +++ b/apps/files_external/lib/Lib/StorageConfig.php @@ -82,14 +82,14 @@ class StorageConfig implements \JsonSerializable { /** * List of users who have access to this storage * - * @var string[] + * @var list */ private $applicableUsers = []; /** * List of groups that have access to this storage * - * @var string[] + * @var list */ private $applicableGroups = []; @@ -256,7 +256,7 @@ public function setPriority($priority) { /** * Returns the users for which to mount this storage * - * @return string[] applicable users + * @return list applicable users */ public function getApplicableUsers() { return $this->applicableUsers; @@ -265,7 +265,7 @@ public function getApplicableUsers() { /** * Sets the users for which to mount this storage * - * @param string[]|null $applicableUsers applicable users + * @param list|null $applicableUsers applicable users */ public function setApplicableUsers($applicableUsers) { if (is_null($applicableUsers)) { @@ -277,7 +277,7 @@ public function setApplicableUsers($applicableUsers) { /** * Returns the groups for which to mount this storage * - * @return string[] applicable groups + * @return list applicable groups */ public function getApplicableGroups() { return $this->applicableGroups; @@ -286,7 +286,7 @@ public function getApplicableGroups() { /** * Sets the groups for which to mount this storage * - * @param string[]|null $applicableGroups applicable groups + * @param list|null $applicableGroups applicable groups */ public function setApplicableGroups($applicableGroups) { if (is_null($applicableGroups)) { diff --git a/apps/files_external/lib/ResponseDefinitions.php b/apps/files_external/lib/ResponseDefinitions.php index e84b985b448d3..26a0965f1fc2c 100644 --- a/apps/files_external/lib/ResponseDefinitions.php +++ b/apps/files_external/lib/ResponseDefinitions.php @@ -11,8 +11,8 @@ /** * @psalm-type Files_ExternalStorageConfig = array{ - * applicableGroups?: string[], - * applicableUsers?: string[], + * applicableGroups?: list, + * applicableUsers?: list, * authMechanism: string, * backend: string, * backendOptions: array, diff --git a/apps/files_reminders/lib/Controller/ApiController.php b/apps/files_reminders/lib/Controller/ApiController.php index a7d02b936c95f..dbc340610b294 100644 --- a/apps/files_reminders/lib/Controller/ApiController.php +++ b/apps/files_reminders/lib/Controller/ApiController.php @@ -39,7 +39,7 @@ public function __construct( * Get a reminder * * @param int $fileId ID of the file - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Reminder returned * 401: Account not found @@ -71,7 +71,7 @@ public function get(int $fileId): DataResponse { * @param int $fileId ID of the file * @param string $dueDate ISO 8601 formatted date time string * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Reminder updated * 201: Reminder created successfully @@ -109,7 +109,7 @@ public function set(int $fileId, string $dueDate): DataResponse { * * @param int $fileId ID of the file * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Reminder deleted successfully * 401: Account not found diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index 9f80d285d4dd3..8d93afa4e04d7 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -135,7 +135,7 @@ private function formatShare(IShare $share): array { /** * Get a list of all deleted shares * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Deleted shares returned */ @@ -148,9 +148,9 @@ public function index(): DataResponse { $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 @@ public function index(): DataResponse { * Undelete a deleted share * * @param string $id ID of the share - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * @throws OCSNotFoundException Share not found * diff --git a/apps/files_sharing/lib/Controller/PublicPreviewController.php b/apps/files_sharing/lib/Controller/PublicPreviewController.php index da71aca904c26..8e8ee3768cbc0 100644 --- a/apps/files_sharing/lib/Controller/PublicPreviewController.php +++ b/apps/files_sharing/lib/Controller/PublicPreviewController.php @@ -62,7 +62,7 @@ protected function isPasswordProtected(): bool { * @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|DataResponse, array{}> + * @return FileDisplayResponse|DataResponse, array{}> * * 200: Preview returned * 400: Getting preview is not possible @@ -134,7 +134,7 @@ public function getPreview( * Get a direct link preview for a shared file * * @param string $token Token of the share - * @return FileDisplayResponse|DataResponse, array{}> + * @return FileDisplayResponse|DataResponse, array{}> * * 200: Preview returned * 400: Getting preview is not possible diff --git a/apps/files_sharing/lib/Controller/RemoteController.php b/apps/files_sharing/lib/Controller/RemoteController.php index cdac35e0d9ccb..e23ae51f21998 100644 --- a/apps/files_sharing/lib/Controller/RemoteController.php +++ b/apps/files_sharing/lib/Controller/RemoteController.php @@ -41,7 +41,7 @@ public function __construct( /** * Get list of pending remote shares * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Pending remote shares returned */ @@ -54,7 +54,7 @@ public function getOpenShares() { * Accept a remote share * * @param int $id ID of the share - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSNotFoundException Share not found * * 200: Share accepted successfully @@ -75,7 +75,7 @@ public function acceptShare($id) { * Decline a remote share * * @param int $id ID of the share - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSNotFoundException Share not found * * 200: Share declined successfully @@ -116,14 +116,14 @@ private static function extendShareInfo($share) { /** * Get a list of accepted remote shares * - * @return DataResponse + * @return DataResponse, 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 @@ public function getShare($id) { * Unshare a remote share * * @param int $id ID of the share - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSNotFoundException Share not found * @throws OCSForbiddenException Unsharing is not possible * diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 077eb4b35a360..71f73f777a5d9 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -351,10 +351,10 @@ private function getDisplayNameFromAddressBook(string $query, string $property): /** - * @param array $shares - * @param array|null $updatedDisplayName + * @param list $shares + * @param array|null $updatedDisplayName * - * @return array + * @return list */ private function fixMissingDisplayName(array $shares, ?array $updatedDisplayName = null): array { $userIds = $updated = []; @@ -450,7 +450,7 @@ private function getCachedFederatedDisplayName(string $userId, bool $cacheOnly = * * @param string $id ID of the share * @param bool $include_tags Include tags in the share - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSNotFoundException Share not found * * 200: Share returned @@ -468,7 +468,7 @@ public function getShare(string $id, bool $include_tags = false): DataResponse { $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 @@ public function getShare(string $id, bool $include_tags = false): DataResponse { * Delete a share * * @param string $id ID of the share - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSNotFoundException Share not found * @throws OCSForbiddenException Missing permissions to delete the share * @@ -828,7 +828,7 @@ public function createShare( * @param null|Node $node * @param boolean $includeTags * - * @return Files_SharingShare[] + * @return list */ private function getSharedWithMe($node, bool $includeTags): array { $userShares = $this->shareManager->getSharedWith($this->userId, IShare::TYPE_USER, $node, -1, 0); @@ -856,7 +856,7 @@ private function getSharedWithMe($node, bool $includeTags): array { } if ($includeTags) { - $formatted = Helper::populateTags($formatted, 'file_source', \OC::$server->getTagManager()); + $formatted = Helper::populateTags($formatted, \OC::$server->getTagManager()); } return $formatted; @@ -865,7 +865,7 @@ private function getSharedWithMe($node, bool $includeTags): array { /** * @param Node $folder * - * @return Files_SharingShare[] + * @return list * @throws OCSBadRequestException * @throws NotFoundException */ @@ -925,7 +925,7 @@ private function getSharesInDir(Node $folder): array { * @param string $path Get shares for a specific path * @param string $include_tags Include tags in the share * - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSNotFoundException The folder was not found or is inaccessible * * 200: Shares returned @@ -974,7 +974,7 @@ public function getShares( * @param bool $subFiles * @param bool $includeTags * - * @return Files_SharingShare[] + * @return list * @throws NotFoundException * @throws OCSBadRequestException */ @@ -1045,7 +1045,7 @@ private function getFormattedShares( if ($includeTags) { $formatted = - Helper::populateTags($formatted, 'file_source', \OC::$server->getTagManager()); + Helper::populateTags($formatted, \OC::$server->getTagManager()); } return $formatted; @@ -1057,7 +1057,7 @@ private function getFormattedShares( * * @param string $path Path all shares will be relative to * - * @return DataResponse + * @return DataResponse, array{}> * @throws InvalidPathException * @throws NotFoundException * @throws OCSNotFoundException The given path is invalid @@ -1371,7 +1371,7 @@ public function updateShare( /** * Get all shares that are still pending * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Pending shares returned */ @@ -1394,7 +1394,7 @@ public function pendingShares(): DataResponse { } } - $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 @@ public function pendingShares(): DataResponse { } }, $pendingShares), function ($entry) { return $entry !== null; - }); + })); return new DataResponse($result); } @@ -1424,7 +1424,7 @@ public function pendingShares(): DataResponse { * Accept a share * * @param string $id ID of the share - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSNotFoundException Share not found * @throws OCSException * @throws OCSBadRequestException Share could not be accepted @@ -2095,7 +2095,7 @@ private function checkInheritedAttributes(IShare $share): void { * @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, array{}> + * @return DataResponse, array{}> * * 200: The email notification was sent successfully */ diff --git a/apps/files_sharing/lib/Controller/ShareInfoController.php b/apps/files_sharing/lib/Controller/ShareInfoController.php index 05816a986f72f..7805973f3c5f6 100644 --- a/apps/files_sharing/lib/Controller/ShareInfoController.php +++ b/apps/files_sharing/lib/Controller/ShareInfoController.php @@ -48,7 +48,7 @@ public function __construct( * @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|JSONResponse, array{}> + * @return JSONResponse|JSONResponse, array{}> * * 200: Share info returned * 403: Getting share info is not allowed diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 606a3d11de6dd..3a04dda72a199 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -94,7 +94,7 @@ public function __construct( * @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|null $shareType Limit to specific share types * @param bool $lookup If a global lookup should be performed too * @return DataResponse * @throws OCSBadRequestException Invalid search parameters @@ -300,7 +300,7 @@ private function getAllSharees(string $user, array $shareTypes): ISearchResult { * Find recommended sharees * * @param string $itemType Limit to specific item types - * @param int|int[]|null $shareType Limit to specific share types + * @param int|list|null $shareType Limit to specific share types * @return DataResponse * * 200: Recommended sharees returned diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index e0d7f96cb90eb..e10b6c1c91f05 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -11,6 +11,7 @@ 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\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 @@ public function removeGroupShares($gid): bool { /** * return a list of shares which are not yet accepted by the user * - * @return array list of open server-to-server shares + * @return list list of open server-to-server shares */ public function getOpenShares() { return $this->getShares(false); @@ -695,7 +699,7 @@ public function getOpenShares() { /** * return a list of shares which are accepted by the user * - * @return array list of accepted server-to-server shares + * @return list list of accepted server-to-server shares */ public function getAcceptedShares() { return $this->getShares(true); @@ -707,7 +711,7 @@ public function getAcceptedShares() { * @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 list of open server-to-server shares */ private function getShares($accepted) { $user = $this->userManager->get($this->uid); diff --git a/apps/files_sharing/lib/ResponseDefinitions.php b/apps/files_sharing/lib/ResponseDefinitions.php index d412b93a1355d..0edf67fe042dc 100644 --- a/apps/files_sharing/lib/ResponseDefinitions.php +++ b/apps/files_sharing/lib/ResponseDefinitions.php @@ -178,38 +178,38 @@ * * @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, + * emails: list, + * groups: list, + * remote_groups: list, + * remotes: list, + * rooms: list, + * users: list, * }, - * 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, + * emails: list, + * groups: list, + * lookup: list, + * remote_groups: list, + * remotes: list, + * rooms: list, + * users: list, * 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, + * groups: list, + * remote_groups: list, + * remotes: list, + * users: list, * }, - * emails: Files_SharingShareeEmail[], - * groups: Files_SharingSharee[], - * remote_groups: Files_SharingShareeRemoteGroup[], - * remotes: Files_SharingShareeRemote[], - * users: Files_SharingShareeUser[], + * emails: list, + * groups: list, + * remote_groups: list, + * remotes: list, + * users: list, * } * * @psalm-type Files_SharingShareInfo = array{ @@ -222,7 +222,7 @@ * size: int|float, * type: string, * etag: string, - * children?: array[], + * children?: list>, * } */ class ResponseDefinitions { diff --git a/apps/files_sharing/openapi.json b/apps/files_sharing/openapi.json index 848b6293cc833..76063ad3f9349 100644 --- a/apps/files_sharing/openapi.json +++ b/apps/files_sharing/openapi.json @@ -2170,7 +2170,10 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "$ref": "#/components/schemas/Share" + "type": "array", + "items": { + "$ref": "#/components/schemas/Share" + } } } } diff --git a/apps/files_trashbin/lib/Controller/PreviewController.php b/apps/files_trashbin/lib/Controller/PreviewController.php index d376ce80fdaa6..a71bc4f01c792 100644 --- a/apps/files_trashbin/lib/Controller/PreviewController.php +++ b/apps/files_trashbin/lib/Controller/PreviewController.php @@ -46,7 +46,7 @@ public function __construct( * @param int $y Height of the preview * @param bool $a Whether to not crop the preview * - * @return Http\FileDisplayResponse|DataResponse, array{}> + * @return Http\FileDisplayResponse|DataResponse, array{}> * * 200: Preview returned * 400: Getting preview is not possible diff --git a/apps/files_versions/lib/Controller/PreviewController.php b/apps/files_versions/lib/Controller/PreviewController.php index e1d87b4b9f517..fe984376d29eb 100644 --- a/apps/files_versions/lib/Controller/PreviewController.php +++ b/apps/files_versions/lib/Controller/PreviewController.php @@ -38,7 +38,7 @@ public function __construct( * @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|DataResponse, array{}> + * @return FileDisplayResponse|DataResponse, array{}> * * 200: Preview returned * 400: Getting preview is not possible diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index 603c63062273f..61459e40b8b4b 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -222,7 +222,7 @@ function (string $managerUid) use ($currentLoggedInUser) { * Get the groups a user is a subadmin of * * @param string $userId - * @return string[] + * @return list * @throws OCSException */ protected function getUserSubAdminGroupsData(string $userId): array { diff --git a/apps/provisioning_api/lib/Controller/AppConfigController.php b/apps/provisioning_api/lib/Controller/AppConfigController.php index bb161f6cb8c8a..d8af1f38d9509 100644 --- a/apps/provisioning_api/lib/Controller/AppConfigController.php +++ b/apps/provisioning_api/lib/Controller/AppConfigController.php @@ -44,7 +44,7 @@ public function __construct( /** * Get a list of apps * - * @return DataResponse + * @return DataResponse}, array{}> * * 200: Apps returned */ @@ -58,7 +58,7 @@ public function getApps(): DataResponse { * Get the config keys of an app * * @param string $app ID of the app - * @return DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse * * 200: Keys returned * 403: App is not allowed @@ -105,7 +105,7 @@ public function getValue(string $app, string $key, string $defaultValue = ''): D * @param string $app ID of the app * @param string $key Key to update * @param string $value New value for the key - * @return DataResponse, array{}>|DataResponse + * @return DataResponse, array{}>|DataResponse * * 200: Value updated successfully * 403: App or key is not allowed @@ -154,7 +154,7 @@ public function setValue(string $app, string $key, string $value): DataResponse * * @param string $app ID of the app * @param string $key Key to delete - * @return DataResponse, array{}>|DataResponse + * @return DataResponse, array{}>|DataResponse * * 200: Key deleted successfully * 403: App or key is not allowed diff --git a/apps/provisioning_api/lib/Controller/AppsController.php b/apps/provisioning_api/lib/Controller/AppsController.php index ae08a9cade00a..04dfd8f29b190 100644 --- a/apps/provisioning_api/lib/Controller/AppsController.php +++ b/apps/provisioning_api/lib/Controller/AppsController.php @@ -31,18 +31,18 @@ public function __construct( * Get a list of installed apps * * @param ?string $filter Filter for enabled or disabled apps - * @return DataResponse + * @return DataResponse}, array{}> * @throws OCSException * * 200: Installed apps returned */ public function getApps(?string $filter = null): DataResponse { $apps = (new OC_App())->listAllApps(); + /** @var list $list */ $list = []; foreach ($apps as $app) { $list[] = $app['id']; } - /** @var string[] $list */ if ($filter) { switch ($filter) { case 'enabled': @@ -50,7 +50,7 @@ public function getApps(?string $filter = null): DataResponse { 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 @@ public function getAppInfo(string $app): DataResponse { * Enable an app * * @param string $app ID of the app - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: App enabled successfully @@ -102,7 +102,7 @@ public function enable(string $app): DataResponse { * Disable an app * * @param string $app ID of the app - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: App disabled successfully */ diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index 0b16c319f1dc0..87544cc899274 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -68,17 +68,17 @@ public function __construct( * @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 + * @return DataResponse}, 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 @@ public function getGroups(string $search = '', ?int $limit = null, int $offset = * @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 + * @return DataResponse}, array{}> * * 200: Groups details returned */ @@ -97,7 +97,7 @@ public function getGroups(string $search = '', ?int $limit = null, int $offset = #[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 @@ public function getGroupsDetails(string $search = '', ?int $limit = null, int $o 'canAdd' => $group->canAddUser(), 'canRemove' => $group->canRemoveUser(), ]; - }, $groups); + }, $groups)); return new DataResponse(['groups' => $groups]); } @@ -116,7 +116,7 @@ public function getGroupsDetails(string $search = '', ?int $limit = null, int $o * Get a list of users in the specified group * * @param string $groupId ID of the group - * @return DataResponse + * @return DataResponse}, array{}> * @throws OCSException * * @deprecated 14 Use getGroupUsers @@ -132,7 +132,7 @@ public function getGroup(string $groupId): DataResponse { * Get a list of users in the specified group * * @param string $groupId ID of the group - * @return DataResponse + * @return DataResponse}, array{}> * @throws OCSException * @throws OCSNotFoundException Group not found * @throws OCSForbiddenException Missing permissions to get users in the group @@ -163,7 +163,7 @@ public function getGroupUsers(string $groupId): DataResponse { /** @var IUser $user */ return $user->getUID(); }, $users); - /** @var string[] $users */ + /** @var list $users */ $users = array_values($users); return new DataResponse(['users' => $users]); } @@ -233,7 +233,7 @@ public function getGroupUsersDetails(string $groupId, string $search = '', ?int * * @param string $groupid ID of the group * @param string $displayname Display name of the group - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: Group created successfully @@ -266,7 +266,7 @@ public function addGroup(string $groupid, string $displayname = ''): DataRespons * @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, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: Group updated successfully @@ -295,7 +295,7 @@ public function updateGroup(string $groupId, string $key, string $value): DataRe * Delete a group * * @param string $groupId ID of the group - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: Group deleted successfully @@ -320,7 +320,7 @@ public function deleteGroup(string $groupId): DataResponse { * Get the list of user IDs that are a subadmin of the group * * @param string $groupId ID of the group - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSException * * 200: Sub admins returned @@ -336,7 +336,7 @@ public function getSubAdminsOfGroup(string $groupId): DataResponse { /** @var IUser[] $subadmins */ $subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup); // New class returns IUser[] so convert back - /** @var string[] $uids */ + /** @var list $uids */ $uids = []; foreach ($subadmins as $user) { $uids[] = $user->getUID(); diff --git a/apps/provisioning_api/lib/Controller/PreferencesController.php b/apps/provisioning_api/lib/Controller/PreferencesController.php index 672aec7756c83..8ae64e65b81d9 100644 --- a/apps/provisioning_api/lib/Controller/PreferencesController.php +++ b/apps/provisioning_api/lib/Controller/PreferencesController.php @@ -40,7 +40,7 @@ public function __construct( * @param string $appId ID of the app * @param array $configs Key-value pairs of the preferences * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Preferences updated successfully * 400: Preference invalid @@ -85,7 +85,7 @@ public function setMultiplePreferences(string $appId, array $configs): DataRespo * @param string $appId ID of the app * @param string $configKey Key of the preference * @param string $configValue New value - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Preference updated successfully * 400: Preference invalid @@ -124,9 +124,9 @@ public function setPreference(string $appId, string $configKey, string $configVa * Delete multiple preferences for an app * * @param string $appId ID of the app - * @param string[] $configKeys Keys to delete + * @param list $configKeys Keys to delete * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Preferences deleted successfully * 400: Preference invalid @@ -168,7 +168,7 @@ public function deleteMultiplePreference(string $appId, array $configKeys): Data * * @param string $appId ID of the app * @param string $configKey Key to delete - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Preference deleted successfully * 400: Preference invalid diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index b0cd9bfb448f9..9363b4ca9352c 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -97,7 +97,7 @@ public function __construct( * @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 + * @return DataResponse}, array{}> * * 200: Users returned */ @@ -125,7 +125,7 @@ public function getUsers(string $search = '', ?int $limit = null, int $offset = } } - /** @var string[] $users */ + /** @var list $users */ $users = array_keys($users); return new DataResponse([ @@ -341,8 +341,8 @@ public function getLastLoggedInUsers(string $search = '', * Search users by their phone numbers * * @param string $location Location of the phone number (for country code) - * @param array $search Phone numbers to search for - * @return DataResponse, array{}>|DataResponse, array{}> + * @param array> $search Phone numbers to search for + * @return DataResponse, array{}>|DataResponse, array{}> * * 200: Users returned * 400: Invalid location @@ -433,8 +433,8 @@ private function createNewUserId(): string { * @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 $groups Groups of the user + * @param list $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 @@ public function getCurrentUser(): DataResponse { * * Get a list of fields that are editable for the current user * - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSException * * 200: Editable fields returned @@ -710,7 +710,7 @@ public function getEditableFields(): DataResponse { * Get a list of fields that are editable for a user * * @param string $userId ID of the user - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSException * * 200: Editable fields for user returned @@ -779,7 +779,7 @@ public function getEditableFieldsForUser(string $userId): DataResponse { * @param string $collectionName Collection to update * @param string $key Key that will be updated * @param string $value New value for the key - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User values edited successfully @@ -884,7 +884,7 @@ public function editUserMultiValue( * @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, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User value edited successfully @@ -1222,7 +1222,7 @@ public function editUser(string $userId, string $key, string $value): DataRespon * * @param string $userId ID of the user * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * @throws OCSException * @@ -1261,7 +1261,7 @@ public function wipeUserDevices(string $userId): DataResponse { * Delete a user * * @param string $userId ID of the user - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User deleted successfully @@ -1301,7 +1301,7 @@ public function deleteUser(string $userId): DataResponse { * Disable a user * * @param string $userId ID of the user - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User disabled successfully @@ -1316,7 +1316,7 @@ public function disableUser(string $userId): DataResponse { * Enable a user * * @param string $userId ID of the user - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User enabled successfully @@ -1330,7 +1330,7 @@ public function enableUser(string $userId): DataResponse { /** * @param string $userId * @param bool $value - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException */ private function setEnabled(string $userId, bool $value): DataResponse { @@ -1360,7 +1360,7 @@ private function setEnabled(string $userId, bool $value): DataResponse { * Get a list of groups the user belongs to * * @param string $userId ID of the user - * @return DataResponse + * @return DataResponse}, array{}> * @throws OCSException * * 200: Users groups returned @@ -1387,16 +1387,10 @@ public function getUsersGroups(string $userId): DataResponse { // 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 @@ public function getUsersGroups(string $userId): DataResponse { * * @param string $userId ID of the user * @param string $groupid ID of the group - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User added to group successfully @@ -1450,7 +1444,7 @@ public function addToGroup(string $userId, string $groupid = ''): DataResponse { * * @param string $userId ID of the user * @param string $groupid ID of the group - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User removed from group successfully @@ -1517,7 +1511,7 @@ public function removeFromGroup(string $userId, string $groupid): DataResponse { * * @param string $userId ID of the user * @param string $groupid ID of the group - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User added as group subadmin successfully @@ -1557,7 +1551,7 @@ public function addSubAdmin(string $userId, string $groupid): DataResponse { * * @param string $userId ID of the user * @param string $groupid ID of the group - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: User removed as group subadmin successfully @@ -1591,7 +1585,7 @@ public function removeSubAdmin(string $userId, string $groupid): DataResponse { * Get the groups a user is a subadmin of * * @param string $userId ID if the user - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSException * * 200: User subadmin groups returned @@ -1606,7 +1600,7 @@ public function getUserSubAdminGroups(string $userId): DataResponse { * Resend the welcome message * * @param string $userId ID if the user - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * * 200: Resent welcome message successfully diff --git a/apps/provisioning_api/lib/ResponseDefinitions.php b/apps/provisioning_api/lib/ResponseDefinitions.php index fec68021209a7..afa725c110ace 100644 --- a/apps/provisioning_api/lib/ResponseDefinitions.php +++ b/apps/provisioning_api/lib/ResponseDefinitions.php @@ -21,8 +21,8 @@ * @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, + * additional_mailScope?: list, * address: string, * addressScope?: Provisioning_APIUserDetailsScope, * avatarScope?: Provisioning_APIUserDetailsScope, @@ -41,7 +41,7 @@ * enabled?: bool, * fediverse: string, * fediverseScope?: Provisioning_APIUserDetailsScope, - * groups: string[], + * groups: list, * headline: string, * headlineScope?: Provisioning_APIUserDetailsScope, * id: string, @@ -62,7 +62,7 @@ * role: string, * roleScope?: Provisioning_APIUserDetailsScope, * storageLocation?: string, - * subadmin: string[], + * subadmin: list, * twitter: string, * twitterScope?: Provisioning_APIUserDetailsScope, * website: string, diff --git a/apps/sharebymail/lib/Capabilities.php b/apps/sharebymail/lib/Capabilities.php index 5b489b7d7901f..67a0ec7a9dedc 100644 --- a/apps/sharebymail/lib/Capabilities.php +++ b/apps/sharebymail/lib/Capabilities.php @@ -24,7 +24,7 @@ public function __construct( /** * @return array{ - * files_sharing: array{ + * files_sharing?: array{ * sharebymail: array{ * enabled: bool, * send_password_by_mail: bool, @@ -41,7 +41,7 @@ public function __construct( * }, * } * } - * }|array + * } */ public function getCapabilities(): array { if (!$this->appManager->isEnabledForUser('files_sharing')) { diff --git a/apps/sharebymail/openapi.json b/apps/sharebymail/openapi.json index 7bc231c07706b..a64013b192403 100644 --- a/apps/sharebymail/openapi.json +++ b/apps/sharebymail/openapi.json @@ -21,87 +21,76 @@ }, "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 } - ] + } } } }, diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 1b02595fa39a6..d748a6278b41d 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -417,7 +417,7 @@ public function getThemeStylesheet(string $themeId, bool $plain = false, bool $w * * @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|JSONResponse + * @return JSONResponse, display: string}, array{}>|JSONResponse * * 200: Manifest returned * 404: App not found diff --git a/apps/theming/lib/Controller/UserThemeController.php b/apps/theming/lib/Controller/UserThemeController.php index 9bcf32daa9cb4..1ead97f5d37b1 100644 --- a/apps/theming/lib/Controller/UserThemeController.php +++ b/apps/theming/lib/Controller/UserThemeController.php @@ -58,7 +58,7 @@ public function __construct( * Enable theme * * @param string $themeId the theme ID - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSBadRequestException Enabling theme is not possible * @throws PreConditionNotMetException * @@ -77,7 +77,7 @@ public function enableTheme(string $themeId): DataResponse { * Disable theme * * @param string $themeId the theme ID - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSBadRequestException Disabling theme is not possible * @throws PreConditionNotMetException * diff --git a/apps/updatenotification/lib/Controller/APIController.php b/apps/updatenotification/lib/Controller/APIController.php index 59643e935d190..6b4f559f65067 100644 --- a/apps/updatenotification/lib/Controller/APIController.php +++ b/apps/updatenotification/lib/Controller/APIController.php @@ -62,7 +62,7 @@ public function __construct( * * @param string $newVersion Server version to check updates for * - * @return DataResponse|DataResponse + * @return DataResponse, available: list}, array{}>|DataResponse * * 200: Apps returned * 404: New versions not found diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index 8ce2486c153ab..0a019312e355e 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -74,7 +74,7 @@ public function create() { * Delete a LDAP configuration * * @param string $configID ID of the config - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * @throws OCSNotFoundException Config not found * @@ -102,7 +102,7 @@ public function delete($configID) { * * @param string $configID ID of the config * @param array $configData New config - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSException * @throws OCSBadRequestException Modifying config is not possible * @throws OCSNotFoundException Config not found diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 2c99fadfcc94d..0cd263edec8c2 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -638,6 +638,10 @@ private function isUserOnLDAP(string $uid): bool { return false; } + /** + * @param string $uid + * @return list + */ 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 @@ protected function getCachedGroupsForUserId(string $uid): array { * This function includes groups based on dynamic group membership. * * @param string $uid Name of the user - * @return string[] Group names + * @return list Group names * @throws Exception * @throws ServerNotAvailableException */ diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index 11b7498fbed7e..8ed3a5dd87d80 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -133,7 +133,7 @@ public function inGroup($uid, $gid) { * Get all groups a user belongs to * * @param string $uid Name of the user - * @return string[] with group names + * @return list with group names * * This function fetches all groups a user belongs to. It does not check * if the user exists at all. diff --git a/apps/user_status/lib/Controller/HeartbeatController.php b/apps/user_status/lib/Controller/HeartbeatController.php index d1da035329e0f..30f4af6572a7f 100644 --- a/apps/user_status/lib/Controller/HeartbeatController.php +++ b/apps/user_status/lib/Controller/HeartbeatController.php @@ -44,7 +44,7 @@ public function __construct( * * @param string $status Only online, away * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Status successfully updated * 204: User has no status to keep alive diff --git a/apps/user_status/lib/Controller/PredefinedStatusController.php b/apps/user_status/lib/Controller/PredefinedStatusController.php index 1430036088067..70262d1108ad7 100644 --- a/apps/user_status/lib/Controller/PredefinedStatusController.php +++ b/apps/user_status/lib/Controller/PredefinedStatusController.php @@ -42,7 +42,7 @@ public function __construct( /** * Get all predefined messages * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Predefined statuses returned */ @@ -50,8 +50,8 @@ public function __construct( #[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; - })); + }))); } } diff --git a/apps/user_status/lib/Controller/StatusesController.php b/apps/user_status/lib/Controller/StatusesController.php index f9c64c075bf8f..e27a0fabbed99 100644 --- a/apps/user_status/lib/Controller/StatusesController.php +++ b/apps/user_status/lib/Controller/StatusesController.php @@ -47,7 +47,7 @@ public function __construct( * * @param int|null $limit Maximum number of statuses to find * @param int|null $offset Offset for finding statuses - * @return DataResponse + * @return DataResponse, array{}> * * 200: Statuses returned */ @@ -56,9 +56,9 @@ public function __construct( 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))); } /** diff --git a/apps/user_status/lib/Controller/UserStatusController.php b/apps/user_status/lib/Controller/UserStatusController.php index bc2efaf86e696..a65f9a75c9f98 100644 --- a/apps/user_status/lib/Controller/UserStatusController.php +++ b/apps/user_status/lib/Controller/UserStatusController.php @@ -155,7 +155,7 @@ public function setCustomMessage(?string $statusIcon, /** * Clear the message of the current user * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Message cleared successfully */ @@ -171,7 +171,7 @@ public function clearMessage(): DataResponse { * * @param string $messageId ID of the message to delete * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * * 200: Status reverted */ diff --git a/apps/user_status/lib/Dashboard/UserStatusWidget.php b/apps/user_status/lib/Dashboard/UserStatusWidget.php index 9dce2b1412a9e..c1091d4bb2119 100644 --- a/apps/user_status/lib/Dashboard/UserStatusWidget.php +++ b/apps/user_status/lib/Dashboard/UserStatusWidget.php @@ -143,7 +143,7 @@ static function (UserStatus $status) use ($userId, $since): bool { 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 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7): ), (string)$widgetData['timestamp'] ); - }, $widgetItemsData); + }, $widgetItemsData)); } /** diff --git a/apps/weather_status/lib/Controller/WeatherStatusController.php b/apps/weather_status/lib/Controller/WeatherStatusController.php index 953e09f2f2de4..c56ea3b97b37e 100644 --- a/apps/weather_status/lib/Controller/WeatherStatusController.php +++ b/apps/weather_status/lib/Controller/WeatherStatusController.php @@ -93,7 +93,7 @@ public function getLocation(): DataResponse { /** * Get forecast for current location * - * @return DataResponse|DataResponse + * @return DataResponse|array{error: string}, array{}>|DataResponse * * 200: Forecast returned * 404: Forecast not found @@ -111,7 +111,7 @@ public function getForecast(): DataResponse { /** * Get favorites list * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Favorites returned */ @@ -123,7 +123,7 @@ public function getFavorites(): DataResponse { /** * Set favorites list * - * @param string[] $favorites Favorite addresses + * @param list $favorites Favorite addresses * @return DataResponse * * 200: Favorites updated diff --git a/apps/weather_status/lib/Service/WeatherStatusService.php b/apps/weather_status/lib/Service/WeatherStatusService.php index 9d9972e84efc9..04500cf66a541 100644 --- a/apps/weather_status/lib/Service/WeatherStatusService.php +++ b/apps/weather_status/lib/Service/WeatherStatusService.php @@ -70,7 +70,7 @@ public function setMode(int $mode): array { /** * Get favorites list - * @return string[] + * @return list */ public function getFavorites(): array { $favoritesJson = $this->config->getUserValue($this->userId, Application::APP_ID, 'favorites', ''); @@ -79,7 +79,7 @@ public function getFavorites(): array { /** * Set favorites list - * @param string[] $favorites + * @param list $favorites * @return WeatherStatusSuccess success state */ public function setFavorites(array $favorites): array { @@ -287,7 +287,7 @@ public function getLocation(): array { /** * Get forecast for current location * - * @return WeatherStatusForecast[]|array{error: string}|WeatherStatusSuccess which contains success state and filtered forecast data + * @return list|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 @@ public function getForecast(): array { * @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|array{error: string} Filtered forecast data */ private function forecastRequest(float $lat, float $lon, float $altitude, int $nbValues = 10): array { $params = [ diff --git a/apps/webhook_listeners/lib/Controller/WebhooksController.php b/apps/webhook_listeners/lib/Controller/WebhooksController.php index 1d5e37cb373b0..ef8e2e1e2444c 100644 --- a/apps/webhook_listeners/lib/Controller/WebhooksController.php +++ b/apps/webhook_listeners/lib/Controller/WebhooksController.php @@ -50,7 +50,7 @@ public function __construct( * List registered webhooks * * @param string|null $uri The callback URI to filter by - * @return DataResponse + * @return DataResponse, array{}> * @throws OCSException Other internal error * * 200: Webhook registrations returned @@ -66,12 +66,10 @@ public function index(?string $uri = null): DataResponse { $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); diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index b43f0077507d3..16ec124e23a73 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -102,7 +102,7 @@ public function getAppPassword(): DataResponse { /** * Delete app password * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSForbiddenException Deleting app password is not allowed * * 200: App password deleted successfully @@ -162,7 +162,7 @@ public function rotateAppPassword(): DataResponse { * * @param string $password The password of the user * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Password confirmation succeeded * 403: Password confirmation failed diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 654570e66ec14..692fe1b7297cb 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -43,10 +43,10 @@ public function __construct( * @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 $shareTypes Types of shares to search for * @param int $limit Maximum number of results to return * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Autocomplete results returned */ @@ -100,7 +100,7 @@ public function get(string $search, ?string $itemType, ?string $itemId, ?string } /** - * @return CoreAutocompleteResult[] + * @return list */ protected function prepareResultArray(array $results): array { $output = []; diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 5003d5824e35b..4d5e810ddb954 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -57,7 +57,7 @@ public function __construct( * @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|JSONResponse, array{}>|Response + * @return FileDisplayResponse|JSONResponse, array{}>|Response * * 200: Avatar returned * 201: Avatar returned @@ -108,7 +108,7 @@ public function getAvatarDark(string $userId, int $size, bool $guestFallback = f * @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|JSONResponse, array{}>|Response + * @return FileDisplayResponse|JSONResponse, array{}>|Response * * 200: Avatar returned * 201: Avatar returned diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index c3d1a7f842b28..8ea475941c8d1 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -29,7 +29,7 @@ public function __construct( /** * Returns a new CSRF token. * - * @return JSONResponse|JSONResponse, array{}> + * @return JSONResponse|JSONResponse, array{}> * * 200: CSRF token returned * 403: Strict cookie check failed diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 43eac012be1a0..b973a57924e6e 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -61,7 +61,7 @@ public function __construct( * Poll the login flow credentials * * @param string $token Token of the flow - * @return JSONResponse|JSONResponse, array{}> + * @return JSONResponse|JSONResponse, array{}> * * 200: Login flow credentials returned * 404: Login flow not found or completed diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php index 6f27789c56633..e160d73317699 100644 --- a/core/Controller/CollaborationResourcesController.php +++ b/core/Controller/CollaborationResourcesController.php @@ -59,7 +59,7 @@ protected function getCollection(int $collectionId): ICollection { * Get a collection * * @param int $collectionId ID of the collection - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Collection returned * 404: Collection not found @@ -80,7 +80,7 @@ public function listCollection(int $collectionId): DataResponse { * Search for collections * * @param string $filter Filter collections - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * * 200: Collections returned * 404: Collection not found @@ -103,7 +103,7 @@ public function searchCollections(string $filter): DataResponse { * @param int $collectionId ID of the collection * @param string $resourceType Name of the resource * @param string $resourceId ID of the resource - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Collection returned * 404: Collection not found or resource inaccessible @@ -137,7 +137,7 @@ public function addResource(int $collectionId, string $resourceType, string $res * @param int $collectionId ID of the collection * @param string $resourceType Name of the resource * @param string $resourceId ID of the resource - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Collection returned * 404: Collection or resource not found @@ -167,7 +167,7 @@ public function removeResource(int $collectionId, string $resourceType, string $ * * @param string $resourceType Type of the resource * @param string $resourceId ID of the resource - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * * 200: Collections returned * 404: Resource not accessible @@ -194,7 +194,7 @@ public function getCollectionsByResource(string $resourceType, string $resourceI * @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|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Collection returned * 400: Creating collection is not possible @@ -228,7 +228,7 @@ public function createCollectionOnResource(string $baseResourceType, string $bas * * @param int $collectionId ID of the collection * @param string $collectionName New name - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Collection returned * 404: Collection not found @@ -248,7 +248,7 @@ public function renameCollection(int $collectionId, string $collectionName): Dat } /** - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> */ protected function respondCollection(ICollection $collection): DataResponse { try { @@ -262,7 +262,7 @@ protected function respondCollection(ICollection $collection): DataResponse { } /** - * @return CoreCollection[] + * @return list */ protected function prepareCollections(array $collections): array { $result = []; @@ -295,7 +295,7 @@ protected function prepareCollection(ICollection $collection): array { } /** - * @return CoreResource[] + * @return list */ protected function prepareResources(array $resources): array { $result = []; diff --git a/core/Controller/HoverCardController.php b/core/Controller/HoverCardController.php index 588cef2a72d09..7a816e21d14b3 100644 --- a/core/Controller/HoverCardController.php +++ b/core/Controller/HoverCardController.php @@ -33,7 +33,7 @@ public function __construct( * Get the account details for a hovercard * * @param string $userId ID of the user - * @return DataResponse|DataResponse, array{}> + * @return DataResponse}, array{}>|DataResponse, array{}> * * 200: Account details returned * 404: Account not found @@ -54,7 +54,7 @@ public function getUser(string $userId): DataResponse { array_unshift($actions, $data['topAction']); } - /** @var CoreContactsAction[] $actions */ + /** @var list $actions */ return new DataResponse([ 'userId' => $userId, 'displayName' => $contact->getFullName(), diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index a433c3073b409..d4d6a17db796a 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -381,7 +381,7 @@ private function createLoginFailedResponse( * * @param string $password The password of the user * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse, array{}> * * 200: Password confirmation succeeded * 403: Password confirmation failed diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index 44c8ef0880b20..de72e41294535 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -33,7 +33,7 @@ public function __construct( * Get the apps navigation * * @param bool $absolute Rewrite URLs to absolute ones - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * * 200: Apps navigation returned * 304: No apps navigation changed @@ -60,7 +60,7 @@ public function getAppsNavigation(bool $absolute = false): DataResponse { * Get the settings navigation * * @param bool $absolute Rewrite URLs to absolute ones - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * * 200: Apps navigation returned * 304: No apps navigation changed diff --git a/core/Controller/OCMController.php b/core/Controller/OCMController.php index b53dc08fecf32..59529b66e121a 100644 --- a/core/Controller/OCMController.php +++ b/core/Controller/OCMController.php @@ -43,7 +43,7 @@ public function __construct( * * @psalm-suppress MoreSpecificReturnType * @psalm-suppress LessSpecificReturnStatement - * @return DataResponse|DataResponse + * @return DataResponse, protocols: array{webdav: string}}>}, array{X-NEXTCLOUD-OCM-PROVIDERS: true, Content-Type: 'application/json'}>|DataResponse * * 200: OCM Provider details returned * 500: OCM not supported diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 807df4a2ebcbd..2720da671be09 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -47,7 +47,7 @@ public function __construct( * @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|DataResponse, array{}>|RedirectResponse + * @return FileDisplayResponse|DataResponse, array{}>|RedirectResponse * * 200: Preview returned * 303: Redirect to the mime icon url if mimeFallback is true @@ -90,7 +90,7 @@ public function getPreview( * @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|DataResponse, array{}>|RedirectResponse + * @return FileDisplayResponse|DataResponse, array{}>|RedirectResponse * * 200: Preview returned * 303: Redirect to the mime icon url if mimeFallback is true @@ -124,7 +124,7 @@ public function getPreviewByFileId( } /** - * @return FileDisplayResponse|DataResponse, array{}>|RedirectResponse + * @return FileDisplayResponse|DataResponse, array{}>|RedirectResponse */ private function fetchPreview( Node $node, diff --git a/core/Controller/ProfileApiController.php b/core/Controller/ProfileApiController.php index bbfb9cc415382..c807ecb72d420 100644 --- a/core/Controller/ProfileApiController.php +++ b/core/Controller/ProfileApiController.php @@ -44,7 +44,7 @@ public function __construct( * @param string $targetUserId ID of the user * @param string $paramId ID of the parameter * @param string $visibility New visibility - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws OCSBadRequestException Updating visibility is not possible * @throws OCSForbiddenException Not allowed to edit other users visibility * @throws OCSNotFoundException Account not found diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php index cba91b976e261..0d34e6244f596 100644 --- a/core/Controller/ReferenceApiController.php +++ b/core/Controller/ReferenceApiController.php @@ -141,7 +141,7 @@ public function resolveOnePublic(string $reference, string $sharingToken): DataR /** * Resolve multiple references * - * @param string[] $references References to resolve + * @param list $references References to resolve * @param int $limit Maximum amount of references to resolve * @return DataResponse}, array{}> * @@ -168,7 +168,7 @@ public function resolve(array $references, int $limit = 1): DataResponse { /** * Resolve multiple references from a public page * - * @param string[] $references References to resolve + * @param list $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}, array{}> @@ -197,7 +197,7 @@ public function resolvePublic(array $references, string $sharingToken, int $limi /** * Get the providers * - * @return DataResponse + * @return DataResponse, array{}> * * 200: Providers returned */ @@ -205,9 +205,9 @@ public function resolvePublic(array $references, string $sharingToken, int $limi #[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); } diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 7ee5e7068af4d..e41c178f44d7b 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -68,30 +68,30 @@ public function __construct( #[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 @@ public function deleteTask(int $id): DataResponse { * * @param string $appId ID of the app * @param string|null $customId An arbitrary identifier for the task - * @return DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse * * 200: Tasks returned */ @@ -217,7 +217,6 @@ public function deleteTask(int $id): DataResponse { 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 @@ public function listTasksByApp(string $appId, ?string $customId = null): DataRes * * @param string|null $taskType The task type to filter by * @param string|null $customId An arbitrary identifier for the task - * @return DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse * * 200: Tasks returned */ @@ -244,7 +243,6 @@ public function listTasksByApp(string $appId, ?string $customId = null): DataRes 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); diff --git a/core/Controller/TeamsApiController.php b/core/Controller/TeamsApiController.php index a27f6deff760f..36685555d4df2 100644 --- a/core/Controller/TeamsApiController.php +++ b/core/Controller/TeamsApiController.php @@ -36,7 +36,7 @@ public function __construct( * Get all resources of a team * * @param string $teamId Unique id of the team - * @return DataResponse + * @return DataResponse}, array{}> * * 200: Resources returned */ @@ -44,7 +44,7 @@ public function __construct( #[ApiRoute(verb: 'GET', url: '/{teamId}/resources', root: '/teams')] public function resolveOne(string $teamId): DataResponse { /** - * @var CoreTeamResource[] $resolvedResources + * @var list $resolvedResources * @psalm-suppress PossiblyNullArgument The route is limited to logged-in users */ $resolvedResources = $this->teamManager->getSharedWith($teamId, $this->userId); @@ -57,7 +57,7 @@ public function resolveOne(string $teamId): DataResponse { * * @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 + * @return DataResponse}, array{}> * * 200: Teams returned */ @@ -66,13 +66,13 @@ public function resolveOne(string $teamId): DataResponse { 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 $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, diff --git a/core/Controller/TextProcessingApiController.php b/core/Controller/TextProcessingApiController.php index a0acf1932897d..cdf39563167cd 100644 --- a/core/Controller/TextProcessingApiController.php +++ b/core/Controller/TextProcessingApiController.php @@ -52,7 +52,7 @@ public function __construct( /** * This endpoint returns all available LanguageModel task types * - * @return DataResponse + * @return DataResponse}, array{}> * * 200: Task types returned */ @@ -191,7 +191,7 @@ public function deleteTask(int $id): DataResponse { * * @param string $appId ID of the app * @param string|null $identifier An arbitrary identifier for the task - * @return DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse * * 200: Task list returned */ @@ -200,10 +200,9 @@ public function deleteTask(int $id): DataResponse { 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, diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index 241c752ea013d..3ffc868e80f23 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -212,7 +212,7 @@ public function deleteTask(int $id): DataResponse { * * @param string $appId ID of the app * @param string|null $identifier An arbitrary identifier for the task - * @return DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse * * 200: Task list returned */ @@ -222,10 +222,9 @@ public function deleteTask(int $id): DataResponse { 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, diff --git a/core/Controller/TranslationApiController.php b/core/Controller/TranslationApiController.php index 81ed190277ba6..294251baa47b1 100644 --- a/core/Controller/TranslationApiController.php +++ b/core/Controller/TranslationApiController.php @@ -36,7 +36,7 @@ public function __construct( /** * Get the list of supported languages * - * @return DataResponse + * @return DataResponse, languageDetection: bool}, array{}> * * 200: Supported languages returned */ @@ -44,7 +44,7 @@ public function __construct( #[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(), ]); } diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index 20d6fb5e59c23..c770c6240df6f 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -45,7 +45,7 @@ public function __construct( * Get the providers for unified search * * @param string $from the url the user is currently at - * @return DataResponse + * @return DataResponse, array{}> * * 200: Providers returned */ diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 98c5e77964b2c..86192d8f4667a 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -41,7 +41,7 @@ public function __construct( /** * Get the changes * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, admin: list}}, array{}>|DataResponse, array{}> * * 200: Changes returned * 204: No changes @@ -87,7 +87,7 @@ public function get():DataResponse { * * @param string $version Version to dismiss the changes for * - * @return DataResponse, array{}> + * @return DataResponse, array{}> * @throws \OCP\PreConditionNotMetException * @throws DoesNotExistException * diff --git a/core/Controller/WipeController.php b/core/Controller/WipeController.php index fe9ee79f3b46b..d364e6399d948 100644 --- a/core/Controller/WipeController.php +++ b/core/Controller/WipeController.php @@ -33,7 +33,7 @@ public function __construct( * * @param string $token App password * - * @return JSONResponse|JSONResponse, array{}> + * @return JSONResponse|JSONResponse, array{}> * * 200: Device should be wiped * 404: Device should not be wiped @@ -62,7 +62,7 @@ public function checkWipe(string $token): JSONResponse { * * @param string $token App password * - * @return JSONResponse, array{}> + * @return JSONResponse, array{}> * * 200: Wipe finished successfully * 404: Device should not be wiped diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php index 4edde2dde3608..7dfd3b7da9be5 100644 --- a/core/ResponseDefinitions.php +++ b/core/ResponseDefinitions.php @@ -63,7 +63,7 @@ * @psalm-type CoreCollection = array{ * id: int, * name: string, - * resources: CoreResource[], + * resources: list, * } * * @psalm-type CoreReference = array{ @@ -78,7 +78,7 @@ * title: string, * icon_url: string, * order: int, - * search_providers_ids: ?string[] + * search_providers_ids: ?list, * } * * @psalm-type CoreUnifiedSearchProvider = array{ @@ -87,7 +87,7 @@ * name: string, * icon: string, * order: int, - * triggers: string[], + * triggers: list, * filters: array, * inAppSearch: bool, * } @@ -99,13 +99,13 @@ * resourceUrl: string, * icon: string, * rounded: bool, - * attributes: string[], + * attributes: list, * } * * @psalm-type CoreUnifiedSearchResult = array{ * name: string, * isPaginated: bool, - * entries: CoreUnifiedSearchResultEntry[], + * entries: list, * cursor: int|string|null, * } * @@ -171,16 +171,16 @@ * @psalm-type CoreTaskProcessingTaskType = array{ * name: string, * description: string, - * inputShape: CoreTaskProcessingShape[], - * inputShapeEnumValues: array{name: string, value: string}[][], + * inputShape: list, + * inputShapeEnumValues: list>, * inputShapeDefaults: array, - * optionalInputShape: CoreTaskProcessingShape[], - * optionalInputShapeEnumValues: array{name: string, value: string}[][], + * optionalInputShape: list, + * optionalInputShapeEnumValues: list>, * optionalInputShapeDefaults: array, - * outputShape: CoreTaskProcessingShape[], - * outputShapeEnumValues: array{name: string, value: string}[][], - * optionalOutputShape: CoreTaskProcessingShape[], - * optionalOutputShapeEnumValues: array{name: string, value: string}[][]} + * outputShape: list, + * outputShapeEnumValues: list>, + * optionalOutputShape: list, + * optionalOutputShapeEnumValues: list>, * } * * @psalm-type CoreTaskProcessingIO = array|string|list> @@ -196,7 +196,10 @@ * output: null|CoreTaskProcessingIO, * customId: ?string, * completionExpectedAt: ?int, - * progress: ?float + * progress: ?float, + * scheduledAt: ?int, + * startedAt: ?int, + * endedAt: ?int, * } * */ diff --git a/core/openapi-ex_app.json b/core/openapi-ex_app.json index cc4a53e10b19d..95a86e8e112cc 100644 --- a/core/openapi-ex_app.json +++ b/core/openapi-ex_app.json @@ -142,7 +142,10 @@ "output", "customId", "completionExpectedAt", - "progress" + "progress", + "scheduledAt", + "startedAt", + "endedAt" ], "properties": { "id": { @@ -194,6 +197,21 @@ "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 } } } diff --git a/core/openapi-full.json b/core/openapi-full.json index 36ff35d55b95f..d6f9837b1c602 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -538,7 +538,10 @@ "output", "customId", "completionExpectedAt", - "progress" + "progress", + "scheduledAt", + "startedAt", + "endedAt" ], "properties": { "id": { @@ -590,6 +593,21 @@ "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 } } }, diff --git a/core/openapi.json b/core/openapi.json index 582b01fd050b6..bf8f2478fbda5 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -538,7 +538,10 @@ "output", "customId", "completionExpectedAt", - "progress" + "progress", + "scheduledAt", + "startedAt", + "endedAt" ], "properties": { "id": { @@ -590,6 +593,21 @@ "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 } } }, diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 312b697340344..a0e5d7e28e845 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -76,7 +76,7 @@ public function __construct( /** * @inheritDoc * - * @return string[] list of app ids + * @return list list of app ids * @since 7.0.0 */ public function getApps(): array { @@ -92,7 +92,7 @@ public function getApps(): array { * * @param string $app id of the app * - * @return string[] list of stored config keys + * @return list list of stored config keys * @since 29.0.0 */ public function getKeys(string $app): array { diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 865af4eb90c96..47011f875ae12 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -118,11 +118,11 @@ public function listCreators(): array { } 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 @@ private function getTemplateFolder(): Node { throw new NotFoundException(); } + /** + * @return list