Skip to content

Commit b9bfc66

Browse files
authored
Don't rely on Php-Cs-Fixer's finder, fix compatibility with Php-Cs-Fixer 3.90.0 (#16)
1 parent 36fb7f8 commit b9bfc66

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Fixers.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace ErickSkrauch\PhpCsFixer;
55

66
use IteratorAggregate;
7-
use PhpCsFixer\Finder;
87
use PhpCsFixer\Fixer\FixerInterface;
98
use ReflectionClass;
109
use Traversable;
@@ -18,11 +17,17 @@ final class Fixers implements IteratorAggregate {
1817
* @return \Generator<FixerInterface>
1918
*/
2019
public function getIterator(): Traversable {
21-
$finder = new Finder();
22-
$finder->in(__DIR__ . '/Fixer')->name('*.php');
20+
$filesIterator = new \RecursiveIteratorIterator(
21+
new \RecursiveDirectoryIterator(__DIR__ . '/Fixer', \RecursiveDirectoryIterator::SKIP_DOTS),
22+
);
23+
2324
$classes = [];
24-
/** @var \Symfony\Component\Finder\SplFileInfo $file */
25-
foreach ($finder as $file) {
25+
/** @var \SplFileInfo $file */
26+
foreach ($filesIterator as $file) {
27+
if ($file->getExtension() !== 'php') {
28+
continue;
29+
}
30+
2631
// -4 is set to cut ".php" extension
2732
/** @var class-string<FixerInterface> $class */
2833
$class = __NAMESPACE__ . str_replace('/', '\\', mb_substr($file->getPathname(), mb_strlen(__DIR__), -4));

0 commit comments

Comments
 (0)