rector/packages/Testing/Fixture/FixtureFileFinder.php
Tomas Votruba aae549741f Updated Rector to commit 0cb3fd0feb464b4568e07607a05c794637aa2862
0cb3fd0feb [Php73] Handle crash Type Error on JsonThrowOnErrorRector (#4626)
2023-08-01 10:55:14 +00:00

21 lines
519 B
PHP

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