marc-mabe / php-enum

Simple and fast implementation of enumerations with native PHP
BSD 3-Clause "New" or "Revised" License
464 stars 36 forks source link

remove iterator flags for EnumMap #70

Closed marc-mabe closed 7 years ago

marc-mabe commented 8 years ago

The EnumMap has the following flags to manage how the iterator behaves.

In my opinion this makes the class harder to understand and also harder to use because you need to check the current state of flags before actually iterating of it.

As far as I remember the main reason why it was implemented this way is because of the lack of returning an object (the enumerator instance) as key but this restriction has been lifted since PHP-5.5.

So my suggestion would be to return the enumerator instance as key and the attached data as value of the map without performing any changes in behavior.

Thoughts?

@prolic

prolic commented 8 years ago

ok for me