-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
PriorityQueue::toArray
does not return items in prioritized order
#21
Comments
PriorityQueue::toArray
does not return items in prioritized order
Can you shed any light on this? I'm currently trying to get through #102 for a future v4 so it'd be a good time to change this behaviour if it no longer makes sense. |
@gsteel The docblock specifically notes that it's not returned in priority order: * By default, returns only the item data, and in the order registered (not
* sorted). You may provide one of the EXTR_* flags as an argument, allowing
* the ability to return priorities or both data and priority. I honestly do not recall why I wrote it like that; I mean, it was 13 years ago! But based on the implementation, I think the main idea around the method was primarily to allow serialization of the data, optionally with priorities. But it does seem that the data should be in priority order, regardless of the flags provided, as deserialization should return the data in the order it is meant to be iterated. I'd totally support that change. |
Yah I would expect the correct order as well. I mean, thats why we even add priorities in the first place 😬 |
Closes laminas#21 Signed-off-by: George Steel <[email protected]>
Feature Request
Summary
I've recently used the
PriorityQueue
and realized, thatPriorityQueue::toArray
does not return items in prioritized order.Is that intended and if so, why?
I switched to
iterator_to_array
instead but I wonder for whatPriorityQueue::toArray
is for.Feedback welcome.
The text was updated successfully, but these errors were encountered: