Skip to content

Commit a1d3990

Browse files
committed
Fix issue with php-metrics that also preloads Php-Parser
1 parent 34edb50 commit a1d3990

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

bin/phpstan

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ use PHPStan\Command\WorkerCommand;
1313

1414
define('__PHPSTAN_RUNNING__', true);
1515

16+
$devOrPharLoader = require_once __DIR__ . '/../vendor/autoload.php';
17+
require_once __DIR__ . '/../preload.php';
18+
$devOrPharLoader->unregister();
19+
1620
$autoloaderInWorkingDirectory = getcwd() . '/vendor/autoload.php';
1721
$composerAutoloaderProjectPaths = [];
1822
if (is_file($autoloaderInWorkingDirectory)) {
@@ -50,16 +54,11 @@ use PHPStan\Command\WorkerCommand;
5054

5155
$autoloadProjectAutoloaderFile('/../../autoload.php');
5256

53-
$devOrPharAutoloadFile = __DIR__ . '/../vendor/autoload.php';
54-
if (is_file($devOrPharAutoloadFile)) {
55-
//$composerAutoloaderProjectPaths[] = dirname($devOrPharAutoloadFile, 2);
56-
require_once $devOrPharAutoloadFile;
57-
}
57+
$devOrPharLoader->register(true);
5858

5959
require_once __DIR__ . '/../vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php';
6060
require_once __DIR__ . '/../vendor/react/promise-timer/src/functions_include.php';
6161
require_once __DIR__ . '/../vendor/react/promise/src/functions_include.php';
62-
require_once __DIR__ . '/../preload.php';
6362

6463
$version = 'Version unknown';
6564
try {

0 commit comments

Comments
 (0)