Skip to content

Commit 4dffdc1

Browse files
committed
refactor: fix return type covariance of FileCollection::getIterator()
1 parent de66f3f commit 4dffdc1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎system/Files/FileCollection.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
use CodeIgniter\Files\Exceptions\FileException;
1818
use CodeIgniter\Files\Exceptions\FileNotFoundException;
1919
use Countable;
20-
use Generator;
2120
use IteratorAggregate;
21+
use Traversable;
2222

2323
/**
2424
* File Collection Class
@@ -393,13 +393,12 @@ public function count(): int
393393

394394
/**
395395
* Yields as an Iterator for the current files.
396-
* Fulfills IteratorAggregate.
397396
*
398-
* @return Generator<File>
397+
* @return Traversable<int, File>
399398
*
400399
* @throws FileNotFoundException
401400
*/
402-
public function getIterator(): Generator
401+
public function getIterator(): Traversable
403402
{
404403
foreach ($this->get() as $file) {
405404
yield new File($file, true);

0 commit comments

Comments
 (0)