diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-11-06 08:56:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-06 08:56:30 +0100 |
commit | d53fde8eef13d408fcf035ea8a95e6345df9b99b (patch) | |
tree | 60f6b612d967a9a264589cdd6cc0c6d008e1bf05 /core | |
parent | 8fab143aa486904f7a17c4f1c2f6364cd43bf9d9 (diff) | |
parent | 77114fb3277742fc69ddcf2432311ecb263af97e (diff) | |
download | nextcloud-server-d53fde8eef13d408fcf035ea8a95e6345df9b99b.tar.gz nextcloud-server-d53fde8eef13d408fcf035ea8a95e6345df9b99b.zip |
Merge pull request #49015 from nextcloud/fix/openapi/array-syntax
Diffstat (limited to 'core')
25 files changed, 150 insertions, 97 deletions
diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index b43f0077507..16ec124e23a 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -102,7 +102,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { /** * Delete app password * - * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<empty>, array{}> * @throws OCSForbiddenException Deleting app password is not allowed * * 200: App password deleted successfully @@ -162,7 +162,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { * * @param string $password The password of the user * - * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, list<empty>, array{}> * * 200: Password confirmation succeeded * 403: Password confirmation failed diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 654570e66ec..692fe1b7297 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -43,10 +43,10 @@ class AutoCompleteController extends OCSController { * @param string|null $itemType Type of the items to search for * @param string|null $itemId ID of the items to search for * @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients" - * @param int[] $shareTypes Types of shares to search for + * @param list<int> $shareTypes Types of shares to search for * @param int $limit Maximum number of results to return * - * @return DataResponse<Http::STATUS_OK, CoreAutocompleteResult[], array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreAutocompleteResult>, array{}> * * 200: Autocomplete results returned */ @@ -100,7 +100,7 @@ class AutoCompleteController extends OCSController { } /** - * @return CoreAutocompleteResult[] + * @return list<CoreAutocompleteResult> */ protected function prepareResultArray(array $results): array { $output = []; diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 5003d5824e3..4d5e810ddb9 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -57,7 +57,7 @@ class AvatarController extends Controller { * @param string $userId ID of the user * @param 64|512 $size Size of the avatar * @param bool $guestFallback Fallback to guest avatar if not found - * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}> + * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}> * * 200: Avatar returned * 201: Avatar returned @@ -108,7 +108,7 @@ class AvatarController extends Controller { * @param string $userId ID of the user * @param 64|512 $size Size of the avatar * @param bool $guestFallback Fallback to guest avatar if not found - * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}> + * @return FileDisplayResponse<Http::STATUS_OK|Http::STATUS_CREATED, array{Content-Type: string, X-NC-IsCustomAvatar: int}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}>|Response<Http::STATUS_INTERNAL_SERVER_ERROR, array{}> * * 200: Avatar returned * 201: Avatar returned diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index c3d1a7f842b..8ea475941c8 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -29,7 +29,7 @@ class CSRFTokenController extends Controller { /** * Returns a new CSRF token. * - * @return JSONResponse<Http::STATUS_OK, array{token: string}, array{}>|JSONResponse<Http::STATUS_FORBIDDEN, array<empty>, array{}> + * @return JSONResponse<Http::STATUS_OK, array{token: string}, array{}>|JSONResponse<Http::STATUS_FORBIDDEN, list<empty>, array{}> * * 200: CSRF token returned * 403: Strict cookie check failed diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 43eac012be1..b973a57924e 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -61,7 +61,7 @@ class ClientFlowLoginV2Controller extends Controller { * Poll the login flow credentials * * @param string $token Token of the flow - * @return JSONResponse<Http::STATUS_OK, CoreLoginFlowV2Credentials, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return JSONResponse<Http::STATUS_OK, CoreLoginFlowV2Credentials, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Login flow credentials returned * 404: Login flow not found or completed diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php index 6f27789c566..e160d733176 100644 --- a/core/Controller/CollaborationResourcesController.php +++ b/core/Controller/CollaborationResourcesController.php @@ -59,7 +59,7 @@ class CollaborationResourcesController extends OCSController { * Get a collection * * @param int $collectionId ID of the collection - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection not found @@ -80,7 +80,7 @@ class CollaborationResourcesController extends OCSController { * Search for collections * * @param string $filter Filter collections - * @return DataResponse<Http::STATUS_OK, CoreCollection[], array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreCollection>, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Collections returned * 404: Collection not found @@ -103,7 +103,7 @@ class CollaborationResourcesController extends OCSController { * @param int $collectionId ID of the collection * @param string $resourceType Name of the resource * @param string $resourceId ID of the resource - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection not found or resource inaccessible @@ -137,7 +137,7 @@ class CollaborationResourcesController extends OCSController { * @param int $collectionId ID of the collection * @param string $resourceType Name of the resource * @param string $resourceId ID of the resource - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection or resource not found @@ -167,7 +167,7 @@ class CollaborationResourcesController extends OCSController { * * @param string $resourceType Type of the resource * @param string $resourceId ID of the resource - * @return DataResponse<Http::STATUS_OK, CoreCollection[], array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreCollection>, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Collections returned * 404: Resource not accessible @@ -194,7 +194,7 @@ class CollaborationResourcesController extends OCSController { * @param string $baseResourceType Type of the base resource * @param string $baseResourceId ID of the base resource * @param string $name Name of the collection - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 400: Creating collection is not possible @@ -228,7 +228,7 @@ class CollaborationResourcesController extends OCSController { * * @param int $collectionId ID of the collection * @param string $collectionName New name - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection not found @@ -248,7 +248,7 @@ class CollaborationResourcesController extends OCSController { } /** - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> */ protected function respondCollection(ICollection $collection): DataResponse { try { @@ -262,7 +262,7 @@ class CollaborationResourcesController extends OCSController { } /** - * @return CoreCollection[] + * @return list<CoreCollection> */ protected function prepareCollections(array $collections): array { $result = []; @@ -295,7 +295,7 @@ class CollaborationResourcesController extends OCSController { } /** - * @return CoreResource[] + * @return list<CoreResource> */ protected function prepareResources(array $resources): array { $result = []; diff --git a/core/Controller/HoverCardController.php b/core/Controller/HoverCardController.php index 588cef2a72d..7a816e21d14 100644 --- a/core/Controller/HoverCardController.php +++ b/core/Controller/HoverCardController.php @@ -33,7 +33,7 @@ class HoverCardController extends \OCP\AppFramework\OCSController { * Get the account details for a hovercard * * @param string $userId ID of the user - * @return DataResponse<Http::STATUS_OK, array{userId: string, displayName: string, actions: CoreContactsAction[]}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, array{userId: string, displayName: string, actions: list<CoreContactsAction>}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Account details returned * 404: Account not found @@ -54,7 +54,7 @@ class HoverCardController extends \OCP\AppFramework\OCSController { array_unshift($actions, $data['topAction']); } - /** @var CoreContactsAction[] $actions */ + /** @var list<CoreContactsAction> $actions */ return new DataResponse([ 'userId' => $userId, 'displayName' => $contact->getFullName(), diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index a433c3073b4..d4d6a17db79 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -381,7 +381,7 @@ class LoginController extends Controller { * * @param string $password The password of the user * - * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, array{lastLogin: int}, array{}>|DataResponse<Http::STATUS_FORBIDDEN, list<empty>, array{}> * * 200: Password confirmation succeeded * 403: Password confirmation failed diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index 44c8ef0880b..de72e412945 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -33,7 +33,7 @@ class NavigationController extends OCSController { * Get the apps navigation * * @param bool $absolute Rewrite URLs to absolute ones - * @return DataResponse<Http::STATUS_OK, CoreNavigationEntry[], array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreNavigationEntry>, array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, list<empty>, array{}> * * 200: Apps navigation returned * 304: No apps navigation changed @@ -60,7 +60,7 @@ class NavigationController extends OCSController { * Get the settings navigation * * @param bool $absolute Rewrite URLs to absolute ones - * @return DataResponse<Http::STATUS_OK, CoreNavigationEntry[], array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreNavigationEntry>, array{}>|DataResponse<Http::STATUS_NOT_MODIFIED, list<empty>, array{}> * * 200: Apps navigation returned * 304: No apps navigation changed diff --git a/core/Controller/OCMController.php b/core/Controller/OCMController.php index b53dc08fecf..59529b66e12 100644 --- a/core/Controller/OCMController.php +++ b/core/Controller/OCMController.php @@ -43,7 +43,7 @@ class OCMController extends Controller { * * @psalm-suppress MoreSpecificReturnType * @psalm-suppress LessSpecificReturnStatement - * @return DataResponse<Http::STATUS_OK, array{enabled: bool, apiVersion: string, endPoint: string, resourceTypes: array{name: string, shareTypes: string[], protocols: array{webdav: string}}[]}, array{X-NEXTCLOUD-OCM-PROVIDERS: true, Content-Type: 'application/json'}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{enabled: bool, apiVersion: string, endPoint: string, resourceTypes: list<array{name: string, shareTypes: list<string>, protocols: array{webdav: string}}>}, array{X-NEXTCLOUD-OCM-PROVIDERS: true, Content-Type: 'application/json'}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: OCM Provider details returned * 500: OCM not supported diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 807df4a2ebc..2720da671be 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -47,7 +47,7 @@ class PreviewController extends Controller { * @param bool $forceIcon Force returning an icon * @param 'fill'|'cover' $mode How to crop the image * @param bool $mimeFallback Whether to fallback to the mime icon if no preview is available - * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}> + * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}> * * 200: Preview returned * 303: Redirect to the mime icon url if mimeFallback is true @@ -90,7 +90,7 @@ class PreviewController extends Controller { * @param bool $forceIcon Force returning an icon * @param 'fill'|'cover' $mode How to crop the image * @param bool $mimeFallback Whether to fallback to the mime icon if no preview is available - * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}> + * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}> * * 200: Preview returned * 303: Redirect to the mime icon url if mimeFallback is true @@ -124,7 +124,7 @@ class PreviewController extends Controller { } /** - * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}> + * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, list<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}> */ private function fetchPreview( Node $node, diff --git a/core/Controller/ProfileApiController.php b/core/Controller/ProfileApiController.php index bbfb9cc4153..c807ecb72d4 100644 --- a/core/Controller/ProfileApiController.php +++ b/core/Controller/ProfileApiController.php @@ -44,7 +44,7 @@ class ProfileApiController extends OCSController { * @param string $targetUserId ID of the user * @param string $paramId ID of the parameter * @param string $visibility New visibility - * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<empty>, array{}> * @throws OCSBadRequestException Updating visibility is not possible * @throws OCSForbiddenException Not allowed to edit other users visibility * @throws OCSNotFoundException Account not found diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php index cba91b976e2..0d34e6244f5 100644 --- a/core/Controller/ReferenceApiController.php +++ b/core/Controller/ReferenceApiController.php @@ -141,7 +141,7 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { /** * Resolve multiple references * - * @param string[] $references References to resolve + * @param list<string> $references References to resolve * @param int $limit Maximum amount of references to resolve * @return DataResponse<Http::STATUS_OK, array{references: array<string, CoreReference|null>}, array{}> * @@ -168,7 +168,7 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { /** * Resolve multiple references from a public page * - * @param string[] $references References to resolve + * @param list<string> $references References to resolve * @param string $sharingToken Token of the public share * @param int $limit Maximum amount of references to resolve, limited to 15 * @return DataResponse<Http::STATUS_OK, array{references: array<string, CoreReference|null>}, array{}> @@ -197,7 +197,7 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { /** * Get the providers * - * @return DataResponse<Http::STATUS_OK, CoreReferenceProvider[], array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreReferenceProvider>, array{}> * * 200: Providers returned */ @@ -205,9 +205,9 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { #[ApiRoute(verb: 'GET', url: '/providers', root: '/references')] public function getProvidersInfo(): DataResponse { $providers = $this->referenceManager->getDiscoverableProviders(); - $jsonProviders = array_map(static function (IDiscoverableReferenceProvider $provider) { + $jsonProviders = array_values(array_map(static function (IDiscoverableReferenceProvider $provider) { return $provider->jsonSerialize(); - }, $providers); + }, $providers)); return new DataResponse($jsonProviders); } diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 7ee5e7068af..e41c178f44d 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -68,30 +68,30 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { #[ApiRoute(verb: 'GET', url: '/tasktypes', root: '/taskprocessing')] public function taskTypes(): DataResponse { $taskTypes = array_map(function (array $tt) { - $tt['inputShape'] = array_map(function ($descriptor) { + $tt['inputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['inputShape']); - $tt['outputShape'] = array_map(function ($descriptor) { + }, $tt['inputShape'])); + $tt['outputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['outputShape']); - $tt['optionalInputShape'] = array_map(function ($descriptor) { + }, $tt['outputShape'])); + $tt['optionalInputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['optionalInputShape']); - $tt['optionalOutputShape'] = array_map(function ($descriptor) { + }, $tt['optionalInputShape'])); + $tt['optionalOutputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['optionalOutputShape']); - $tt['inputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['inputShapeEnumValues']); - $tt['optionalInputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['optionalInputShapeEnumValues']); - $tt['outputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['outputShapeEnumValues']); - $tt['optionalOutputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['optionalOutputShapeEnumValues']); + }, $tt['optionalOutputShape'])); + $tt['inputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['inputShapeEnumValues'])); + $tt['optionalInputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['optionalInputShapeEnumValues'])); + $tt['outputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['outputShapeEnumValues'])); + $tt['optionalOutputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['optionalOutputShapeEnumValues'])); return $tt; }, $this->taskProcessingManager->getAvailableTaskTypes()); return new DataResponse([ @@ -208,7 +208,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @param string $appId ID of the app * @param string|null $customId An arbitrary identifier for the task - * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTaskProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Tasks returned */ @@ -217,7 +217,6 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { public function listTasksByApp(string $appId, ?string $customId = null): DataResponse { try { $tasks = $this->taskProcessingManager->getUserTasksByApp($this->userId, $appId, $customId); - /** @var CoreTaskProcessingTask[] $json */ $json = array_map(static function (Task $task) { return $task->jsonSerialize(); }, $tasks); @@ -235,7 +234,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @param string|null $taskType The task type to filter by * @param string|null $customId An arbitrary identifier for the task - * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTaskProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Tasks returned */ @@ -244,7 +243,6 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { public function listTasks(?string $taskType, ?string $customId = null): DataResponse { try { $tasks = $this->taskProcessingManager->getUserTasks($this->userId, $taskType, $customId); - /** @var CoreTaskProcessingTask[] $json */ $json = array_map(static function (Task $task) { return $task->jsonSerialize(); }, $tasks); diff --git a/core/Controller/TeamsApiController.php b/core/Controller/TeamsApiController.php index a27f6deff76..36685555d4d 100644 --- a/core/Controller/TeamsApiController.php +++ b/core/Controller/TeamsApiController.php @@ -36,7 +36,7 @@ class TeamsApiController extends \OCP\AppFramework\OCSController { * Get all resources of a team * * @param string $teamId Unique id of the team - * @return DataResponse<Http::STATUS_OK, array{resources: CoreTeamResource[]}, array{}> + * @return DataResponse<Http::STATUS_OK, array{resources: list<CoreTeamResource>}, array{}> * * 200: Resources returned */ @@ -44,7 +44,7 @@ class TeamsApiController extends \OCP\AppFramework\OCSController { #[ApiRoute(verb: 'GET', url: '/{teamId}/resources', root: '/teams')] public function resolveOne(string $teamId): DataResponse { /** - * @var CoreTeamResource[] $resolvedResources + * @var list<CoreTeamResource> $resolvedResources * @psalm-suppress PossiblyNullArgument The route is limited to logged-in users */ $resolvedResources = $this->teamManager->getSharedWith($teamId, $this->userId); @@ -57,7 +57,7 @@ class TeamsApiController extends \OCP\AppFramework\OCSController { * * @param string $providerId Identifier of the provider (e.g. deck, talk, collectives) * @param string $resourceId Unique id of the resource to list teams for (e.g. deck board id) - * @return DataResponse<Http::STATUS_OK, array{teams: CoreTeam[]}, array{}> + * @return DataResponse<Http::STATUS_OK, array{teams: list<CoreTeam>}, array{}> * * 200: Teams returned */ @@ -66,13 +66,13 @@ class TeamsApiController extends \OCP\AppFramework\OCSController { public function listTeams(string $providerId, string $resourceId): DataResponse { /** @psalm-suppress PossiblyNullArgument The route is limited to logged-in users */ $teams = $this->teamManager->getTeamsForResource($providerId, $resourceId, $this->userId); - /** @var CoreTeam[] $teams */ - $teams = array_map(function (Team $team) { + /** @var list<CoreTeam> $teams */ + $teams = array_values(array_map(function (Team $team) { $response = $team->jsonSerialize(); /** @psalm-suppress PossiblyNullArgument The route is limited to logged in users */ $response['resources'] = $this->teamManager->getSharedWith($team->getId(), $this->userId); return $response; - }, $teams); + }, $teams)); return new DataResponse([ 'teams' => $teams, diff --git a/core/Controller/TextProcessingApiController.php b/core/Controller/TextProcessingApiController.php index a0acf193289..cdf39563167 100644 --- a/core/Controller/TextProcessingApiController.php +++ b/core/Controller/TextProcessingApiController.php @@ -52,7 +52,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController { /** * This endpoint returns all available LanguageModel task types * - * @return DataResponse<Http::STATUS_OK, array{types: array{id: string, name: string, description: string}[]}, array{}> + * @return DataResponse<Http::STATUS_OK, array{types: list<array{id: string, name: string, description: string}>}, array{}> * * 200: Task types returned */ @@ -191,7 +191,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController { * * @param string $appId ID of the app * @param string|null $identifier An arbitrary identifier for the task - * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTextProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTextProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Task list returned */ @@ -200,10 +200,9 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController { public function listTasksByApp(string $appId, ?string $identifier = null): DataResponse { try { $tasks = $this->textProcessingManager->getUserTasksByApp($this->userId, $appId, $identifier); - /** @var CoreTextProcessingTask[] $json */ - $json = array_map(static function (Task $task) { + $json = array_values(array_map(static function (Task $task) { return $task->jsonSerialize(); - }, $tasks); + }, $tasks)); return new DataResponse([ 'tasks' => $json, diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index 241c752ea01..3ffc868e80f 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -212,7 +212,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController { * * @param string $appId ID of the app * @param string|null $identifier An arbitrary identifier for the task - * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTextToImageTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTextToImageTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Task list returned */ @@ -222,10 +222,9 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController { public function listTasksByApp(string $appId, ?string $identifier = null): DataResponse { try { $tasks = $this->textToImageManager->getUserTasksByApp($this->userId, $appId, $identifier); - /** @var CoreTextToImageTask[] $json */ - $json = array_map(static function (Task $task) { + $json = array_values(array_map(static function (Task $task) { return $task->jsonSerialize(); - }, $tasks); + }, $tasks)); return new DataResponse([ 'tasks' => $json, diff --git a/core/Controller/TranslationApiController.php b/core/Controller/TranslationApiController.php index 81ed190277b..294251baa47 100644 --- a/core/Controller/TranslationApiController.php +++ b/core/Controller/TranslationApiController.php @@ -36,7 +36,7 @@ class TranslationApiController extends \OCP\AppFramework\OCSController { /** * Get the list of supported languages * - * @return DataResponse<Http::STATUS_OK, array{languages: array{from: string, fromLabel: string, to: string, toLabel: string}[], languageDetection: bool}, array{}> + * @return DataResponse<Http::STATUS_OK, array{languages: list<array{from: string, fromLabel: string, to: string, toLabel: string}>, languageDetection: bool}, array{}> * * 200: Supported languages returned */ @@ -44,7 +44,7 @@ class TranslationApiController extends \OCP\AppFramework\OCSController { #[ApiRoute(verb: 'GET', url: '/languages', root: '/translation')] public function languages(): DataResponse { return new DataResponse([ - 'languages' => array_map(fn ($lang) => $lang->jsonSerialize(), $this->translationManager->getLanguages()), + 'languages' => array_values(array_map(fn ($lang) => $lang->jsonSerialize(), $this->translationManager->getLanguages())), 'languageDetection' => $this->translationManager->canDetectLanguage(), ]); } diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index 20d6fb5e59c..c770c6240df 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -45,7 +45,7 @@ class UnifiedSearchController extends OCSController { * Get the providers for unified search * * @param string $from the url the user is currently at - * @return DataResponse<Http::STATUS_OK, CoreUnifiedSearchProvider[], array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreUnifiedSearchProvider>, array{}> * * 200: Providers returned */ diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 98c5e77964b..86192d8f466 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -41,7 +41,7 @@ class WhatsNewController extends OCSController { /** * Get the changes * - * @return DataResponse<Http::STATUS_OK, array{changelogURL: string, product: string, version: string, whatsNew?: array{regular: string[], admin: string[]}}, array{}>|DataResponse<Http::STATUS_NO_CONTENT, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, array{changelogURL: string, product: string, version: string, whatsNew?: array{regular: list<string>, admin: list<string>}}, array{}>|DataResponse<Http::STATUS_NO_CONTENT, list<empty>, array{}> * * 200: Changes returned * 204: No changes @@ -87,7 +87,7 @@ class WhatsNewController extends OCSController { * * @param string $version Version to dismiss the changes for * - * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<empty>, array{}> * @throws \OCP\PreConditionNotMetException * @throws DoesNotExistException * diff --git a/core/Controller/WipeController.php b/core/Controller/WipeController.php index fe9ee79f3b4..d364e6399d9 100644 --- a/core/Controller/WipeController.php +++ b/core/Controller/WipeController.php @@ -33,7 +33,7 @@ class WipeController extends Controller { * * @param string $token App password * - * @return JSONResponse<Http::STATUS_OK, array{wipe: bool}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return JSONResponse<Http::STATUS_OK, array{wipe: bool}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Device should be wiped * 404: Device should not be wiped @@ -62,7 +62,7 @@ class WipeController extends Controller { * * @param string $token App password * - * @return JSONResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return JSONResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Wipe finished successfully * 404: Device should not be wiped diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php index 4edde2dde36..7dfd3b7da9b 100644 --- a/core/ResponseDefinitions.php +++ b/core/ResponseDefinitions.php @@ -63,7 +63,7 @@ namespace OC\Core; * @psalm-type CoreCollection = array{ * id: int, * name: string, - * resources: CoreResource[], + * resources: list<CoreResource>, * } * * @psalm-type CoreReference = array{ @@ -78,7 +78,7 @@ namespace OC\Core; * title: string, * icon_url: string, * order: int, - * search_providers_ids: ?string[] + * search_providers_ids: ?list<string>, * } * * @psalm-type CoreUnifiedSearchProvider = array{ @@ -87,7 +87,7 @@ namespace OC\Core; * name: string, * icon: string, * order: int, - * triggers: string[], + * triggers: list<string>, * filters: array<string, string>, * inAppSearch: bool, * } @@ -99,13 +99,13 @@ namespace OC\Core; * resourceUrl: string, * icon: string, * rounded: bool, - * attributes: string[], + * attributes: list<string>, * } * * @psalm-type CoreUnifiedSearchResult = array{ * name: string, * isPaginated: bool, - * entries: CoreUnifiedSearchResultEntry[], + * entries: list<CoreUnifiedSearchResultEntry>, * cursor: int|string|null, * } * @@ -171,16 +171,16 @@ namespace OC\Core; * @psalm-type CoreTaskProcessingTaskType = array{ * name: string, * description: string, - * inputShape: CoreTaskProcessingShape[], - * inputShapeEnumValues: array{name: string, value: string}[][], + * inputShape: list<CoreTaskProcessingShape>, + * inputShapeEnumValues: list<list<array{name: string, value: string}>>, * inputShapeDefaults: array<string, numeric|string>, - * optionalInputShape: CoreTaskProcessingShape[], - * optionalInputShapeEnumValues: array{name: string, value: string}[][], + * optionalInputShape: list<CoreTaskProcessingShape>, + * optionalInputShapeEnumValues: list<list<array{name: string, value: string}>>, * optionalInputShapeDefaults: array<string, numeric|string>, - * outputShape: CoreTaskProcessingShape[], - * outputShapeEnumValues: array{name: string, value: string}[][], - * optionalOutputShape: CoreTaskProcessingShape[], - * optionalOutputShapeEnumValues: array{name: string, value: string}[][]} + * outputShape: list<CoreTaskProcessingShape>, + * outputShapeEnumValues: list<list<array{name: string, value: string}>>, + * optionalOutputShape: list<CoreTaskProcessingShape>, + * optionalOutputShapeEnumValues: list<list<array{name: string, value: string}>>, * } * * @psalm-type CoreTaskProcessingIO = array<string, numeric|list<numeric>|string|list<string>> @@ -196,7 +196,10 @@ namespace OC\Core; * output: null|CoreTaskProcessingIO, * customId: ?string, * completionExpectedAt: ?int, - * progress: ?float + * progress: ?float, + * scheduledAt: ?int, + * startedAt: ?int, + * endedAt: ?int, * } * */ diff --git a/core/openapi-ex_app.json b/core/openapi-ex_app.json index cc4a53e10b1..95a86e8e112 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 36ff35d55b9..d6f9837b1c6 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 582b01fd050..bf8f2478fbd 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 } } }, |