Skip to content

Ordering enums #64

@phpfui

Description

@phpfui

I would love to get an 'ordered_enum_elements' like 'ordered_class_elements' fixer.

I would think the options would be 'false' (don't order, leave alone even if 'ordered_class_elements') or 'sort_algorithm' = 'name' or 'value'.

My use case is this:

enum IncludeMembership : int
	{
	case NO = 0;
	case NEW_MEMBERS_ONLY = 1;
	case EXTEND_MEMBERSHIP = 2;
	case RENEW_MEMBERSHIP = 3;
	}

I would order it by value, but I can see a use case to order by name, or don't order at all. Currently it defaults to 'order_class_elements', but I use enums in the user interface, so the order makes a difference to me.

I would be happy to submit a PR, but would like some guidance as to what this should be called, the options and also where to implement this.

Thanks for the help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions