1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
psalm/tests/TestConfig.php
LeSuisse f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00

59 lines
1.5 KiB
PHP

<?php
namespace Psalm\Tests;
use Psalm\Config;
use function getcwd;
use const DIRECTORY_SEPARATOR;
class TestConfig extends Config
{
/** @var Config\ProjectFileFilter|null */
private static $cached_project_files = null;
/**
* @psalm-suppress PossiblyNullPropertyAssignmentValue because cache_directory isn't strictly nullable
*/
public function __construct()
{
parent::__construct();
$this->throw_exception = true;
$this->use_docblock_types = true;
$this->totally_typed = true;
$this->cache_directory = null;
$this->base_dir = getcwd() . DIRECTORY_SEPARATOR;
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;
$this->collectPredefinedConstants();
$this->collectPredefinedFunctions();
}
public function getComposerFilePathForClassLike($fq_classlike_name)
{
return false;
}
public function getProjectDirectories()
{
return [];
}
}