// Created on savesnippets.com ยท https://savesnippets.com/45Pzfh8KL7msRP isFile()) continue; if ($filter && !$filter($file)) continue; yield $file->getPathname(); } } // Every .php file under src/ foreach (walkFiles('src/', fn($f) => $f->getExtension() === 'php') as $path) { echo $path, PHP_EOL; }