Skip to content

7.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 12 Dec 21:41
c6b9164

Overall feeling 🐈

A year and one day without update.

Released on the 11th December 2021, 6.0.3 was the last update.

Today, we are pleased to announce the release of version 7, our first update in over a year. There were several reasons for the delay, including a lack of bug reports and the busy schedules of our team members. We also wanted to take the time to carefully test and prepare the release, given the significant changes and improvements included in this update.

We hope you enjoy this update, and we look forward to continuing to improve and evolve our library in the coming months and years. Please let us know if you have any feedback or suggestions.

Notable changes 🎉

  • Minimum version of PHP is now 8
    PHP 7.4 support has ended the 28 November 2022, therefore, it's time to support PHP 8. Rector has been used to upgrade the codebase with all the new PHP 8 stuff.
  • Removal of docker, switch to Nix
    We were using a docker-compose file to have the documentation built locally, but since I'm using more and more Nix, I decided to get rid of Docker. With one single file .envrc, all the dependencies we need to built the documentation server, creating changelogs with auto-changelogs, running Sphinx server for documentation and have a proper PHP interpreter.
  • Removal of PHPSpec, switch to PHPunit
    For many reasons, we decided to switch to PHPUnit for testing. Switching to the PHPUnit framework was the opportunity to rewrite all the tests and we are extremelly grateful towards the PHPUnit framework. We also built a specific PHPUnit plugin providing assertions for iterables. To built it, we had to abstract the main classes in use in loophp/collection in their own project, and that project contains now many Iterator aggregates now in use in loophp/collection.
  • New CollectionDecorator abstract class to create custom collection classes
    Since the beginning of the creation of this library, many people expressed the will to not set the main Collection class as final. While I'm absolutely not for that, I'm more keen to provide an abstract class which acts as a decorator and that can be easily extended by using the inheritance mechanism.
  • Add new operations: Averages, Compare, Max, Min
    A couple of new operations has been added, please read the API documentation to learn more about them.
  • Use of IteratorAggregate
    Many operations are now using IteratorAggregate from loophp/iterators.
  • The cache operation is using the fastest implementation of Caching iterators existing. I couldn't find a fastest implementation yet. That implementation is available in loophp/iterators as an Iterator aggregate. Special thanks to @azjezz for the discussion and tips.
  • Static analysis coverage has been greatly improved, we are now around 99.2%

BC Breaking changes 💣

  • #269
    The static constructor is no more variadic. We noticed that when using unfold, there were some of useless kind of back and forth when it comes to callback arguments handling. Return value is an array, which is expanded, then converted again into an array... that mambo jambo is useless, it has been removed.
  • #245
    The ScanLeft1 has always been something that was bugging me out in the edge cases. I was unable to find an elegant way to deal with it when the Collection was empty since we were using Prepend in it. This issue has been fixed now. The implementation is not the best, but it works very well.
  • #249
    The operations: first, foldLeft, foldLeft1, foldRight, foldRight1, implode, reduce, unlines, unwords, last, head, get, compare, min, max are now returning a value instead of returning a Collection containing one single value. That feature request has been requested many times ago by many users, this is now done.
  • The Tails operation is now keeping keys.
    The Tails operation used to return a list of values, it is now returning value keys has well. The implementation is way cleaner and faster has well.

Numbers 🔢

Random 👍

  • Advent Of Code 2022
    This year I decided to participate to the Advent Of Code and guess what... I'm using loophp/collection for finding solutions to the challenges. It turns out that this is actually an excellent tool. I also have in mind to create a dedicated documentation section with the solutions when the challenge is over. In the meantime, you can have a look at the aoc2022 repository and get some inspirations.
  • Try It Online!
    A new badge Try! on the README has been added. It uses https://play.phpsandbox.io/ and provides a live playground where you can test the library online in a full blown text editor with auto-completion !

