mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-70897 various: uasort callback can not return bool
Co-authored-by: Ruslan Kabalin <ruslan.kabalin@gmail.com>
This commit is contained in:
parent
0fd37bf5d8
commit
881b4258f7
@ -225,7 +225,7 @@ class content_item_service {
|
||||
|
||||
// Sort by title for return.
|
||||
usort($exported->content_items, function($a, $b) {
|
||||
return $a->title > $b->title;
|
||||
return strcmp($a->title, $b->title);
|
||||
});
|
||||
|
||||
return $exported->content_items;
|
||||
@ -301,7 +301,7 @@ class content_item_service {
|
||||
|
||||
// Sort by title for return.
|
||||
usort($exported->content_items, function($a, $b) {
|
||||
return $a->title > $b->title;
|
||||
return strcmp($a->title, $b->title);
|
||||
});
|
||||
|
||||
return $exported->content_items;
|
||||
|
@ -1327,7 +1327,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
$conversations = \core_message\api::get_conversations($user1->id);
|
||||
|
||||
usort($conversations, function($first, $second){
|
||||
return $first->id > $second->id;
|
||||
return $first->id <=> $second->id;
|
||||
});
|
||||
|
||||
// Consider first conversations is self-conversation.
|
||||
|
@ -2091,7 +2091,7 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertCount(2, $contacts[0]['conversations']);
|
||||
// We can't rely on the ordering of conversations within the results, so sort by id first.
|
||||
usort($contacts[0]['conversations'], function($a, $b) {
|
||||
return $a['id'] < $b['id'];
|
||||
return $b['id'] <=> $a['id'];
|
||||
});
|
||||
$this->assertEquals(\core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP, $contacts[0]['conversations'][0]['type']);
|
||||
$this->assertEquals(\core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL, $contacts[0]['conversations'][1]['type']);
|
||||
@ -2187,7 +2187,7 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertCount(2, $contacts[0]['conversations']);
|
||||
// We can't rely on the ordering of conversations within the results, so sort by id first.
|
||||
usort($contacts[0]['conversations'], function($a, $b) {
|
||||
return $a['id'] < $b['id'];
|
||||
return $b['id'] <=> $a['id'];
|
||||
});
|
||||
$this->assertEquals(\core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP, $contacts[0]['conversations'][0]['type']);
|
||||
$this->assertEquals(\core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL, $contacts[0]['conversations'][1]['type']);
|
||||
@ -3538,7 +3538,7 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
* @return bool
|
||||
*/
|
||||
protected static function sort_contacts($a, $b) {
|
||||
return $a['userid'] > $b['userid'];
|
||||
return $a['userid'] <=> $b['userid'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3549,7 +3549,7 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
* @return bool
|
||||
*/
|
||||
protected static function sort_contacts_id($a, $b) {
|
||||
return $a['id'] > $b['id'];
|
||||
return $a['id'] <=> $b['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4422,7 +4422,7 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
$conversations = $result['conversations'];
|
||||
|
||||
usort($conversations, function($first, $second){
|
||||
return $first['id'] > $second['id'];
|
||||
return $first['id'] <=> $second['id'];
|
||||
});
|
||||
|
||||
$selfconversation = array_shift($conversations);
|
||||
|
@ -2904,7 +2904,7 @@ class core_message_privacy_provider_testcase extends \core_privacy\tests\provide
|
||||
* @return bool
|
||||
*/
|
||||
protected static function sort_messages($a, $b) {
|
||||
return $a->message > $b->message;
|
||||
return strcmp($a->message, $b->message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2915,7 +2915,8 @@ class core_message_privacy_provider_testcase extends \core_privacy\tests\provide
|
||||
* @return bool
|
||||
*/
|
||||
protected static function sort_contacts($a, $b) {
|
||||
return $a->contact > $b->contact;
|
||||
// Contact attribute contains user id.
|
||||
return $a->contact <=> $b->contact;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -480,7 +480,7 @@ class manager {
|
||||
|
||||
// Sort categories by order.
|
||||
uasort($categories, function($category1, $category2) {
|
||||
return $category1->get_order() > $category2->get_order();
|
||||
return $category1->get_order() <=> $category2->get_order();
|
||||
});
|
||||
|
||||
static::$searchareacategories = $categories;
|
||||
|
Loading…
x
Reference in New Issue
Block a user