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:
parent
0d2fc4e774
commit
ebe97c871e
@ -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;
|
||||
|
||||
|
@ -48,4 +48,9 @@ class TestConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getProjectDirectories()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user