Skip to content

Commit

Permalink
CONTRIB-9525: Fix error on return of get_role (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssj365 authored Mar 25, 2024
1 parent 5e9ec5d commit 123a9af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/local/helpers/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ protected static function get_roles_select(context $context = null, bool $onlyvi
*
* @param string|integer $id
*
* @return stdClass $role
* @return stdClass|null $role
*/
protected static function get_role($id): stdClass {
protected static function get_role($id): ?stdClass {
$roles = (array) role_get_names();
if (is_numeric($id) && isset($roles[$id])) {
return (object) $roles[$id];
Expand All @@ -196,6 +196,7 @@ protected static function get_role($id): stdClass {
return $role;
}
}
return null;
}

/**
Expand Down

0 comments on commit 123a9af

Please sign in to comment.