Skip to content

Releases: fp4php/functional

v6.0.0

22 May 14:34
Compare
Choose a tag to compare

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

05 Dec 19:38
Compare
Choose a tag to compare

New functions

  • contains: Checks if a value exists in an collection.
  • sequenceEitherMerged: Same as sequenceEither, but merge all errors to non-empty-list.

Either updates

  • Either::filterOrElse: Passing R to the $left callback

Release v5.1.0

28 Nov 08:27
Compare
Choose a tag to compare

New functions

  • proveUnion: allows to combine multiple evidences.
  • proveNull: proveUnion($mixed, [proveInt(...), proveNull(...)]) (inferred as Option<int|null>).
  • asEnumOf: allows to cast string|int to enum instance.

Static analysis improvement

  • toMergedArray: More specific type.

Release v5.0.0

21 Nov 10:04
Compare
Choose a tag to compare

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 use Option data type instead bool
  • lastMap: Like last but use Option data type instead bool
  • 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>> to iterable<T>
  • zipWithKeys: Turns Seq<T> to Seq<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

Docs

Release v4.20.0

23 Aug 08:16
f08c58f
Compare
Choose a tag to compare
  • min and minBy methods has been added

Release v4.19.0

19 Aug 10:36
8491933
Compare
Choose a tag to compare
  • max and maxBy methods has been added

Release v4.18.0

15 Jun 12:56
89c3b46
Compare
Choose a tag to compare
  • groupMapReduce function has been added

Release v4.17.0

02 Jun 14:41
Compare
Choose a tag to compare

Improve type assertions (isLeft/isRight, isSome/isNone, isValid/isInvalid)

Release v4.16.1

08 Feb 14:50
Compare
Choose a tag to compare

Fix psalm plugin bug for filter function refinement.

Release v4.16.0

28 Dec 20:02
Compare
Choose a tag to compare
  • Either::getOrThrow