diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e33a5c..95b4883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## 0.11.0 +## 0.11.2 + +* fix: `PrecountingStrategy` now accepts null as the underlying data + +## 0.11.1 * docs: update readme * feat: offset pagination support diff --git a/packages/collections-common/src/Count/PrecountingStrategy.php b/packages/collections-common/src/Count/PrecountingStrategy.php index dc89843..76e4301 100644 --- a/packages/collections-common/src/Count/PrecountingStrategy.php +++ b/packages/collections-common/src/Count/PrecountingStrategy.php @@ -16,16 +16,16 @@ class PrecountingStrategy implements CountStrategy { /** - * @param int<0,max> $count + * @param ?int<0,max> $count */ - public function __construct(private int &$count) + public function __construct(private ?int &$count) { } #[\Override] public function getCount(?\Countable $underlyingObject): int { - return $this->count; + return $this->count ?? 0; } #[\Override]