From 80e3064817602c5d5f9b97646b1dff3c1d163af3 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Tue, 19 Sep 2023 17:14:02 +0200 Subject: [PATCH 1/2] Fix Dashboard IManager getWidgets return annotation Signed-off-by: jld3103 --- lib/private/Dashboard/Manager.php | 7 +++++-- lib/public/Dashboard/IManager.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index 18a66499167e0..afe28872e6946 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -40,8 +40,8 @@ class Manager implements IManager { /** @var array */ private $lazyWidgets = []; - /** @var IWidget[] */ - private $widgets = []; + /** @var array */ + private array $widgets = []; private ContainerInterface $serverContainer; private ?IAppManager $appManager = null; @@ -134,6 +134,9 @@ public function loadLazyPanels(): void { $this->lazyWidgets = []; } + /** + * @return array + */ public function getWidgets(): array { $this->loadLazyPanels(); return $this->widgets; diff --git a/lib/public/Dashboard/IManager.php b/lib/public/Dashboard/IManager.php index 77bff7b34ff6d..135fd4b4514bd 100644 --- a/lib/public/Dashboard/IManager.php +++ b/lib/public/Dashboard/IManager.php @@ -40,7 +40,7 @@ public function lazyRegisterWidget(string $widgetClass, string $appId): void; /** * @since 20.0.0 * - * @return IWidget[] + * @return array */ public function getWidgets(): array; } From 6c840984f89cdc4a44d37e073007675e029d8c40 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Tue, 19 Sep 2023 17:15:23 +0200 Subject: [PATCH 2/2] dashboard: Fix get widgets OpenAPI Signed-off-by: jld3103 --- apps/dashboard/lib/Controller/DashboardApiController.php | 2 +- apps/dashboard/openapi.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dashboard/lib/Controller/DashboardApiController.php b/apps/dashboard/lib/Controller/DashboardApiController.php index 8855bf71700b9..e50ab974dfc8f 100644 --- a/apps/dashboard/lib/Controller/DashboardApiController.php +++ b/apps/dashboard/lib/Controller/DashboardApiController.php @@ -150,7 +150,7 @@ public function getWidgetItemsV2(array $sinceIds = [], int $limit = 7, array $wi * @NoAdminRequired * @NoCSRFRequired * - * @return DataResponse + * @return DataResponse, array{}> */ public function getWidgets(): DataResponse { $widgets = $this->dashboardManager->getWidgets(); diff --git a/apps/dashboard/openapi.json b/apps/dashboard/openapi.json index 739ba2c4afc68..b771b952b33e7 100644 --- a/apps/dashboard/openapi.json +++ b/apps/dashboard/openapi.json @@ -220,8 +220,8 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/Widget" } }