diff options
author | Mario <mario@mariovavti.com> | 2022-10-11 18:29:06 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-10-11 18:29:06 +0000 |
commit | ccd826f63a7a4c7e442fab8a70d9c4c84808b417 (patch) | |
tree | fbbde69114acba764cf6b735433c53e099fd19c5 /vendor/brick/math/src | |
parent | 5e5f0aa955d86743a14531bed98501b59140ab1f (diff) | |
download | volse-hubzilla-ccd826f63a7a4c7e442fab8a70d9c4c84808b417.tar.gz volse-hubzilla-ccd826f63a7a4c7e442fab8a70d9c4c84808b417.tar.bz2 volse-hubzilla-ccd826f63a7a4c7e442fab8a70d9c4c84808b417.zip |
Revert "update composer libs"
This reverts commit 5e5f0aa955d86743a14531bed98501b59140ab1f.
Diffstat (limited to 'vendor/brick/math/src')
-rw-r--r-- | vendor/brick/math/src/BigDecimal.php | 8 | ||||
-rw-r--r-- | vendor/brick/math/src/BigInteger.php | 19 | ||||
-rw-r--r-- | vendor/brick/math/src/BigNumber.php | 4 | ||||
-rw-r--r-- | vendor/brick/math/src/BigRational.php | 11 | ||||
-rw-r--r-- | vendor/brick/math/src/Internal/Calculator.php | 35 | ||||
-rw-r--r-- | vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php | 6 | ||||
-rw-r--r-- | vendor/brick/math/src/Internal/Calculator/NativeCalculator.php | 4 |
7 files changed, 48 insertions, 39 deletions
diff --git a/vendor/brick/math/src/BigDecimal.php b/vendor/brick/math/src/BigDecimal.php index fd2babb86..78246500c 100644 --- a/vendor/brick/math/src/BigDecimal.php +++ b/vendor/brick/math/src/BigDecimal.php @@ -22,15 +22,19 @@ final class BigDecimal extends BigNumber * This is a string of digits with an optional leading minus sign. * No leading zero must be present. * No leading minus sign must be present if the value is 0. + * + * @var string */ - private string $value; + private $value; /** * The scale (number of digits after the decimal point) of this decimal number. * * This must be zero or more. + * + * @var int */ - private int $scale; + private $scale; /** * Protected constructor. Use a factory method to obtain an instance. diff --git a/vendor/brick/math/src/BigInteger.php b/vendor/brick/math/src/BigInteger.php index f58e1c595..f213fbedb 100644 --- a/vendor/brick/math/src/BigInteger.php +++ b/vendor/brick/math/src/BigInteger.php @@ -26,8 +26,10 @@ final class BigInteger extends BigNumber * * No leading zeros must be present. * No leading minus sign must be present if the number is zero. + * + * @var string */ - private string $value; + private $value; /** * Protected constructor. Use a factory method to obtain an instance. @@ -359,21 +361,6 @@ final class BigInteger extends BigNumber return $ten; } - public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger - { - $result = $a; - - foreach ($n as $next) { - $result = $result->gcd($next); - - if ($result->isEqualTo(1)) { - return $result; - } - } - - return $result; - } - /** * Returns the sum of this number and the given one. * diff --git a/vendor/brick/math/src/BigNumber.php b/vendor/brick/math/src/BigNumber.php index 44f26e35a..38c8c554e 100644 --- a/vendor/brick/math/src/BigNumber.php +++ b/vendor/brick/math/src/BigNumber.php @@ -81,7 +81,9 @@ abstract class BigNumber implements \Serializable, \JsonSerializable $throw(); } - $getMatch = static fn(string $value): ?string => (($matches[$value] ?? '') !== '') ? $matches[$value] : null; + $getMatch = static function(string $value) use ($matches) : ?string { + return isset($matches[$value]) && $matches[$value] !== '' ? $matches[$value] : null; + }; $sign = $getMatch('sign'); $numerator = $getMatch('numerator'); diff --git a/vendor/brick/math/src/BigRational.php b/vendor/brick/math/src/BigRational.php index 46257814d..bee094f73 100644 --- a/vendor/brick/math/src/BigRational.php +++ b/vendor/brick/math/src/BigRational.php @@ -20,13 +20,17 @@ final class BigRational extends BigNumber { /** * The numerator. + * + * @var BigInteger */ - private BigInteger $numerator; + private $numerator; /** * The denominator. Always strictly positive. + * + * @var BigInteger */ - private BigInteger $denominator; + private $denominator; /** * Protected constructor. Use a factory method to obtain an instance. @@ -429,8 +433,7 @@ final class BigRational extends BigNumber */ public function toFloat() : float { - $simplified = $this->simplified(); - return $simplified->numerator->toFloat() / $simplified->denominator->toFloat(); + return $this->numerator->toFloat() / $this->denominator->toFloat(); } /** diff --git a/vendor/brick/math/src/Internal/Calculator.php b/vendor/brick/math/src/Internal/Calculator.php index 99bebbe5d..a6eac799f 100644 --- a/vendor/brick/math/src/Internal/Calculator.php +++ b/vendor/brick/math/src/Internal/Calculator.php @@ -34,8 +34,10 @@ abstract class Calculator /** * The Calculator instance in use. + * + * @var Calculator|null */ - private static ?Calculator $instance = null; + private static $instance; /** * Sets the Calculator instance to use. @@ -232,7 +234,7 @@ abstract class Calculator * @param string $a The dividend. * @param string $b The divisor, must not be zero. * - * @return array{string, string} An array containing the quotient and remainder. + * @return string[] An array containing the quotient and remainder. */ abstract public function divQR(string $a, string $b) : array; @@ -281,7 +283,9 @@ abstract class Calculator $modVal = $this->mod($x, $m); } - [$g, $x] = $this->gcdExtended($modVal, $m); + $x = '0'; + $y = '0'; + $g = $this->gcdExtended($modVal, $m, $x, $y); if ($g !== '1') { return null; @@ -325,21 +329,24 @@ abstract class Calculator return $this->gcd($b, $this->divR($a, $b)); } - /** - * @return array{string, string, string} GCD, X, Y - */ - private function gcdExtended(string $a, string $b) : array + private function gcdExtended(string $a, string $b, string &$x, string &$y) : string { if ($a === '0') { - return [$b, '0', '1']; + $x = '0'; + $y = '1'; + + return $b; } - [$gcd, $x1, $y1] = $this->gcdExtended($this->mod($b, $a), $a); + $x1 = '0'; + $y1 = '0'; + + $gcd = $this->gcdExtended($this->mod($b, $a), $a, $x1, $y1); $x = $this->sub($y1, $this->mul($this->divQ($b, $a), $x1)); $y = $x1; - return [$gcd, $x, $y]; + return $gcd; } /** @@ -486,8 +493,6 @@ abstract class Calculator * * @throws \InvalidArgumentException If the rounding mode is invalid. * @throws RoundingNecessaryException If RoundingMode::UNNECESSARY is provided but rounding is necessary. - * - * @psalm-suppress ImpureFunctionCall */ final public function divRound(string $a, string $b, int $roundingMode) : string { @@ -611,9 +616,9 @@ abstract class Calculator /** * Performs a bitwise operation on a decimal number. * - * @param 'and'|'or'|'xor' $operator The operator to use. - * @param string $a The left operand. - * @param string $b The right operand. + * @param string $operator The operator to use, must be "and", "or" or "xor". + * @param string $a The left operand. + * @param string $b The right operand. * * @return string */ diff --git a/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php b/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php index 34078687d..6632b378a 100644 --- a/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php +++ b/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php @@ -94,6 +94,9 @@ class BcMathCalculator extends Calculator /** * {@inheritdoc} + * + * @psalm-suppress InvalidNullableReturnType + * @psalm-suppress NullableReturnStatement */ public function modPow(string $base, string $exp, string $mod) : string { @@ -102,6 +105,9 @@ class BcMathCalculator extends Calculator /** * {@inheritDoc} + * + * @psalm-suppress NullableReturnStatement + * @psalm-suppress InvalidNullableReturnType */ public function sqrt(string $n) : string { diff --git a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php index a7eb23b90..020a6338b 100644 --- a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php +++ b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php @@ -22,8 +22,10 @@ class NativeCalculator extends Calculator * For addition, it is assumed that an extra digit can hold a carry (1) without overflowing. * Example: 32-bit: max number 1,999,999,999 (9 digits + carry) * 64-bit: max number 1,999,999,999,999,999,999 (18 digits + carry) + * + * @var int */ - private int $maxDigits; + private $maxDigits; /** * Class constructor. |