diff options
author | Hilmar R <u02@u29lx193> | 2021-02-28 21:06:16 +0100 |
---|---|---|
committer | Hilmar R <u02@u29lx193> | 2021-03-01 18:48:11 +0100 |
commit | c26dede97f626b52b7bf8962ed55d1dbda86abe8 (patch) | |
tree | 3c8c9bc97aa09f7ce9afe9bf467cf87bbf2c7d0b /vendor/brick/math/src/BigInteger.php | |
parent | ea3390d626f85b7293a750958bfd1b5460958365 (diff) | |
download | volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.gz volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.bz2 volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.zip |
get dev
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 * |