Skip to content

Commit

Permalink
Fix psalm issues
Browse files Browse the repository at this point in the history
Signed-off-by: Ion Bazan <[email protected]>
  • Loading branch information
IonBazan committed Dec 20, 2022
1 parent c44aab0 commit 167abf7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Check/CpuPerformance.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static function calcPi($precision)
$limit = ceil(log($precision) / log(2)) - 1;
bcscale($precision + 6);
$a = 1;
$b = bcdiv(1, bcsqrt(2));
$b = bcdiv(1, bcsqrt(2) ?? '0');
$t = 1 / 4;
$p = 1;
for ($n = 0; $n < $limit; $n++) {
Expand Down
3 changes: 2 additions & 1 deletion src/Check/DirReadable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use function get_class;
use function implode;
use function is_array;
use function is_countable;
use function is_dir;
use function is_object;
use function is_readable;
Expand Down Expand Up @@ -90,7 +91,7 @@ public function check()
return new Failure(trim($failureString), ['nonDirs' => $nonDirs, 'unreadable' => $unreadable]);
} else {
return new Success(
count($this->dir) > 1 ? 'All paths are readable directories.' : 'The path is a readable directory.',
is_countable($this->dir) && count($this->dir) > 1 ? 'All paths are readable directories.' : 'The path is a readable directory.',
$this->dir
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Check/DirWritable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use function get_class;
use function implode;
use function is_array;
use function is_countable;
use function is_dir;
use function is_object;
use function is_string;
Expand Down Expand Up @@ -91,7 +92,7 @@ public function check()
return new Failure(trim($failureString), ['nonDirs' => $nonDirs, 'unwritable' => $unwritable]);
} else {
return new Success(
count($this->dir) > 1 ? 'All paths are writable directories.' : 'The path is a writable directory.',
is_countable($this->dir) && count($this->dir) ? 'All paths are writable directories.' : 'The path is a writable directory.',
$this->dir
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Check/ExtensionLoaded.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use function get_class;
use function implode;
use function is_array;
use function is_countable;
use function is_object;
use function is_string;
use function phpversion;
Expand Down Expand Up @@ -72,7 +73,7 @@ public function check()
return new Failure('Extension ' . implode('', $missing) . ' is not available.', $missing);
}
} else {
if (count($this->extensions) > 1) {
if (is_countable($this->extensions) && count($this->extensions) > 1) {
$versions = [];
foreach ($this->extensions as $ext) {
$versions[$ext] = phpversion($ext) ? : 'loaded';
Expand Down

0 comments on commit 167abf7

Please sign in to comment.