rector/packages/Testing/Fixture/FixtureFileFinder.php
Tomas Votruba 671f50c702 Updated Rector to commit ee715396945596fffb158ff8278749feb01ea01a
ee71539694 [NodeTypeResolver] Use isScalar()->yes() usage on StaticTypeAnalyzer and ScalarTypeComparator services (#5099)
2023-10-01 01:36:35 +00:00

22 lines
559 B
PHP

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