-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan-autoload.php
42 lines (34 loc) · 1.27 KB
/
phpstan-autoload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
$getEnvVar = static function ($name, $default = false) {
if (false !== $value = getenv($name)) {
return $value;
}
static $phpunitConfig = null;
if (null === $phpunitConfig) {
$phpunitConfigFilename = null;
if (file_exists('phpunit.xml')) {
$phpunitConfigFilename = 'phpunit.xml';
} elseif (file_exists('phpunit.xml.dist')) {
$phpunitConfigFilename = 'phpunit.xml.dist';
}
$phpunitConfig = false;
if ($phpunitConfigFilename) {
$phpunitConfig = new DOMDocument();
$phpunitConfig->load($phpunitConfigFilename);
}
}
if (false !== $phpunitConfig) {
$var = new DOMXPath($phpunitConfig);
foreach ($var->query('//php/server[@name="'.$name.'"]') as $var) {
return $var->getAttribute('value');
}
foreach ($var->query('//php/env[@name="'.$name.'"]') as $var) {
return $var->getAttribute('value');
}
}
return $default;
};
$SYMFONY_PHPUNIT_DIR = $getEnvVar('SYMFONY_PHPUNIT_DIR', __DIR__.'/vendor/bin/.phpunit');
$SYMFONY_PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION');
require "$SYMFONY_PHPUNIT_DIR/phpunit-$SYMFONY_PHPUNIT_VERSION-0/vendor/autoload.php";