diff --git a/src/Collector.php b/src/Collector.php index 5fce33c..8b536b5 100644 --- a/src/Collector.php +++ b/src/Collector.php @@ -70,15 +70,14 @@ public function getResults(): array $count = 0; $collectedData = []; - $isCallableWhen = is_callable($this->when); - if ($isCallableWhen) { + if (is_callable($this->when)) { // filter must be a callable with bool return type Filter::boolean($this->when); } foreach ($this->data as $key => $datum) { - if ($isCallableWhen) { + if ($this->when !== null) { /** * @var callable(mixed $datum, int|string|null $key): bool $when */