Skip to content
Permalink
Browse files

Make tests much faster

  • Loading branch information...
muglug committed May 17, 2019
1 parent 0d2fc4e commit ebe97c871ed674f5d6bfca9f29b97cf2ac295244
Showing with 14 additions and 2 deletions.
  1. +9 −2 src/Psalm/Internal/Provider/StatementsProvider.php
  2. +5 −0 tests/TestConfig.php
@@ -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 @@ public static function parseStatements(
'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 @@ public function getComposerFilePathForClassLike($fq_classlike_name)
{
return false;
}
public function getProjectDirectories()
{
return [];
}
}

0 comments on commit ebe97c8

Please sign in to comment.
You can’t perform that action at this time.