Fix a php8 warning

The usort's callback must return values in {-1, 0, 1} and not
a boolean, since this behaviour is deprecated.

This should also fix the following warning:
"Error: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero at /var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php#101"

This partially addresses #25806

Signed-off-by: jvoisin <julien.voisin@dustri.org>
This commit is contained in:
jvoisin 2021-05-29 13:58:33 +02:00
parent 697b22a594
commit ed01cb0306
1 changed files with 4 additions and 1 deletions

View File

@ -97,7 +97,10 @@ class PublicTemplateResponse extends TemplateResponse {
$this->headerActions[] = $action;
}
usort($this->headerActions, function (IMenuAction $a, IMenuAction $b) {
return $a->getPriority() > $b->getPriority();
if ($a->getPriority() == $b->getPriority()) {
return 0;
}
return ($a->getPriority() > $b->getPriority()) ? -1 : 1;
});
}