EasyCorp\Bundle\EasySecurityBundle\Security\Security::getUserRolesAsObjects PHP Method

getUserRolesAsObjects() private method

Returns an array with the roles of the given user turned into Role objects, which are needed by methods such as getReachableRoles().
private getUserRolesAsObjects ( Symfony\Component\Security\Core\User\UserInterface $user ) : Symfony\Component\Security\Core\Role\RoleInterface[]
$user Symfony\Component\Security\Core\User\UserInterface
return Symfony\Component\Security\Core\Role\RoleInterface[]
    private function getUserRolesAsObjects(UserInterface $user)
    {
        $userRoles = array();
        foreach ($user->getRoles() as $userRole) {
            $userRoles[] = $userRole instanceof Role ? $userRole : new Role($userRole);
        }
        return $userRoles;
    }