summaryrefslogtreecommitdiff
path: root/vendor/paragonie/random_compat/lib/cast_to_int.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/paragonie/random_compat/lib/cast_to_int.php')
-rw-r--r--vendor/paragonie/random_compat/lib/cast_to_int.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php
index 9a4fab9919..f97e4349bb 100644
--- a/vendor/paragonie/random_compat/lib/cast_to_int.php
+++ b/vendor/paragonie/random_compat/lib/cast_to_int.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -50,14 +50,16 @@ if (!is_callable('RandomCompat_intval')) {
if (is_int($number) || is_float($number)) {
$number += 0;
} elseif (is_numeric($number)) {
+ /** @psalm-suppress InvalidOperand */
$number += 0;
}
+ /** @var int|float $number */
if (
is_float($number)
- &&
+ &&
$number > ~PHP_INT_MAX
- &&
+ &&
$number < PHP_INT_MAX
) {
$number = (int) $number;