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

allow psalter to be run without cache (#3063)

This commit is contained in:
orklah 2020-04-03 18:52:18 +02:00 committed by GitHub
parent ecac9d56c0
commit b340f2b0ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,7 @@ $valid_long_options = [
'find-unused-code', 'threads:', 'codeowner:',
'allow-backwards-incompatible-changes:',
'add-newline-between-docblock-annotations:',
'no-cache'
];
// get options from command line
@ -150,6 +151,8 @@ Options:
--add-newline-between-docblock-annotations=BOOL
Whether to add or not add a new line between docblock annotations. Defaults to true.
--no-cache
Runs Psalm without using cache
HELP;
exit;
@ -200,12 +203,18 @@ if ($config->resolve_from_config_file) {
$threads = isset($options['threads']) ? (int)$options['threads'] : 1;
$providers = new Psalm\Internal\Provider\Providers(
new Psalm\Internal\Provider\FileProvider(),
new Psalm\Internal\Provider\ParserCacheProvider($config),
new Psalm\Internal\Provider\FileStorageCacheProvider($config),
new Psalm\Internal\Provider\ClassLikeStorageCacheProvider($config)
);
if (isset($options['no-cache'])) {
$providers = new Psalm\Internal\Provider\Providers(
new Psalm\Internal\Provider\FileProvider()
);
} else {
$providers = new Psalm\Internal\Provider\Providers(
new Psalm\Internal\Provider\FileProvider(),
new Psalm\Internal\Provider\ParserCacheProvider($config),
new Psalm\Internal\Provider\FileStorageCacheProvider($config),
new Psalm\Internal\Provider\ClassLikeStorageCacheProvider($config)
);
}
if (array_key_exists('list-supported-issues', $options)) {
echo implode(',', ProjectAnalyzer::getSupportedIssuesToFix()) . PHP_EOL;