mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-67035 tags: fix nested ternary operators to be php74 compliant
Nesting ternary operators without explicit parentheses is deprecated: // Code like $a ? $b : $c ? $d : $e // should be replaced by (current interpretation) ($a ? $b : $c) ? $d : $e // or (likely intended interpretation) $a ? $b : ($c ? $d : $e)
This commit is contained in:
parent
d547735f2f
commit
6783adc239
@ -234,7 +234,7 @@ function block_blog_tags_sort($a, $b) {
|
||||
}
|
||||
|
||||
if (is_numeric($a->$tagsort)) {
|
||||
return ($a->$tagsort == $b->$tagsort) ? 0 : ($a->$tagsort > $b->$tagsort) ? 1 : -1;
|
||||
return (($a->$tagsort == $b->$tagsort) ? 0 : ($a->$tagsort > $b->$tagsort)) ? 1 : -1;
|
||||
} elseif (is_string($a->$tagsort)) {
|
||||
return strcmp($a->$tagsort, $b->$tagsort); //TODO: this is not compatible with UTF-8!!
|
||||
} else {
|
||||
|
@ -408,11 +408,11 @@ class core_tag_collection {
|
||||
$tagsort = self::$cloudsortfield ?: 'name';
|
||||
|
||||
if (is_numeric($a->$tagsort)) {
|
||||
return ($a->$tagsort == $b->$tagsort) ? 0 : ($a->$tagsort > $b->$tagsort) ? 1 : -1;
|
||||
return (($a->$tagsort == $b->$tagsort) ? 0 : ($a->$tagsort > $b->$tagsort)) ? 1 : -1;
|
||||
} else if (is_string($a->$tagsort)) {
|
||||
return strcmp($a->$tagsort, $b->$tagsort);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user