From a1d3990c95b7a064a0451111153a6bef39f5d9a2 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 4 May 2020 07:31:14 +0200 Subject: [PATCH] Fix issue with php-metrics that also preloads Php-Parser --- bin/phpstan | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/phpstan b/bin/phpstan index caaba4e874..b8209b9a44 100755 --- a/bin/phpstan +++ b/bin/phpstan @@ -13,6 +13,10 @@ use PHPStan\Command\WorkerCommand; define('__PHPSTAN_RUNNING__', true); + $devOrPharLoader = require_once __DIR__ . '/../vendor/autoload.php'; + require_once __DIR__ . '/../preload.php'; + $devOrPharLoader->unregister(); + $autoloaderInWorkingDirectory = getcwd() . '/vendor/autoload.php'; $composerAutoloaderProjectPaths = []; if (is_file($autoloaderInWorkingDirectory)) { @@ -50,16 +54,11 @@ use PHPStan\Command\WorkerCommand; $autoloadProjectAutoloaderFile('/../../autoload.php'); - $devOrPharAutoloadFile = __DIR__ . '/../vendor/autoload.php'; - if (is_file($devOrPharAutoloadFile)) { - //$composerAutoloaderProjectPaths[] = dirname($devOrPharAutoloadFile, 2); - require_once $devOrPharAutoloadFile; - } + $devOrPharLoader->register(true); require_once __DIR__ . '/../vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php'; require_once __DIR__ . '/../vendor/react/promise-timer/src/functions_include.php'; require_once __DIR__ . '/../vendor/react/promise/src/functions_include.php'; - require_once __DIR__ . '/../preload.php'; $version = 'Version unknown'; try {