From 742148e0d194e1ac569899b184b8e8790b48186f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 8 Jun 2021 06:31:00 +0200 Subject: [PATCH] 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 --- parallel-lint | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parallel-lint b/parallel-lint index f44e110..256425c 100755 --- a/parallel-lint +++ b/parallel-lint @@ -44,6 +44,13 @@ $autoloadLocations = array( __DIR__ . '/../../autoload.php', ); +if (class_exists('Phar') && Phar::running() !== '') { + // Running from a phar file. Prevent loading - potentially blocking - project autoload file. + $autoloadLocations = array( + __DIR__ . '/vendor/autoload.php', + ); +} + $loaded = false; foreach ($autoloadLocations as $autoload) { if (is_file($autoload)) {