Skip to content

Commit

Permalink
Make sure we know what type we are dealing with
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm authored May 29, 2020
1 parent 966d25b commit df5581e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Security/Authentication/Token/SSOToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,14 @@ public function getRoles()
$allRoles = array_merge($parentRoles, $this->storedRoles);
$uniqueRoles = [];

/** @var Role $role */
/** @var Role|string $role */
foreach ($allRoles as $role) {
$uniqueRoles[$role->getRole()] = $role;
$stringRole = $role;
if ($role instanceof Role) {
$stringRole = $role->getRole();
}

$uniqueRoles[$stringRole] = $role;
}

return array_values($uniqueRoles);
Expand Down

0 comments on commit df5581e

Please sign in to comment.