diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-24 15:53:13 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-11-05 09:58:11 +0100 |
commit | 77114fb3277742fc69ddcf2432311ecb263af97e (patch) | |
tree | 0f360660038c65acc5f9cd014f183e45b0c5355b /apps/user_status | |
parent | 1140e41db2ef6241f806eb605df48642a2a32c62 (diff) | |
download | nextcloud-server-77114fb3277742fc69ddcf2432311ecb263af97e.tar.gz nextcloud-server-77114fb3277742fc69ddcf2432311ecb263af97e.zip |
fix(OpenAPI): Adjust array syntax to avoid ambiguitiesfix/openapi/array-syntax
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/user_status')
5 files changed, 11 insertions, 11 deletions
diff --git a/apps/user_status/lib/Controller/HeartbeatController.php b/apps/user_status/lib/Controller/HeartbeatController.php index d1da035329e..30f4af6572a 100644 --- a/apps/user_status/lib/Controller/HeartbeatController.php +++ b/apps/user_status/lib/Controller/HeartbeatController.php @@ -44,7 +44,7 @@ class HeartbeatController extends OCSController { * * @param string $status Only online, away * - * @return DataResponse<Http::STATUS_OK, UserStatusPrivate, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NO_CONTENT, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, UserStatusPrivate, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NO_CONTENT, list<empty>, array{}> * * 200: Status successfully updated * 204: User has no status to keep alive diff --git a/apps/user_status/lib/Controller/PredefinedStatusController.php b/apps/user_status/lib/Controller/PredefinedStatusController.php index 14300360880..70262d1108a 100644 --- a/apps/user_status/lib/Controller/PredefinedStatusController.php +++ b/apps/user_status/lib/Controller/PredefinedStatusController.php @@ -42,7 +42,7 @@ class PredefinedStatusController extends OCSController { /** * Get all predefined messages * - * @return DataResponse<Http::STATUS_OK, UserStatusPredefined[], array{}> + * @return DataResponse<Http::STATUS_OK, list<UserStatusPredefined>, array{}> * * 200: Predefined statuses returned */ @@ -50,8 +50,8 @@ class PredefinedStatusController extends OCSController { #[ApiRoute(verb: 'GET', url: '/api/v1/predefined_statuses/')] public function findAll():DataResponse { // Filtering out the invisible one, that should only be set by API - return new DataResponse(array_filter($this->predefinedStatusService->getDefaultStatuses(), function (array $status) { + return new DataResponse(array_values(array_filter($this->predefinedStatusService->getDefaultStatuses(), function (array $status) { return !array_key_exists('visible', $status) || $status['visible'] === true; - })); + }))); } } diff --git a/apps/user_status/lib/Controller/StatusesController.php b/apps/user_status/lib/Controller/StatusesController.php index f9c64c075bf..e27a0fabbed 100644 --- a/apps/user_status/lib/Controller/StatusesController.php +++ b/apps/user_status/lib/Controller/StatusesController.php @@ -47,7 +47,7 @@ class StatusesController extends OCSController { * * @param int|null $limit Maximum number of statuses to find * @param int|null $offset Offset for finding statuses - * @return DataResponse<Http::STATUS_OK, UserStatusPublic[], array{}> + * @return DataResponse<Http::STATUS_OK, list<UserStatusPublic>, array{}> * * 200: Statuses returned */ @@ -56,9 +56,9 @@ class StatusesController extends OCSController { public function findAll(?int $limit = null, ?int $offset = null): DataResponse { $allStatuses = $this->service->findAll($limit, $offset); - return new DataResponse(array_map(function ($userStatus) { + return new DataResponse(array_values(array_map(function ($userStatus) { return $this->formatStatus($userStatus); - }, $allStatuses)); + }, $allStatuses))); } /** diff --git a/apps/user_status/lib/Controller/UserStatusController.php b/apps/user_status/lib/Controller/UserStatusController.php index bc2efaf86e6..a65f9a75c9f 100644 --- a/apps/user_status/lib/Controller/UserStatusController.php +++ b/apps/user_status/lib/Controller/UserStatusController.php @@ -155,7 +155,7 @@ class UserStatusController extends OCSController { /** * Clear the message of the current user * - * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<empty>, array{}> * * 200: Message cleared successfully */ @@ -171,7 +171,7 @@ class UserStatusController extends OCSController { * * @param string $messageId ID of the message to delete * - * @return DataResponse<Http::STATUS_OK, UserStatusPrivate|array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, UserStatusPrivate|list<empty>, array{}> * * 200: Status reverted */ diff --git a/apps/user_status/lib/Dashboard/UserStatusWidget.php b/apps/user_status/lib/Dashboard/UserStatusWidget.php index 9dce2b1412a..c1091d4bb21 100644 --- a/apps/user_status/lib/Dashboard/UserStatusWidget.php +++ b/apps/user_status/lib/Dashboard/UserStatusWidget.php @@ -143,7 +143,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption public function getItems(string $userId, ?string $since = null, int $limit = 7): array { $widgetItemsData = $this->getWidgetData($userId, $since, $limit); - return array_map(function (array $widgetData) { + return array_values(array_map(function (array $widgetData) { $formattedDate = $this->dateTimeFormatter->formatTimeSpan($widgetData['timestamp']); return new WidgetItem( $widgetData['displayName'], @@ -157,7 +157,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption ), (string)$widgetData['timestamp'] ); - }, $widgetItemsData); + }, $widgetItemsData)); } /** |