Skip to content

Commit

Permalink
fix psalm-internal risky casts
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Sep 15, 2022
1 parent 0ca91f8 commit 4e1a654
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Cli/LanguageServer.php
Expand Up @@ -298,7 +298,7 @@ function () use ($current_dir, $options, $vendor_dir): ?\Composer\Autoload\Class
$find_unused_code = 'auto';
}

if (isset($options['disable-on-change'])) {
if (isset($options['disable-on-change']) && is_numeric($options['disable-on-change'])) {
$project_analyzer->onchange_line_limit = (int) $options['disable-on-change'];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Cli/Psalter.php
Expand Up @@ -230,7 +230,7 @@ function () use ($current_dir, $options, $vendor_dir): ?\Composer\Autoload\Class
chdir($current_dir);
}

$threads = isset($options['threads']) ? (int)$options['threads'] : 1;
$threads = isset($options['threads']) && is_numeric($options['threads']) ? (int)$options['threads'] : 1;

if (isset($options['no-cache'])) {
$providers = new Providers(
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Cli/Refactor.php
Expand Up @@ -284,7 +284,7 @@ function () use ($current_dir, $options, $vendor_dir): ?\Composer\Autoload\Class
chdir($current_dir);
}

$threads = isset($options['threads'])
$threads = isset($options['threads']) && is_numeric($options['threads'])
? (int)$options['threads']
: max(1, ProjectAnalyzer::getCpuCount() - 2);

Expand Down

0 comments on commit 4e1a654

Please sign in to comment.