From bb1bdb84181402a1d5809e2bb2ed5e9dde84a4f0 Mon Sep 17 00:00:00 2001 From: connor Date: Thu, 4 Apr 2024 16:22:03 +0200 Subject: [PATCH] support both git clone (development) and composer way autoload locations --- lib/command/cli.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/command/cli.php b/lib/command/cli.php index 986ff4c43..c68d64868 100644 --- a/lib/command/cli.php +++ b/lib/command/cli.php @@ -8,18 +8,16 @@ * file that was distributed with this source code. */ -require_once __DIR__.'/../../vendor/autoload.php'; +$composerAutoloadLocations = [ + __DIR__.'/../../../../autoload.php', + __DIR__.'/../../vendor/autoload.php', +]; // Try autoloading using composer if available. -if (!file_exists($autoload = __DIR__.'/../../../../autoload.php')) { - $autoload = __DIR__.'/../../autoload.php'; -} - -// Fall back to classic Symfony loading -if (!file_exists($autoload)) { - sfCoreAutoload::register(); -} else { - require_once $autoload; +foreach ($composerAutoloadLocations as $composerAutoloadLocation) { + if (file_exists($composerAutoloadLocation) && is_readable($composerAutoloadLocation)) { + require_once $composerAutoloadLocation; + } } try {