From 6a889d87cf5731279da526ff9b1b4d7f849f173c Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 8 Dec 2024 10:46:15 +0100 Subject: [PATCH] Document assumption that we have a Directory object --- src/Node/Iterator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Node/Iterator.php b/src/Node/Iterator.php index b110d4679..2861db664 100644 --- a/src/Node/Iterator.php +++ b/src/Node/Iterator.php @@ -9,6 +9,7 @@ */ namespace SebastianBergmann\CodeCoverage\Node; +use function assert; use function count; use RecursiveIterator; @@ -74,6 +75,8 @@ public function next(): void */ public function getChildren(): self { + assert($this->nodes[$this->position] instanceof Directory); + return new self($this->nodes[$this->position]); }