diff options
author | Paragon Initiative Enterprises <security@paragonie.com> | 2017-03-03 15:43:42 -0500 |
---|---|---|
committer | Paragon Initiative Enterprises <security@paragonie.com> | 2017-03-03 15:43:42 -0500 |
commit | 6968531206671f94377b01dc7888d5d1b858a01b (patch) | |
tree | 25632ed1465049fda2d7cbfc2c74a95aaf2bae03 | |
parent | ae8d9579494c22cb0fecb7f8c3e2a43724220810 (diff) | |
download | random_compat-2.0.9.zip random_compat-2.0.9.tar.gz random_compat-2.0.9.tar.bz2 |
There is no pleasing Psalm, so let's just disable this check.v2.0.9
-rw-r--r-- | lib/cast_to_int.php | 2 | ||||
-rw-r--r-- | psalm.xml | 1 | ||||
-rw-r--r-- | tests/unit/RandomIntTest.php | 4 |
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/cast_to_int.php b/lib/cast_to_int.php index 138a025..5a57a55 100644 --- a/lib/cast_to_int.php +++ b/lib/cast_to_int.php @@ -49,7 +49,7 @@ if (!is_callable('RandomCompat_intval')) { if (is_int($number) || is_float($number)) { $number += 0; } elseif (is_numeric($number)) { - $number = (int) $number; + $number += 0; } if ( @@ -8,6 +8,7 @@ <directory name="lib" /> </projectFiles> <issueHandlers> + <InvalidOperand errorLevel="info" /> <UndefinedConstant errorLevel="info" /> <MissingReturnType errorLevel="info" /> </issueHandlers> diff --git a/tests/unit/RandomIntTest.php b/tests/unit/RandomIntTest.php index dd96e81..c8cbb0d 100644 --- a/tests/unit/RandomIntTest.php +++ b/tests/unit/RandomIntTest.php @@ -33,8 +33,8 @@ class RandomIntTest extends PHPUnit_Framework_TestCase $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"); |