Releases: fp4php/functional
Releases · fp4php/functional
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
: PassingR
to the$left
callback
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|int
to 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
+map
combinator - groupMapReduce:
groupBy
+map
+fold
combinator - reindex: Index each elements by callback and returns
HashMap
- firstMap: Like
first
but useOption
data type insteadbool
- lastMap: Like
last
but useOption
data type insteadbool
- traverseOption, traverseEither: See example
- sorted:
$callback
now 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_merge
but as method - toNonEmptyMergedArray: Non-empty version of
toMergedArray
- *N combinators: (
mapN
,flatMapN
and 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
min
andminBy
methods has been added
Release v4.19.0
max
andmaxBy
methods has been added
Release v4.18.0
groupMapReduce
function 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.
Release v4.16.0
Either::getOrThrow