rector/packages/Testing/Fixture/FixtureFileFinder.php
Tomas Votruba 184cf49468 Updated Rector to commit f9de5d311e7e69d1ad2cb5f3087970d8b9335920
f9de5d311e [Php80] Handle RenameClassRector+AnnotationToAttributeRector with auto import and existing attribute defined (#5219)
2023-11-02 03:20:18 +00:00

22 lines
559 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Testing\Fixture;
use Iterator;
use RectorPrefix202311\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()]);
}
}
}