Use spaceship operator for sorting assoc arrays

This commit is contained in:
Yonas Habteab 2022-04-14 14:31:57 +02:00
parent 28021b61d3
commit ad6fb35ae1
3 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
*/