Skip to content

Commit

Permalink
[php8-compat] Fix issue with returning bool from uasort by using the …
Browse files Browse the repository at this point in the history
…spaceship operator
  • Loading branch information
seamuslee001 committed Jun 4, 2021
1 parent 94ef389 commit 11d593e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static function getContactDashlets(): array {
if (!isset($a['dashboard_contact.weight'])) {
return 1;
}
return $a['dashboard_contact.weight'] > $b['dashboard_contact.weight'];
return $a['dashboard_contact.weight'] <=> $b['dashboard_contact.weight'];
});
}
return Civi::$statics[__CLASS__][__FUNCTION__][$cid] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion CRM/Utils/Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static function severitySort($a, $b) {
return strcmp($a->getName(), $b->getName());
}
// The Message constructor guarantees that these will always be integers.
return ($aSeverity < $bSeverity);
return ($aSeverity <=> $bSeverity);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour,
* @return bool
*/
function _civicrm_api3_order_by_weight($a, $b) {
return ($b['weight'] ?? 0) < ($a['weight'] ?? 0);
return ($b['weight'] ?? 0) < ($a['weight'] ?? 0) ? 1 : -1;
}

/**
Expand Down

0 comments on commit 11d593e

Please sign in to comment.