Skip to content

Commit 5f00868

Browse files
authored
[Bug] Fix finding composer autoload path in binary (#9)
1 parent b1b5d72 commit 5f00868

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bin/mr-linter

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ use Symfony\Component\Console\Application;
99

1010
$loaded = false;
1111

12-
foreach ([$_composer_autoload_path ?? '../../..', '../..', '..', 'vendor', '../vendor', '../../vendor'] as $path) {
13-
if (\is_file($autoload_file = __DIR__ . '/' . $path . '/autoload.php')) {
14-
require $autoload_file;
15-
$loaded = true;
16-
break;
12+
if (isset($_composer_autoload_path)) {
13+
$loaded = true;
14+
15+
require $_composer_autoload_path;
16+
} else {
17+
foreach ([$_composer_autoload_path ?? '../../..', '../..', '..', 'vendor', '../vendor', '../../vendor'] as $path) {
18+
if (\is_file($autoload_file = __DIR__ . '/' . $path . '/autoload.php')) {
19+
require $autoload_file;
20+
$loaded = true;
21+
break;
22+
}
1723
}
1824
}
1925

0 commit comments

Comments
 (0)