Fix to make Symfony Finder component optional (#267)
This commit is contained in:
parent
85fddf5f0f
commit
ea38ef7b62
1 changed files with 17 additions and 3 deletions
|
|
@ -46,6 +46,7 @@ use Psr\EventDispatcher\EventDispatcherInterface;
|
|||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
/**
|
||||
* @phpstan-import-type Handler from ElementReference
|
||||
|
|
@ -523,8 +524,12 @@ final class Builder
|
|||
);
|
||||
|
||||
if (null !== $this->discoveryBasePath) {
|
||||
$discoverer = $this->discoverer ?? $this->createDiscoverer($logger);
|
||||
$loaders[] = new DiscoveryLoader($this->discoveryBasePath, $this->discoveryScanDirs, $this->discoveryExcludeDirs, $discoverer);
|
||||
if (null !== $this->discoverer || class_exists(Finder::class)) {
|
||||
$discoverer = $this->discoverer ?? $this->createDiscoverer($logger);
|
||||
$loaders[] = new DiscoveryLoader($this->discoveryBasePath, $this->discoveryScanDirs, $this->discoveryExcludeDirs, $discoverer);
|
||||
} else {
|
||||
$logger->warning('File-based discovery requires symfony/finder. Skipping automatic discovery. Run: composer require symfony/finder');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($loaders as $loader) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue