Skip to content

Commit 742148e

Browse files
committed
Bug fix: make Phar file run independently of project under scan
This prevents the autoload finder from attempting to load the Composer `autoload.php` file of the project under scan when Parallel Lint is being run from a Phar file. Fixes 61
1 parent 3c5c209 commit 742148e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: parallel-lint

+7
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ $autoloadLocations = array(
4444
__DIR__ . '/../../autoload.php',
4545
);
4646

47+
if (class_exists('Phar') && Phar::running() !== '') {
48+
// Running from a phar file. Prevent loading - potentially blocking - project autoload file.
49+
$autoloadLocations = array(
50+
__DIR__ . '/vendor/autoload.php',
51+
);
52+
}
53+
4754
$loaded = false;
4855
foreach ($autoloadLocations as $autoload) {
4956
if (is_file($autoload)) {

0 commit comments

Comments
 (0)