Skip to content

Static method to get array of all enum instances #18

Closed
@chriseskow

Description

@chriseskow

When using this library, I was slightly surprised to find that the toArray() method returns an associative array mapping the enum constant names to their underlying values, rather than to instances of the enum object wrapping the value. When adding additional behavior to the enum via instance methods, having the enum objects is often more useful than only the underlying constant values.

What do you think of adding a static method, e.g. getInstances(), returning an array mapping constant names to object instances?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions