From 8e349c961bb1bcce42190115fabbea4fa734c772 Mon Sep 17 00:00:00 2001 From: ArthurErlich Date: Sun, 12 Jul 2026 23:43:01 +0200 Subject: [PATCH] fix(entity): re-index ContributionCollection constructor arguments array_map() over the variadic constructor can produce non-sequential or string keys, which doesn't match the array property type; re-index with array_values(). Also documents the iterator/count accessors. --- src/Entity/ContributionCollection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Entity/ContributionCollection.php b/src/Entity/ContributionCollection.php index eabbec0..c1ec26e 100644 --- a/src/Entity/ContributionCollection.php +++ b/src/Entity/ContributionCollection.php @@ -14,14 +14,16 @@ final class ContributionCollection implements \IteratorAggregate, \Countable public function __construct(Contribution ...$contributions) { - $this->contributions = $contributions; + $this->contributions = array_values($contributions); } + /** @return \ArrayIterator */ public function getIterator(): \ArrayIterator { return new \ArrayIterator($this->contributions); } + /** Number of contributions held in this collection. */ public function count(): int { return count($this->contributions);