1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #242 - add --no-cache option

This commit is contained in:
Matthew Brown 2017-10-13 21:27:20 -04:00
parent 6c1587d4ab
commit 00aaa4adaf
2 changed files with 41 additions and 2 deletions

View File

@ -18,7 +18,7 @@ $options = getopt(
'help', 'debug', 'config:', 'monochrome', 'show-info:', 'diff',
'file:', 'self-check', 'update-docblocks', 'output-format:',
'find-dead-code', 'init', 'find-references-to:', 'root:', 'threads:',
'report:', 'clear-cache',
'report:', 'clear-cache', 'no-cache',
]
);
@ -99,6 +99,9 @@ Options:
--clear-cache
Clears all cache files that Psalm uses
--no-cache
Runs Psalm without using cache
HELP;
exit;
@ -319,9 +322,13 @@ $update_docblocks = isset($options['update-docblocks']);
$threads = isset($options['threads']) ? (int)$options['threads'] : 1;
$cache_provider = isset($options['no-cache'])
? new Psalm\Provider\Cache\NoCacheProvider()
: new Psalm\Provider\CacheProvider();
$project_checker = new ProjectChecker(
new Psalm\Provider\FileProvider(),
new Psalm\Provider\CacheProvider(),
$cache_provider,
$use_color,
$show_info,
$output_format,

View File

@ -0,0 +1,32 @@
<?php
namespace Psalm\Provider\Cache;
use PhpParser;
class NoCacheProvider extends \Psalm\Provider\CacheProvider
{
/**
* @param string $file_path
* @param string $file_content_hash
* @param string $file_cache_key
* @param mixed $file_modified_time
*
* @return array<int, PhpParser\Node\Stmt>|null
*/
public function loadStatementsFromCache($file_path, $file_modified_time, $file_content_hash, $file_cache_key)
{
return null;
}
/**
* @param string $file_cache_key
* @param string $file_content_hash
* @param array<int, PhpParser\Node\Stmt> $stmts
* @param bool $touch_only
*
* @return void
*/
public function saveStatementsToCache($file_cache_key, $file_content_hash, array $stmts, $touch_only)
{
}
}