Skip to content

Commit

Permalink
increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
shmax committed Sep 27, 2023
1 parent 9153080 commit ba41a88
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/Validations.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,14 @@ public function validates_format_of(array $attrs): void
}
}

public static function is_range(mixed $var): bool
/**
* @param array<int> $var
*/
public static function is_range(array $var): bool
{
if (!is_array($var) || !is_int($var[0]) || !is_int($var[1])) {
throw new ValidationsArgumentError('Range must be an array of two ints.');
}

if (is_array($var) && (int) $var[0] < (int) $var[1]) {
return true;
}
assert(is_int($var[0]) && is_int($var[1]), new ValidationsArgumentError('Range must be an array of two ints.'));

Check failure on line 430 in lib/Validations.php

View workflow job for this annotation

GitHub Actions / PHPStan

Result of && is always true.

return false;
return is_array($var) && (int) $var[0] < (int) $var[1];
}

/**
Expand Down

0 comments on commit ba41a88

Please sign in to comment.