You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: