Skip to content

Instantly share code, notes, and snippets.

@drupol
Created June 11, 2022 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drupol/d8aa080f70799c10156c459dc302c567 to your computer and use it in GitHub Desktop.
Save drupol/d8aa080f70799c10156c459dc302c567 to your computer and use it in GitHub Desktop.
Bug in loophp/collection
<?php
/**
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
include __DIR__ . '/vendor/autoload.php';
use loophp\collection\Collection;
$integers = static function (): array {
$random = [random_int(0, 9)];
return $random;
};
$c = Collection::unfold($integers)
->unwrap()
->distinct();
foreach ($c as $i) {
dump($i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment