Role/RoleUtil.php
public static function formatRoles(array $roles, $force = false): array
    {
        if ($force || version_compare(Kernel::VERSION, '4.3', '<')) {
            $roles = array_map(static function ($role) {
                return !$role instanceof Role ? new Role((string) $role) : $role;
            }, $roles);
        }

        return $roles;
    }
public static function formatRoles(array $roles, $force = false): array
    {
        if ($force || version_compare(Kernel::VERSION, '4.3', '<')) {
            $roles = array_map(static function ($role) {
                return !$role instanceof Role ? new Role((string) $role) : $role;
            }, $roles);
        }

        return $roles;
    }
public static function formatRoles ( array $ roles , $ force = false ) : array { if ( $ force || version_compare ( Kernel :: VERSION , '4.3' , '<' ) ) { $ roles = array_map ( static function ( $ role ) { return ! $ role instanceof Role ? new Role ( ( string ) $ role ) : $ role ; } , $ roles ) ; } return $ roles ; }
Format the roles.

@param Role[]|string[] $roles The roles
@param bool            $force Force to convert the role name

@return Role[]|string[]
Format the roles .