Changes between Initial Version and Version 1 of Ticket #43025, comment 5
- Timestamp:
- 02/01/2018 05:35:44 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #43025, comment 5
initial v1 4 4 * I agree that `instanceof` should be used instead of `is_a()`. Also recommended since it's a language construct and not a function. 5 5 * Not sure whether that's necessary, but maybe we should adjust all related docblocks to say "iterable" instead of array. 6 * And now it gets a little more complex: `WP_List_Util::filter()` and `WP_List_Util::sort()` create a new array with the data from the input. Not sure whether we should just keep it that way or try to return the same object that was passed (that would probably make sense). If yes, how could we achieve this reasonably? Add a private utility method that ensures thattransforms the output array back to the same type of traversable object if the input is one? Should we use `clone` and then populate the cloned object with the new values?6 * And now it gets a little more complex: `WP_List_Util::filter()` and `WP_List_Util::sort()` create a new array with the data from the input. Not sure whether we should just keep it that way or try to return the same object that was passed (that would probably make sense). If yes, how could we achieve this reasonably? Add a private utility method that transforms the output array back to the same type of traversable object if the input is one? Should we use `clone` and then populate the cloned object with the new values? 7 7 * `WP_List_Util::sort()` uses `usort()` and `uasort()` both of which don't work with a traversable object. Maybe we really need to transform the traversable into an array immediately and transform it back after the operations. 8 8