Merged

  • Psalm 5 upgrade #283
  • add AbstractCollection abstract class #270
  • chore(deps): update dependency sphinx_rtd_theme to v0.5.2 #275
  • chore(deps): update actions/stale action to v6 #276
  • chore(deps): add renovate.json #274
  • refactor: unfold constructor is not variadic anymore #269
  • Documentation: refactoring #266
  • chore(deps): Bump cachix/install-nix-action from 17 to 18 #267
  • Breaking change: refactor: Refactor Reduce operation. #259
  • Add action on README file. #263
  • chore(deps): Bump shivammathur/setup-php from 2.20.1 to 2.21.1 #261
  • chore(deps): Bump shivammathur/setup-php from 2.19.0 to 2.20.1 #258
  • New Operations: Compare, Max, Min #255
  • chore(deps): Bump shivammathur/setup-php from 2.18.1 to 2.19.0 #253
  • ci: Use pcov for coverage. #252
  • chore(deps-dev): Update psr/cache requirement from ^1.0 to ^1.0 || ^2.0 #251
  • chore(deps): Bump shivammathur/setup-php from 2.18.0 to 2.18.1 #250
  • Update Scrutinizer configuration. #249
  • chore(deps): Bump actions/stale from 4 to 5 #248
  • feat: Add Averages operation. #238
  • Simplify every operation #247
  • Get rid of phpspec/prophecy-phpunit. #246
  • Breaking change: fix: Update scanLeft1 operation. #245
  • chore(deps): Bump shivammathur/setup-php from 2.17.1 to 2.18.0 #244
  • refactor: Update every operation. #242
  • chore(deps): Bump actions/cache from 2.1.7 to 3 #243
  • misc: Update CallbackArrayReducer. #241
  • chore(deps): Bump actions/checkout from 2.4.0 to 3 #240
  • chore(deps): Bump shivammathur/setup-php from 2.17.0 to 2.17.1 #239
  • chore(deps): Bump shivammathur/setup-php from 2.16.0 to 2.17.0 #235
  • Replace Iterator with iterable almost everywhere. #233
  • refactor: Use new keyword on some operations. #231
  • refactor: Use StringIteratorAggregate. #234
  • Tests: Switch to PHPUnit #227
  • Refactor: Replace RandomIterator #230
  • Simplify operations that needs more than one instance of the Generator - using IteratorAggregate. #229
  • Use loophp/iterators #228

Fixed

  • tests: Add new tests. #264

