Skip to content

Commit

Permalink
There is no pleasing Psalm, so let's just disable this check.
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Mar 3, 2017
1 parent ae8d957 commit 6968531
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cast_to_int.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function RandomCompat_intval($number, $fail_open = false)
if (is_int($number) || is_float($number)) {
$number += 0;
} elseif (is_numeric($number)) {
$number = (int) $number;
$number += 0;
}

if (
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<directory name="lib" />
</projectFiles>
<issueHandlers>
<InvalidOperand errorLevel="info" />
<UndefinedConstant errorLevel="info" />
<MissingReturnType errorLevel="info" />
</issueHandlers>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/RandomIntTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public function testOutput()
$this->assertTrue($integers[6] === 0);
$this->assertTrue($integers[7] >= $half_neg_max && $integers[7] <= PHP_INT_MAX);
$this->assertTrue($integers[8] >= 0 && $integers[8] <= 255);
$this->assertTrue($integers[9] === -4);
$this->assertTrue($integers[10] === 1337000);
$this->assertSame($integers[9], -4);
$this->assertSame($integers[10], 1337000);

try {
$h = random_int("2147483648", "2147483647");
Expand Down

0 comments on commit 6968531

Please sign in to comment.