1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Alter order of precedence and upated docs to match

This commit is contained in:
m1ke 2022-01-20 15:24:21 +00:00
parent 06aafa78ad
commit 6107148fce
2 changed files with 5 additions and 15 deletions

View File

@ -402,8 +402,7 @@ Allows you to hard-code a serializer for Psalm to use when caching data. By defa
threads="[int]"
>
```
Allows you to hard-code the number of threads Psalm will use (similar to `--threads` on the command line). This value will only be applied if it is lower than the number of threads Psalm would natively use (i.e. you cannot override other settings that force threads=1 or utilise more threads than detected on the machine)
Allows you to hard-code the number of threads Psalm will use (similar to `--threads` on the command line). This value will be used in place of detecting threads from the host machine, but will be overridden by using `--threads` or `--debug` (which sets threads to 1) on the command line
## Project settings

View File

@ -249,7 +249,7 @@ final class Psalm
$options['long-progress'] = true;
}
$threads = self::useThreads($options, $in_ci, $config);
$threads = self::detectThreads($options, $config, $in_ci);
self::emitMacPcreWarning($options, $threads);
@ -913,12 +913,14 @@ final class Psalm
}
}
private static function detectThreads(array $options, bool $in_ci): int
private static function detectThreads(array $options, Config $config, bool $in_ci): int
{
if (isset($options['threads'])) {
$threads = (int)$options['threads'];
} elseif (isset($options['debug']) || $in_ci) {
$threads = 1;
} elseif ($config->threads) {
$threads = $config->threads;
} else {
$threads = max(1, ProjectAnalyzer::getCpuCount() - 1);
}
@ -1337,15 +1339,4 @@ final class Psalm
HELP;
}
private static function useThreads(array $options, bool $in_ci, Config $config): int
{
$threads = self::detectThreads($options, $in_ci);
if ($config->threads && $config->threads<$threads) {
$threads = $config->threads;
}
return $threads;
}
}