From c71f738b315f188cf22fd7d90f815300cc00ace9 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 14 Apr 2022 14:31:57 +0200 Subject: [PATCH] Use spaceship operator for sorting assoc arrays --- library/Icinga/Application/Modules/DashboardContainer.php | 2 +- library/Icinga/Web/Dashboard/Common/DashboardControls.php | 2 +- library/Icinga/Web/Dashboard/Common/ItemListControl.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Application/Modules/DashboardContainer.php b/library/Icinga/Application/Modules/DashboardContainer.php index 379e07c5a..0f49f0edd 100644 --- a/library/Icinga/Application/Modules/DashboardContainer.php +++ b/library/Icinga/Application/Modules/DashboardContainer.php @@ -36,7 +36,7 @@ class DashboardContainer extends NavigationItemContainer public function getDashlets() { uasort($this->dashlets, function (array $x, array $y) { - return $x['priority'] - $y['priority']; + return $x['priority'] <=> $y['priority']; }); return $this->dashlets; diff --git a/library/Icinga/Web/Dashboard/Common/DashboardControls.php b/library/Icinga/Web/Dashboard/Common/DashboardControls.php index 6c2db2586..7f0dc7828 100644 --- a/library/Icinga/Web/Dashboard/Common/DashboardControls.php +++ b/library/Icinga/Web/Dashboard/Common/DashboardControls.php @@ -42,7 +42,7 @@ trait DashboardControls // An entry can be added individually afterwards, it might be the case that the priority // order gets mixed up, so we have to sort things here before being able to render them uasort($this->dashboards, function (BaseDashboard $x, BaseDashboard $y) { - return $x->getPriority() - $y->getPriority(); + return $x->getPriority() <=> $y->getPriority(); }); return $this->dashboards; diff --git a/library/Icinga/Web/Dashboard/Common/ItemListControl.php b/library/Icinga/Web/Dashboard/Common/ItemListControl.php index efcd34f2c..1b8571e5f 100644 --- a/library/Icinga/Web/Dashboard/Common/ItemListControl.php +++ b/library/Icinga/Web/Dashboard/Common/ItemListControl.php @@ -44,7 +44,7 @@ abstract class ItemListControl extends BaseHtmlElement abstract protected function createItemList(): BaseHtmlElement; /** - * Get a drag initiator for this dashlet item + * Get a drag initiator for this widget item * * @return ValidHtml */