2016-12-14 18:28:38 +01:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Tests;
|
|
|
|
|
2019-06-26 22:52:29 +02:00
|
|
|
use const DIRECTORY_SEPARATOR;
|
2019-07-05 22:24:00 +02:00
|
|
|
use function getcwd;
|
|
|
|
use Psalm\Config;
|
2016-12-14 18:28:38 +01:00
|
|
|
|
|
|
|
class TestConfig extends Config
|
|
|
|
{
|
2019-04-29 20:05:43 +02:00
|
|
|
/** @var Config\ProjectFileFilter|null */
|
|
|
|
private static $cached_project_files = null;
|
|
|
|
|
2016-12-20 18:29:52 +01:00
|
|
|
/**
|
2018-01-10 16:56:43 +01:00
|
|
|
* @psalm-suppress PossiblyNullPropertyAssignmentValue because cache_directory isn't strictly nullable
|
2016-12-20 18:29:52 +01:00
|
|
|
*/
|
2016-12-14 18:28:38 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
2016-12-19 01:00:32 +01:00
|
|
|
|
|
|
|
$this->throw_exception = true;
|
|
|
|
$this->use_docblock_types = true;
|
2016-12-19 01:17:39 +01:00
|
|
|
$this->totally_typed = true;
|
2016-12-20 18:29:52 +01:00
|
|
|
$this->cache_directory = null;
|
2017-04-03 18:36:49 +02:00
|
|
|
|
2017-07-25 23:04:58 +02:00
|
|
|
$this->base_dir = getcwd() . DIRECTORY_SEPARATOR;
|
|
|
|
|
2019-04-29 20:05:43 +02:00
|
|
|
if (!self::$cached_project_files) {
|
|
|
|
self::$cached_project_files = Config\ProjectFileFilter::loadFromXMLElement(
|
|
|
|
new \SimpleXMLElement(
|
|
|
|
'<?xml version="1.0"?>
|
|
|
|
<projectFiles>
|
|
|
|
<directory name="src" />
|
|
|
|
<ignoreFiles>
|
|
|
|
<directory name="src/Psalm/Internal/Stubs" />
|
|
|
|
</ignoreFiles>
|
|
|
|
</projectFiles>'
|
|
|
|
),
|
|
|
|
$this->base_dir,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->project_files = self::$cached_project_files;
|
2017-07-25 23:04:58 +02:00
|
|
|
|
2017-04-03 18:36:49 +02:00
|
|
|
$this->collectPredefinedConstants();
|
|
|
|
$this->collectPredefinedFunctions();
|
2016-12-14 18:28:38 +01:00
|
|
|
}
|
2018-03-03 21:25:35 +01:00
|
|
|
|
|
|
|
public function getComposerFilePathForClassLike($fq_classlike_name)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2019-05-17 17:22:34 +02:00
|
|
|
|
|
|
|
public function getProjectDirectories()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
2016-12-14 18:28:38 +01:00
|
|
|
}
|