-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Stdlib\PriorityList fix current and iterator #6242
Stdlib\PriorityList fix current and iterator #6242
Conversation
@@ -231,6 +232,14 @@ public function valid() | |||
} | |||
|
|||
/** | |||
* @return self | |||
*/ | |||
public function getIterator() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is not needed unless PriorityList
implements IteratorAggregate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for Stdlib\PriorityQueue
continuity.
Interface is not implemented because \Iterator
and \IteratorAggregate
is incompatible.
*/ | ||
public function getIterator() | ||
{ | ||
return clone $this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why cloning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goal of creating a class here #5702
cloning because https://github.com/zendframework/zf2/blob/cc81ee796ffaccadc0ea95debdf61d5d37cbedd9/library/Zend/Stdlib/PriorityQueue.php#L154
Note to self: reword commits on merge |
Manually merged @553e0a16ab07e49de0b46cdd8a6106e21b5b9978 |
…List/fixCurrentAndIterator' into develop Close zendframework/zendframework#6242
add sort before get
current()
add
getIterator()
which return cloned self instance