Role/RoleHierarchy.php
private function getCleanedRoles(array $reachableRoles, $suffix = '')
    {
        $existingRoles = [];
        $finalRoles = [];

        foreach ($reachableRoles as $role) {
            $name = $this->formatCleanedRoleName($role);

            if (!\in_array($name, $existingRoles, true)) {
                $rSuffix = 'ROLE_USER' !== $name && 'ORGANIZATION_ROLE_USER' !== $name ? $suffix : '';
                $existingRoles[] = $name;
                $finalRoles[] = $role.$rSuffix;
            }
        }

        return $finalRoles;
    }
private function getCleanedRoles(array $reachableRoles, $suffix = '')
    {
        $existingRoles = [];
        $finalRoles = [];

        foreach ($reachableRoles as $role) {
            $name = $this->formatCleanedRoleName($role);

            if (!\in_array($name, $existingRoles, true)) {
                $rSuffix = 'ROLE_USER' !== $name && 'ORGANIZATION_ROLE_USER' !== $name ? $suffix : '';
                $existingRoles[] = $name;
                $finalRoles[] = $role.$rSuffix;
            }
        }

        return $finalRoles;
    }
private function getCleanedRoles ( array $ reachableRoles , $ suffix = '' ) { $ existingRoles = [ ] ; $ finalRoles = [ ] ; foreach ( $ reachableRoles as $ role ) { $ name = $ this -> formatCleanedRoleName ( $ role ) ; if ( ! \ in_array ( $ name , $ existingRoles , true ) ) { $ rSuffix = 'ROLE_USER' !== $ name && 'ORGANIZATION_ROLE_USER' !== $ name ? $ suffix : '' ; $ existingRoles [ ] = $ name ; $ finalRoles [ ] = $ role . $ rSuffix ; } } return $ finalRoles ; }
Cleaning the double roles.

@param string[] $reachableRoles The reachable roles
@param string   $suffix         The role name suffix

@return string[]
Cleaning the double roles .