X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fparagonie%2Frandom_compat%2Flib%2Fcast_to_int.php;h=f97e4349bb209c9cff434ba585df27f239f76ed7;hb=4e1bfbf98b844da83b18aca92ef00f11a4735806;hp=be7388dfd3b801d8e2ac16c5c495e43cd37fabf9;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php index be7388dfd..f97e4349b 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 @@ -38,9 +38,10 @@ if (!is_callable('RandomCompat_intval')) { * through. * * @param int|float $number The number we want to convert to an int - * @param boolean $fail_open Set to true to not throw an exception + * @param bool $fail_open Set to true to not throw an exception * * @return float|int + * @psalm-suppress InvalidReturnType * * @throws TypeError */ @@ -49,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;