Closed
Description
Symfony version(s) affected
any / latest
Description
in phpstan/phpstan-src@da56f5b#diff-d2a02971e55cfbdc9f9994aea2bebd84108382ab5628b662d1f35ec2a70fbe3fR206 you can see the individual FS calls done by Symfony Finder
currently, it opens the initial directory twice, which costs some extra CPU time
How to reproduce
see phpstan/phpstan-src@f3b86c3#diff-87cf61100cce8074792c993360180be397a8325612856338be61c41eeb60389dR83
basically simple and typical usage:
<?php declare(strict_types = 1);
use Symfony\Component\Finder\Finder;
$path = __DIR__ . '/some_dir';
$fileExtensions = ['php', 'phpt'];
$finder = (new Finder())
->in($path)
->followLinks()
->files()
->name('*.{' . implode(',', $fileExtensions) . '}');
Possible Solution
No response
Additional Context
IO is especially slow on Windows