Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove iterator flags for EnumMap #70

Closed
marc-mabe opened this issue Oct 1, 2016 · 1 comment
Closed

remove iterator flags for EnumMap #70

marc-mabe opened this issue Oct 1, 2016 · 1 comment

Comments

@marc-mabe
Copy link
Owner

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

  • KEY_AS_INDEX
  • KEY_AS_NAME
  • KEY_AS_VALUE
  • KEY_AS_ORDINAL
  • CURRENT_AS_ENUM
  • CURRENT_AS_DATA
  • CURRENT_AS_NAME
  • CURRENT_AS_VALUE
  • CURRENT_AS_ORDINAL

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

@marc-mabe marc-mabe added this to the 3.0.0 milestone Oct 1, 2016
@prolic
Copy link
Collaborator

prolic commented Oct 2, 2016

ok for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants