loophp / collection

A (memory) friendly, easy, lazy and modular collection class.
https://loophp-collection.rtfd.io/
MIT License
721 stars 35 forks source link

Unexpected behavior of pair operation over empty collection #326

Closed yesid-stf closed 10 months ago

yesid-stf commented 10 months ago

Steps required to reproduce the problem

See following code example:

Collection::fromIterable([])->pair()->all(false)

Expected Result

It was expected that code would return empty array []

Actual Result

But it returns following garbage information:

array:1 [
  "" => null
]
drupol commented 10 months ago

Hi !

Thanks for reporting the issue, nice catch!

I fixed it in #327 and added a test.