Security/User/SamlUser.php
public function addRole($role)
    {
        if (is_string($role)) {
            $role = new Role($role);
        } elseif (!$role instanceof RoleInterface) {
            throw new \InvalidArgumentException(sprintf('Role must be a string or RoleInterface instance, but got %s.', gettype($role)));
        }
        
        if(!\in_array($role, $this->roles)) {
            $this->roles[] = $role;
        }
    }
public function addRole($role)
    {
        if (is_string($role)) {
            $role = new Role($role);
        } elseif (!$role instanceof RoleInterface) {
            throw new \InvalidArgumentException(sprintf('Role must be a string or RoleInterface instance, but got %s.', gettype($role)));
        }
        
        if(!\in_array($role, $this->roles)) {
            $this->roles[] = $role;
        }
    }
Add user role.