1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-19 12:08:50 +01:00

Make tests much faster

This commit is contained in:
Brown 2019-05-17 11:22:34 -04:00
parent 0d2fc4e774
commit ebe97c871e
2 changed files with 14 additions and 2 deletions

View File

@ -48,6 +48,11 @@ class StatementsProvider
*/
private $diff_map = [];
/**
* @var PhpParser\Lexer|null
*/
private static $lexer;
public function __construct(
FileProvider $file_provider,
ParserCacheProvider $parser_cache_provider = null,
@ -343,9 +348,11 @@ class StatementsProvider
'comments', 'startLine', 'startFilePos', 'endFilePos',
];
$lexer = new PhpParser\Lexer([ 'usedAttributes' => $attributes ]);
if (!self::$lexer) {
self::$lexer = new PhpParser\Lexer([ 'usedAttributes' => $attributes ]);
}
$parser = (new PhpParser\ParserFactory())->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer);
$parser = (new PhpParser\ParserFactory())->create(PhpParser\ParserFactory::PREFER_PHP7, self::$lexer);
$used_cached_statements = false;

View File

@ -48,4 +48,9 @@ class TestConfig extends Config
{
return false;
}
public function getProjectDirectories()
{
return [];
}
}