From 4dffdc1d143644345c686f559f0141e012b6a064 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 13 Sep 2026 21:18:21 +0800 Subject: [PATCH] refactor: fix return type covariance of `FileCollection::getIterator()` --- system/Files/FileCollection.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/system/Files/FileCollection.php b/system/Files/FileCollection.php index b293b4d3c08d..b69cfb1d266b 100644 --- a/system/Files/FileCollection.php +++ b/system/Files/FileCollection.php @@ -17,8 +17,8 @@ use CodeIgniter\Files\Exceptions\FileException; use CodeIgniter\Files\Exceptions\FileNotFoundException; use Countable; -use Generator; use IteratorAggregate; +use Traversable; /** * File Collection Class @@ -393,13 +393,12 @@ public function count(): int /** * Yields as an Iterator for the current files. - * Fulfills IteratorAggregate. * - * @return Generator + * @return Traversable * * @throws FileNotFoundException */ - public function getIterator(): Generator + public function getIterator(): Traversable { foreach ($this->get() as $file) { yield new File($file, true);