rector/packages/Testing/Fixture/FixtureFileFinder.php
Tomas Votruba 7ba32aac1f Updated Rector to commit e12c73eb339a847bcd717025abf5bc43f1cd0e4c
e12c73eb33 [psr-4] Move tests to main namespace, as part of /src and /packages merge - step 2 (#5407)
2024-01-01 00:20:45 +00:00

22 lines
559 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Testing\Fixture;
use Iterator;
use RectorPrefix202401\Symfony\Component\Finder\Finder;
final class FixtureFileFinder
{
/**
* @api used in tests
* @return Iterator<array<int, string>>
*/
public static function yieldDirectory(string $directory, string $suffix = '*.php.inc') : Iterator
{
$finder = (new Finder())->in($directory)->files()->name($suffix)->sortByName();
foreach ($finder as $fileInfo) {
(yield [$fileInfo->getRealPath()]);
}
}
}