diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index b51257433..7585d7a9c 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -249,7 +249,7 @@ final class Psalm $options['long-progress'] = true; } - $threads = self::detectThreads($options, $in_ci); + $threads = self::useThreads($options, $in_ci, $config); self::emitMacPcreWarning($options, $threads); @@ -1337,4 +1337,14 @@ 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; + } }