Releases: fp4php/functional
Releases · fp4php/functional
Release v6.0.1
Release v6.0.0
In this release, the psalm plugin has been moved into a separate repository.
This will make it easier to maintain this library in the future.
About migration process: https://github.com/fp4php/functional/blob/master/UPGRADING-v6.md
Release v5.2.0
New functions
contains: Checks if a value exists in an collection.sequenceEitherMerged: Same assequenceEither, but merge all errors tonon-empty-list.
Either updates
Either::filterOrElse: PassingRto the$leftcallback
Release v5.1.0
New functions
- proveUnion: allows to combine multiple evidences.
- proveNull:
proveUnion($mixed, [proveInt(...), proveNull(...)])(inferred asOption<int|null>). - asEnumOf: allows to cast
string|intto enum instance.
Static analysis improvement
- toMergedArray: More specific type.
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.
Docs
Release v4.20.0
minandminBymethods has been added
Release v4.19.0
maxandmaxBymethods has been added
Release v4.18.0
groupMapReducefunction has been added
Release v4.17.0
Improve type assertions (isLeft/isRight, isSome/isNone, isValid/isInvalid)
Release v4.16.1
Fix psalm plugin bug for filter function refinement.