diff options
Diffstat (limited to 'vendor/brick/math/src/BigInteger.php')
-rw-r--r-- | vendor/brick/math/src/BigInteger.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/vendor/brick/math/src/BigInteger.php b/vendor/brick/math/src/BigInteger.php index cee3ce82b..0dcc8f3b3 100644 --- a/vendor/brick/math/src/BigInteger.php +++ b/vendor/brick/math/src/BigInteger.php @@ -217,6 +217,8 @@ final class BigInteger extends BigNumber * * Using the default random bytes generator, this method is suitable for cryptographic use. * + * @psalm-param callable(int): string $randomBytesGenerator + * * @param int $numBits The number of bits. * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a * string of random bytes of the given length. Defaults to the @@ -256,6 +258,8 @@ final class BigInteger extends BigNumber * * Using the default random bytes generator, this method is suitable for cryptographic use. * + * @psalm-param (callable(int): string)|null $randomBytesGenerator + * * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, @@ -300,7 +304,10 @@ final class BigInteger extends BigNumber */ public static function zero() : BigInteger { - /** @psalm-suppress ImpureStaticVariable */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $zero + */ static $zero; if ($zero === null) { @@ -319,7 +326,10 @@ final class BigInteger extends BigNumber */ public static function one() : BigInteger { - /** @psalm-suppress ImpureStaticVariable */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $one + */ static $one; if ($one === null) { @@ -338,7 +348,10 @@ final class BigInteger extends BigNumber */ public static function ten() : BigInteger { - /** @psalm-suppress ImpureStaticVariable */ + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $ten + */ static $ten; if ($ten === null) { @@ -1070,7 +1083,10 @@ final class BigInteger extends BigNumber if ($signed) { if ($this->isNegative()) { - $hex = \bin2hex(~\hex2bin($hex)); + $bin = \hex2bin($hex); + assert($bin !== false); + + $hex = \bin2hex(~$bin); $hex = self::fromBase($hex, 16)->plus(1)->toBase(16); $hexLength = \strlen($hex); @@ -1116,6 +1132,7 @@ final class BigInteger extends BigNumber * This method is only here to implement interface Serializable and cannot be accessed directly. * * @internal + * @psalm-suppress RedundantPropertyInitializationCheck * * @param string $value * |