Release v5.0.0
In addition to new functionality, this release contains backwards-incompatible changes.
Read about BC here: https://github.com/fp4php/functional/blob/master/UPGRADING-v5.md
New collection ops
- groupMap:
groupBy+mapcombinator - groupMapReduce:
groupBy+map+foldcombinator - reindex: Index each elements by callback and returns
HashMap - firstMap: Like
firstbut useOptiondata type insteadbool - lastMap: Like
lastbut useOptiondata type insteadbool - traverseOption, traverseEither: See example
- sorted:
$callbacknow is optional. Will be use default PHP comparison mechanism without$callback. - sortedBy: allow specify value for sorting.
- sortedDesc: allow specify value for ascending sorting.
- sortedDescBy: allow specify value for desceding sorting.
- flatten: Turns
iterable<iterable<T>>toiterable<T> - zipWithKeys: Turns
Seq<T>toSeq<array{int, T}> - init: Returns all elements except last
- partition: Separates collection by predicate
- partitionMap: Separates collection by predicate (but using Either)
- toString: Returns string representation of datatype.
- toStream: Turns collection to
Stream - toMergedArray: Like
array_mergebut as method - toNonEmptyMergedArray: Non-empty version of
toMergedArray - *N combinators: (
mapN,flatMapNand others...)
Psalm plugin improvement
- first: type narrowing from predicate.
- last: type narrowing from predicate.
- filter: type narrowing support for first-class callable
- filterNotNull: shape inference
- partitionT: exhaustive type inference
- Either::filterOrElse: type narrowing from predicate.