Skip to content

Commit f21e23e

Browse files
committed
Fix bug #16. (first step)
1 parent 14c5665 commit f21e23e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

bin/php-sl.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
exit(1);
1212
}
1313

14-
require_once __DIR__ . '/../vendor/autoload.php';
14+
$autoloadPath = __DIR__ . '/../../../../vendor/autoload.php'; // Path for Composer-installed package as user.
15+
16+
if (!file_exists($autoloadPath)) {
17+
$autoloadPath = __DIR__ . '/../vendor/autoload.php'; // Path for local development.
18+
}
19+
20+
if (!file_exists($autoloadPath)) {
21+
fwrite(STDERR, "Error: Vendor autoload file not found. Run 'composer install'.\n");
22+
exit(1);
23+
}
24+
25+
require_once $autoloadPath;
1526

1627
use Yousha\PhpSecurityLinter\Linter;
1728
use Yousha\PhpSecurityLinter\Exceptions\LinterException;

0 commit comments

Comments
 (0)