You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
composer/phpstan/locate-phpunit-autoloader.php

23 lines
563 B
PHP

<?php
$bestDirFound = null;
$dirs = glob(__DIR__.'/../vendor/bin/.phpunit/phpunit-*', GLOB_ONLYDIR);
natsort($dirs);
foreach (array_reverse($dirs) as $dir) {
$bestDirFound = $dir;
if (PHP_VERSION_ID >= 80000 && false !== strpos($dir, 'phpunit-9')) {
break;
}
if (PHP_VERSION_ID < 80000 && false !== strpos($dir, 'phpunit-8')) {
break;
}
}
if (null === $bestDirFound) {
echo 'Run "composer test" to initialize PHPUnit sources before running PHPStan'.PHP_EOL;
exit(1);
}
include $bestDirFound.'/vendor/autoload.php';