Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions bin/docbook-cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,10 @@ declare(strict_types=1);

use DocbookCS\Application;

// Find the Composer autoloader.
(static function (): void {
$candidates = [
__DIR__ . '/../vendor/autoload.php', // installed as project root
__DIR__ . '/../../../autoload.php', // installed as a dependency
];

foreach ($candidates as $file) {
if (!is_file($file)) {
continue;
}

require $file;
return;
spl_autoload_register(static function (string $class): void {
if (str_starts_with($class, 'DocbookCS\\')) {
require __DIR__ . '/../src/' . str_replace('\\', '/', substr($class, 10)) . '.php';
}

fwrite(STDERR, 'Could not find Composer autoloader. Run "composer install" first.' . PHP_EOL);
exit(2);
})();
});

exit(Application::withArguments($argv ?? [])->run());