Skip to content

Commit

Permalink
fix: check autoload_files.php for existance before inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
alekitto committed Mar 21, 2024
1 parent 3807f6b commit 29131dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Finder/ComposerFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use function array_combine;
use function array_search;
use function class_exists;
use function file_exists;
use function is_array;
use function spl_autoload_functions;

Expand All @@ -31,7 +32,7 @@ final class ComposerFinder implements FinderInterface
private ReflectorFactoryInterface|null $reflectorFactory = null;

/** @var array<string, string> */
private array $files;
private array $files = [];
private bool $useAutoloading = true;

public function __construct(ClassLoader|null $loader = null)
Expand All @@ -43,7 +44,12 @@ public function __construct(ClassLoader|null $loader = null)
return;
}

$files = include $vendorDir . '/composer/autoload_files.php';
$autoloadFilesFn = $vendorDir . '/composer/autoload_files.php';
if (! file_exists($autoloadFilesFn)) {
return;
}

$files = include $autoloadFilesFn;
if (! is_array($files)) {
return;
}
Expand Down

0 comments on commit 29131dc

Please sign in to comment.