5.0.0
On the 6 of August 2019, I started writing this library. Exactly 2 years later, version 5 is released.
85 releases have been created in 2 years. It's a lot. Writing this library was the best thing that happened to me in the last years, work-wise. I've learned so much! It opened for me doors to things I never had imagined before.
I started to write this library to understand from A to Z the use of Iterators and Generators, to understand the concept of laziness, and to provide a framework-agnostic library in the PHP ecosystem.
Since May 2021, Alex Gidei joined the Loophp team to work on Collection
; he improved the documentation, the static analysis and added a couple of new operations.
The documentation is something important but it was inconsistent and incomplete - Alex rewrote dozens of operation documentation and provided many improvements along the way, especially in the examples files.
Regarding the static analysis, we went from 1.5k analyzed expressions to 4.1k and we jumped from 94% to 97.1% score (Psalm level 2.).
For each change, we discussed it together and it has always been an interesting and constructive discussion, even when sometimes we couldn't find an agreement and we had to close the pull request.
Last but not least, he created a Principles documentation page which explains the principles in use in Collection
, its DNA.
Anyway, big thanks once again, Alex!
About version 5.0.0
This version breaks backward compatibility.
Backward breaking changes
- Filter operation: #126
- Map and AsyncMap takes only one callback: #134
- Reduce the use of the spread operators and variadic parameters: #146
- Make constructor private: #163
- The return type of some operations (https://github.com/loophp/collection/discussions/107), we also slightly altered the parameters of some operations and their behaviour.
New features:
* New operations:
* Reject
* isEmpty
* Equals
* Same
* Reduce
* New static constructors:
* fromGenerator
Updated operations:
* Filter
* Partition
* Span
* Map
* Contains
* Every
* Falsy
* Truthy
* Nullsy
* Match
* Has
* Reverse
* Column
* Pipe
* Unpack
* Distinct
* Duplicate
What's next
Most probably taking a break!
Then, I wish I could add more typing everywhere. However, there is no way for Psalm or PHPStan to properly infer operations like Pipe. As a lot of operations are using Pipe, a lot of operations are not able to infer their types and we must add that information manually for each of them. The goal is to let the static analysis tools infer them properly automatically.
Thus, to fix that, I created a temporary project to tackle the issue and create a Psalm plugin; you can find the work in progress here.
Merged
- Documentation: Collection Principles
#174
- Refactor/update
Span
andPartition
in point-free#175
- refactor: Update
Distinct
andDuplicate
operations.#168
- refactor: Update Unpack operation - do not use MapN.
#169
- refactor: Use ETA Reduction for the Pipe operation.
#164
- refactor: Add missing type hints.
#171
- ci: Enable tests on macOS.
#170
- Update Reject operation - Use Filter based algorithm and point free style.
#167
- Fix Column Typing + SA Check
#166
- SA: Update operations.
#165
- Breaking change: refactor: Make constructor private.
#163
- Improve static analysis tests
#153
- chore(deps-dev): Update infection/infection requirement || ^0.24.0
#162
- feat: Add
::fromGenerator
constructor.#150
- Temporary workaround until phpstan/phpstan#5372 is fixed.
#161
- Drop accepts non-variadic count
#157
- Add API Docs Description to Interface Methods
#156
- Add Operation:
Same
#155
- Add
Reduce
operation#139
- Add
Equals
Operation#152
- Fix: Prevent warning when using odd amount of items.
#154
- Link to
stable
docs instead oflatest
#151
- Update Span and Partition operations.
#148
- Breaking change: refactor: Reduce the use of the spread operators and variadic parameters.
#146
- refactor: Rename variables and properties.
#145
- chore(deps): Bump actions/stale from 3.0.19 to 4
#143
- chore(deps): Bump shivammathur/setup-php from 2.11.0 to 2.12.0
#144
- Add AsyncMapN Operation | Remove AsyncMap Variadic Callbacks Usage
#141
- Add coverage check
#142
- Span: Add Variadic Callback Support
#140
- Update
Reverse
operation - optimize and remove todos.#138
- Add IsEmpty Operation
#137
- Update Operations Signatures in API Docs
#136
- Add All Operation
#133
- Refactor Scalar Operations
#132
- Update
Map
to only take a single callback#134
- Provide util class for reducer callback
#131
- Refactor
::partition()
and::span()
#124
- Add Collection::isEmpty Method
#130
- Change GitHub Actions Workflow Triggers
#127
- Add
Reject
operation.#125
- Breaking change: Update
Filter
operation.#126
Commits
- chore: Add AFUP presentation link.
404d0b7
- chore: Update Github configuration files.
c6488a4
- Update IfThenElse operation, add missing typing information.
5f4ef9e
- Update IfThenElse operation, add missing typing information.
ed3c095
- ci: Fix code-style workflow.
40cc177
- chore: Update composer.json, remove obsolete dependencies.
d8a8d50