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:
parent
06aafa78ad
commit
6107148fce
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user