Commits

  • Breaking change: refactor: Tails operation, performance improvements d71b2ef
  • Breaking change: refactor: Update Unpack operation. 34c36da
  • chore: update composer.json and fix auto-changelog command 6949831
  • chore: update composer.json 1ba6085
  • remove obsolete annotation 908d3e5
  • refactor: Tails operation ea4b92c
  • refactor: Tails operation, performance improvements 1c28be3
  • refactor: Window operation: minor performance improvement 486567a
  • refactor: upgrade tests for PHP 8 25067cb
  • refactor: upgrade docs for PHP 8 1d9c134
  • refactor: upgrade src for PHP 8 4a4a60b
  • cs: autofix cs 4dc36fe
  • fix: update IfThenElse operation eb78132
  • sa: update typing information for PHP 8 8ee1134
  • update SA annotations 7154f09
  • update SA annotations 0e8b0e5
  • disable phpcs statement d7bba3a
  • update PHPStan baseline 808578a
  • reorder Collection interface use statements 6bbb829
  • fix: update span and partition operations 31d4b31
  • fix: remove static constructors 747e1f8
  • docs: fix unfold signature d11addd
  • sa: update PSalm baseline f78dc32
  • Revert "sa: fix Wrapable interface" 1cf67d1
  • sa: fix Wrapable interface 3866fe5
  • sa: fix template-extends annotations a3f8b45
  • cs: reduce the amount of use statements 19eb14e
  • cs: reduce the amount of use statements dce7e48
  • Autofix code style. cd4a6f6
  • direnv: update .envrc b402706
  • fix: update constructors c49e62b
  • fix: Update GroupBy static analysis annotations. d74d4f8
  • fix: update various operations static analysis annotations. 473f105
  • fix: update various operations static analysis annotations. c1998e9
  • fix: update various operations static analysis annotations. 2fb44cf
  • fix: Since and Until operation - fix sa bde565c
  • fix: Compare operation - fix sa 06729d7
  • fix: fix operator sign ea90e23
  • fix: remove optional parameters 6a27551
  • fix: update interfaces 0dae4c2
  • fix missing parameter 69818b3
  • docs: Update pipe documentation ec10eeb
  • cs: get rid of obsolete phpcs annotations a385a6a
  • ci: update scrutinizer configuration dae9eb6
  • ci: update scrutinizer configuration ca6f602
  • ci: update scrutinizer configuration 2d09f65
  • ci: update scrutinizer configuration bac7f9b
  • ci: update scrutinizer configuration 376bd66
  • ci: update trigger paths 0f2db5b
  • ci: update scrutinizer configuration 8d12965
  • ci: fix indentation 95e60b5
  • ci: update trigger paths e78546e
  • ci: fix scrutinizer/ocular 583668f
  • Autofix code style. 079a7b9
  • docs: Update changes a6653b8
  • scanLeft and scanRight has been updated and now need two arguments instead of one. 9355dea
  • tests: fix tests 1233c49
  • sa: update SA info of various operations. 25ed050
  • sa: fixes 6c5e44c
  • tests: update diff SA tests ece6067
  • tests: update diff SA tests 0af490e
  • fix typos with codespell 28e7663
  • fix Collatz example 6ec0563
  • chore: remove custom nix files 4197638
  • cs: autofix code style e546136
  • refactor: update Pair operation eed0c7e
  • chore: prettify codebase 2a0ed02
  • refactor: align Duplicate operation with Distinct de09c01
  • docs: do not create ArrayIterator. 806fa18
  • refactor: prevent the creation of an extra variable 31f87a8
  • docs: do not create ArrayIterator. 2e50e49
  • refactor: remove files header aacb5e9
  • Revert "chore: Ignore Nix files" 98fe09a
  • docs: Add phpsandbox badge and link. 9f02c7c
  • docs: Fix minor things. 679b353
  • chore: Update flake.nix file. 8ddd35d
  • chore: Ignore Nix files d34980d
  • ci: Add workflow to build a PDF of the documentation for each tag. 7810400
  • chore: Add composer command to run the documentation server. 15dc6bd
  • docs: Update documentation. a783394
  • chore: Add Nix flakes file for documentation building. 3f90ed6
  • chore: Remove docker stuff. 88e92b6
  • cs: Upgrade to loophp/iterators^2. 1343255
  • refactor: Upgrade to loophp/iterators^2. 691abd4
  • cs: Autofix code style. 6f1eda3
  • chore: Update baseline. 4463a37
  • chore: Update scrutinizer configuration. fc3a790
  • ci: Add prettier in required status checks. c8687cf
  • chore: Prettify codebase. 9551288
  • chore: Update .gitattributes. 411f937
  • ci: Update required status checks. 5ab0f1f
  • ci: Fix step name. a65faf4
  • prettier: Autofix. ff03ea6
  • ci: Fix branch name. bbfb1c8
  • ci: Enable prettier on the whole repo. 25d1c25
  • ci: Simplify things. 1ef0edc
  • sa: Fix distinct tests. 6147f9c
  • ci: Include tests src directories. ff8fea0
  • sa: Fix distinct tests. edc521f
  • chore: Update test workflow. 7f43d4b
  • chore: Update test workflow. 738cc6e
  • Update Filter and Reject operations. 186c003
  • Minor cosmetic changes. 066504a
  • Autofix code style. 25b2a69
  • refactor: Minor optimization in Pack operation. 32462ad
  • fix: Equals operation, fix typing information. eff8102
  • fix: Same operation, fix typing information. 5a91d8a
  • fix: Reduction operation, fix typing information. 466232b
  • Use ReductionIterableAggregate. 0d4d7a2
  • Use ReductionIterableAggregate. a168b6d
  • Autofix code-style. 3b49c3a
  • Revert "Revert last 3 commits." 16e3c7a
  • Update typing information. 3017e2a
  • tests: Disable problematic test on PHP < 8. c148d16
  • Revert last 3 commits. 31cdc99
  • Use ConcatIterableAggregate. d90986d
  • Use MapIterableAggregate. ea45575
  • Use FilterIterableAggregate. 84b42c2
  • fix: Performance improvements using SimpleCachingIteratorAggregate. 51e7d6f
  • fix: Remove @psalm-suppress annotation. ab5f9f0
  • docs: Add more examples snippets. a1873a7
  • Revert "ci: Disable XDebug." a6b4791
  • ci: Disable XDebug. 447bd03
  • SA: Minor changes fix. 0e30363
  • SA: Minor changes. c835e1c
  • SA: Fix a couple of operations. 679834b
  • SA: PHPStan 1.6.0 upgrade. 843c9c4
  • refactor: Update Reverse operation. 545bd60
  • fix: Remove ext-xdebug from composer.json for now. 6209f4b
  • fix: Minor static analysis fixes. 2ce3510
  • refactor: Minor optimizations here and there. f08d88e
  • refactor: Minor optimizations here and there. e9c4460
  • refactor: Minor optimizations. 5987ab7
  • refactor: random operation: use RandomIterableAggregate. 78e7a6f
  • tests: Add missing test. 8afedbf
  • tests: Add missing test. 7a05041
  • cs: Autofix code style. 0d2595e
  • misc: Further optimizations with Every operations. f523cdb
  • misc: Further optimizations with Every operations. de1edb3
  • tests: Remove duplicated tests. 2a0c84d
  • cs: Minor changes. f0612e7
  • refactor: Optimize Head operation. 33e2f15
  • cs: Autofix code style. 6cc2a05
  • fix: SA - Update Unwindow operation. c9562fd
  • refactor: Simplify and optimize Transpose. 38cca46
  • refactor: Use new keyword everywhere. aacf7df
  • refactor: Use new keyword everywhere. a6db56e
  • refactor: Minor SA annotations update. 35bf8c2
  • refactor: Use new keyword everywhere. 8a3a05a
  • refactor: Remove useless intermediary variable. 79ebed1
  • refactor: Drop rely on Limit now. 16e220a
  • refactor: Remove useless intermediary variable. d6d8aa6
  • refactor: Minor optimizations. 9ac298a
  • refactor: Minor optimizations. 11bee15
  • refactor: Use more iterator aggregates. 19616a6
  • refactor: Use more iterator aggregates. 669a956
  • refactor: Use more iterator aggregates. 7af1d80
  • cs: Cleanup .php-cs-fixer.dist.php. 0fba6da
  • feat: Performance improvements using iterator aggregates. 3b773ad
  • chore: Normalize composer.json. e19bde8
  • tests: TypedIterator - Add test. b9aab65
  • cs: Autofix code style. cbc6c20
  • tests: StringIterator - Add test. fe15a5b
  • tests: StringIterator - Add test. a66242d
  • fix: Disable PHPCSFixer on specific files. eb61a90
  • tests: TypedIterator - Add test. 7280ebc
  • tests: Enable HTML infection reports. 468d71d
  • ci: Update PHP configuration. f54b002
  • Autofix code style. 04d7531
  • Autofix code style. 10e7eed
  • refactor: Unpack operation - Use UnpackIterableAggregate. aaa289a
  • Update license 741cbce
  • Normalize composer.json 8ef547d
  • fix: Add missing from keyword. d179b11
  • Autofix code style. 6df94ee
  • refactor: Minor optimization, remove return keyword. 7683362
  • sa: Update PHPStan baseline. 782a48e
  • sa: Fix unresolvable type. d112149
  • cs: Autofix code style. 78d5d7a
  • sa: Update typing information. 351676b
  • fix: Remove local variable. 58a3919
  • fix: Same operation - proper sign. 15bf8de
  • fix: Same operation must yield. 317b519
  • cs: Same operation, clear remaining todo. 518209b
  • refactor: Simplify fromGenerator operation. b2e1dc9
  • sa: Update typing information to reduce warnings. b2028d8
  • refactor: Simplify DropWhile operation. e794b79
  • test: Add minor test for Sort operation. 1935d11
  • Fix scrutinizer/ocular upload. 5f956e2
  • tests: Only do mutation testing on PHP 8.0. 525e32e
  • docs: Update Contributing section. 36cdcd1
  • ci: Fix scrutinizer/ocular upload. 5e67380
  • docs: Update README. 20a1352
  • ci: Fix Grumphp task name. 4fd27fd
  • docs: Enable badge showing infection tests score. 603eb82
  • ci: Enable infection tests reporting. fed4fbc
  • sa: Improve static analysis score. d11d032
  • refactor: Update Intersperse operation - do not throw when values are negative. 1497db7
  • chore: Update static files. 47eb342
  • chore: Update static files. 401cf20
  • chore: Normalize composer.json. cf34e8d