From 4c4c93a155ae09de783086ce5317c16ea7c943f9 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Fri, 14 Jul 2023 16:23:19 +0200 Subject: [PATCH] add Set\Call --- CHANGELOG.md | 6 ++++++ proofs/set/call.php | 21 +++++++++++++++++++++ src/Set/Call.php | 25 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 proofs/set/call.php create mode 100644 src/Set/Call.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f2fd928..f3ca751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 5.1.0 - 2023-07-14 + +### Added + +- `Innmind\BlackBox\Set\Call` + ## 5.0.0 - 2023-05-29 ### Added diff --git a/proofs/set/call.php b/proofs/set/call.php new file mode 100644 index 0000000..a246e39 --- /dev/null +++ b/proofs/set/call.php @@ -0,0 +1,21 @@ + new \stdClass); + + $assert + ->expected($set->values(Random::default)->current()->unwrap()) + ->not() + ->same($set->values(Random::default)->current()->unwrap()); + }, + ); +}; diff --git a/src/Set/Call.php b/src/Set/Call.php new file mode 100644 index 0000000..c0bf265 --- /dev/null +++ b/src/Set/Call.php @@ -0,0 +1,25 @@ + + */ + public static function of(callable $call): Set + { + return FromGenerator::of(static function() use ($call) { + while (true) { + yield $call(); + } + }); + } +}