From 6bad45c016d9b10445a623d78e3f08664b86018d Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Mon, 21 Feb 2022 18:56:19 -0600 Subject: [PATCH] Psalm coverage for phpseclib3\Math\ --- phpseclib/Math/BigInteger.php | 8 ++++---- phpseclib/Math/BigInteger/Engines/BCMath.php | 10 +++++----- .../Math/BigInteger/Engines/BCMath/Base.php | 8 ++++---- .../Engines/BCMath/Reductions/Barrett.php | 2 +- phpseclib/Math/BigInteger/Engines/GMP.php | 16 ++++++++-------- phpseclib/Math/BigInteger/Engines/PHP.php | 8 ++++---- phpseclib/Math/BigInteger/Engines/PHP/Base.php | 8 ++++---- .../Engines/PHP/Reductions/Barrett.php | 3 ++- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php index 564c8992..9365d5cf 100644 --- a/phpseclib/Math/BigInteger.php +++ b/phpseclib/Math/BigInteger.php @@ -793,7 +793,7 @@ class BigInteger /** * Is Odd? * - * @return boolean + * @return bool */ public function isOdd() { @@ -804,7 +804,7 @@ class BigInteger * Tests if a bit is set * * @param int $x - * @return boolean + * @return bool */ public function testBit($x) { @@ -814,7 +814,7 @@ class BigInteger /** * Is Negative? * - * @return boolean + * @return bool */ public function isNegative() { @@ -869,7 +869,7 @@ class BigInteger * Splits BigInteger's into chunks of $split bits * * @param int $split - * @return \phpseclib3\Math\BigInteger[] + * @return BigInteger[] */ public function bitwise_split($split) { diff --git a/phpseclib/Math/BigInteger/Engines/BCMath.php b/phpseclib/Math/BigInteger/Engines/BCMath.php index 5d6e9507..cc3ff79e 100644 --- a/phpseclib/Math/BigInteger/Engines/BCMath.php +++ b/phpseclib/Math/BigInteger/Engines/BCMath.php @@ -237,7 +237,7 @@ class BCMath extends Engine * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * - * @param \phpseclib3\Math\BigInteger\Engines\BCMath $n + * @param BCMath $n * @return false|BCMath */ public function modInverse(BCMath $n) @@ -311,7 +311,7 @@ class BCMath extends Engine /** * Absolute value. * - * @return \phpseclib3\Math\BigInteger\Engines\BCMath + * @return BCMath */ public function abs() { @@ -362,7 +362,7 @@ class BCMath extends Engine * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift - * @return \phpseclib3\Math\BigInteger\Engines\BCMath + * @return BCMath */ public function bitwise_rightShift($shift) { @@ -378,7 +378,7 @@ class BCMath extends Engine * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift - * @return \phpseclib3\Math\BigInteger\Engines\BCMath + * @return BCMath */ public function bitwise_leftShift($shift) { @@ -672,7 +672,7 @@ class BCMath extends Engine /** * Is Negative? * - * @return boolean + * @return bool */ public function isNegative() { diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Base.php b/phpseclib/Math/BigInteger/Engines/BCMath/Base.php index 1f7cdf53..d0f2ab22 100644 --- a/phpseclib/Math/BigInteger/Engines/BCMath/Base.php +++ b/phpseclib/Math/BigInteger/Engines/BCMath/Base.php @@ -54,11 +54,11 @@ abstract class Base extends BCMath /** * Performs modular exponentiation. * - * @param \phpseclib3\Math\BigInteger\Engines\BCMath $x - * @param \phpseclib3\Math\BigInteger\Engines\BCMath $e - * @param \phpseclib3\Math\BigInteger\Engines\BCMath $n + * @param BCMath $x + * @param BCMath $e + * @param BCMath $n * @param string $class - * @return \phpseclib3\Math\BigInteger\Engines\BCMath + * @return BCMath */ protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n, $class) { diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php index 31d8272c..1ec206c4 100644 --- a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php +++ b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php @@ -61,7 +61,7 @@ abstract class Barrett extends Base * * @param string $n * @param string $m - * @return array|string + * @return string */ protected static function reduce($n, $m) { diff --git a/phpseclib/Math/BigInteger/Engines/GMP.php b/phpseclib/Math/BigInteger/Engines/GMP.php index e6cc3751..fc613f3e 100644 --- a/phpseclib/Math/BigInteger/Engines/GMP.php +++ b/phpseclib/Math/BigInteger/Engines/GMP.php @@ -298,8 +298,8 @@ class GMP extends Engine * combination is returned is dependent upon which mode is in use. See * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. * - * @param \phpseclib3\Math\BigInteger\Engines\GMP $n - * @return \phpseclib3\Math\BigInteger\Engines\GMP[] + * @param GMP $n + * @return GMP[] */ public function extendedGCD(GMP $n) { @@ -329,7 +329,7 @@ class GMP extends Engine /** * Absolute value. * - * @return \phpseclib3\Math\BigInteger\Engines\GMP + * @return GMP * @access public */ public function abs() @@ -388,7 +388,7 @@ class GMP extends Engine * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift - * @return \phpseclib3\Math\BigInteger\Engines\GMP + * @return GMP */ public function bitwise_rightShift($shift) { @@ -407,7 +407,7 @@ class GMP extends Engine * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift - * @return \phpseclib3\Math\BigInteger\Engines\GMP + * @return GMP */ public function bitwise_leftShift($shift) { @@ -658,7 +658,7 @@ class GMP extends Engine /** * Is Odd? * - * @return boolean + * @return bool */ public function isOdd() { @@ -668,7 +668,7 @@ class GMP extends Engine /** * Tests if a bit is set * - * @return boolean + * @return bool */ public function testBit($x) { @@ -678,7 +678,7 @@ class GMP extends Engine /** * Is Negative? * - * @return boolean + * @return bool */ public function isNegative() { diff --git a/phpseclib/Math/BigInteger/Engines/PHP.php b/phpseclib/Math/BigInteger/Engines/PHP.php index 2bb0f505..3844a928 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/phpseclib/Math/BigInteger/Engines/PHP.php @@ -76,7 +76,7 @@ abstract class PHP extends Engine * * @param mixed $x integer Base-10 number or base-$base number if $base set. * @param int $base - * @return \phpseclib3\Math\BigInteger\Engines\PHP + * @return PHP * @see parent::__construct() */ public function __construct($x = 0, $base = 10) @@ -814,7 +814,7 @@ abstract class PHP extends Engine /** * Absolute value. * - * @return \phpseclib3\Math\BigInteger\Engines\PHP + * @return PHP */ public function abs() { @@ -850,7 +850,7 @@ abstract class PHP extends Engine * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift - * @return \phpseclib3\Math\BigInteger\Engines\PHP + * @return PHP */ public function bitwise_rightShift($shift) { @@ -870,7 +870,7 @@ abstract class PHP extends Engine * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift - * @return \phpseclib3\Math\BigInteger\Engines\PHP + * @return PHP */ public function bitwise_leftShift($shift) { diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Base.php b/phpseclib/Math/BigInteger/Engines/PHP/Base.php index cec7337b..bdc5c37b 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP/Base.php +++ b/phpseclib/Math/BigInteger/Engines/PHP/Base.php @@ -74,11 +74,11 @@ abstract class Base extends PHP * the other, a power of two - and recombine them, later. This is the method that this modPow function uses. * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates. * - * @param \phpseclib3\Math\BigInteger\Engines\PHP $x - * @param \phpseclib3\Math\BigInteger\Engines\PHP $e - * @param \phpseclib3\Math\BigInteger\Engines\PHP $n + * @param PHP $x + * @param PHP $e + * @param PHP $n * @param string $class - * @return \phpseclib3\Math\BigInteger\Engines\PHP + * @return PHP */ protected static function powModHelper(PHP $x, PHP $e, PHP $n, $class) { diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php index e262adb2..fb8ca1a1 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php +++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php @@ -15,6 +15,7 @@ namespace phpseclib3\Math\BigInteger\Engines\PHP\Reductions; +use phpseclib3\Math\BigInteger\Engines\PHP; use phpseclib3\Math\BigInteger\Engines\PHP\Base; /** @@ -46,7 +47,7 @@ abstract class Barrett extends Base * * @param array $n * @param array $m - * @param string $class + * @param class-string $class * @return array */ protected static function reduce(array $n, array $m, $class)