@@ -38,7 +38,7 @@ private function __construct(\GMP $value)
3838 *
3939 * @return BigInteger
4040 */
41- public static function createFromGMPResource (\GMP $ value ): BigInteger
41+ public static function createFromGMPResource (\GMP $ value ): self
4242 {
4343 return new self ($ value );
4444 }
@@ -48,7 +48,7 @@ public static function createFromGMPResource(\GMP $value): BigInteger
4848 *
4949 * @return BigInteger
5050 */
51- public static function createFromBinaryString (string $ value ): BigInteger
51+ public static function createFromBinaryString (string $ value ): self
5252 {
5353 $ value = '0x ' .unpack ('H* ' , $ value )[1 ];
5454 $ value = gmp_init ($ value , 16 );
@@ -61,7 +61,7 @@ public static function createFromBinaryString(string $value): BigInteger
6161 *
6262 * @return BigInteger
6363 */
64- public static function createFromDecimal (int $ value ): BigInteger
64+ public static function createFromDecimal (int $ value ): self
6565 {
6666 $ value = gmp_init ($ value , 10 );
6767
@@ -93,7 +93,7 @@ public function toBytes(): string
9393 *
9494 * @return BigInteger
9595 */
96- public function add (BigInteger $ y ): BigInteger
96+ public function add (self $ y ): self
9797 {
9898 $ value = gmp_add ($ this ->value , $ y ->value );
9999
@@ -107,7 +107,7 @@ public function add(BigInteger $y): BigInteger
107107 *
108108 * @return BigInteger
109109 */
110- public function subtract (BigInteger $ y ): BigInteger
110+ public function subtract (self $ y ): self
111111 {
112112 $ value = gmp_sub ($ this ->value , $ y ->value );
113113
@@ -121,7 +121,7 @@ public function subtract(BigInteger $y): BigInteger
121121 *
122122 * @return BigInteger
123123 */
124- public function multiply (BigInteger $ x ): BigInteger
124+ public function multiply (self $ x ): self
125125 {
126126 $ value = gmp_mul ($ this ->value , $ x ->value );
127127
@@ -135,7 +135,7 @@ public function multiply(BigInteger $x): BigInteger
135135 *
136136 * @return BigInteger
137137 */
138- public function divide (BigInteger $ x ): BigInteger
138+ public function divide (self $ x ): self
139139 {
140140 $ value = gmp_div ($ this ->value , $ x ->value );
141141
@@ -150,7 +150,7 @@ public function divide(BigInteger $x): BigInteger
150150 *
151151 * @return BigInteger
152152 */
153- public function modPow (BigInteger $ e , BigInteger $ n ): BigInteger
153+ public function modPow (self $ e , self $ n ): self
154154 {
155155 $ value = gmp_powm ($ this ->value , $ e ->value , $ n ->value );
156156
@@ -164,7 +164,7 @@ public function modPow(BigInteger $e, BigInteger $n): BigInteger
164164 *
165165 * @return BigInteger
166166 */
167- public function mod (BigInteger $ d ): BigInteger
167+ public function mod (self $ d ): self
168168 {
169169 $ value = gmp_mod ($ this ->value , $ d ->value );
170170
@@ -178,7 +178,7 @@ public function mod(BigInteger $d): BigInteger
178178 *
179179 * @return BigInteger
180180 */
181- public function modInverse (BigInteger $ n ): BigInteger
181+ public function modInverse (self $ n ): self
182182 {
183183 $ value = gmp_invert ($ this ->value , $ n ->value );
184184
@@ -192,7 +192,7 @@ public function modInverse(BigInteger $n): BigInteger
192192 *
193193 * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal
194194 */
195- public function compare (BigInteger $ y ): int
195+ public function compare (self $ y ): int
196196 {
197197 return gmp_cmp ($ this ->value , $ y ->value );
198198 }
@@ -202,7 +202,7 @@ public function compare(BigInteger $y): int
202202 *
203203 * @return bool
204204 */
205- public function equals (BigInteger $ y ): bool
205+ public function equals (self $ y ): bool
206206 {
207207 return 0 === $ this ->compare ($ y );
208208 }
@@ -212,7 +212,7 @@ public function equals(BigInteger $y): bool
212212 *
213213 * @return BigInteger
214214 */
215- public static function random (BigInteger $ y ): BigInteger
215+ public static function random (self $ y ): self
216216 {
217217 $ zero = self ::createFromDecimal (0 );
218218
@@ -224,7 +224,7 @@ public static function random(BigInteger $y): BigInteger
224224 *
225225 * @return BigInteger
226226 */
227- public function gcd (BigInteger $ y ): BigInteger
227+ public function gcd (self $ y ): self
228228 {
229229 return self ::createFromGMPResource (gmp_gcd ($ this ->value , $ y ->value ));
230230 }
@@ -234,7 +234,7 @@ public function gcd(BigInteger $y): BigInteger
234234 *
235235 * @return bool
236236 */
237- public function lowerThan (BigInteger $ y ): bool
237+ public function lowerThan (self $ y ): bool
238238 {
239239 return 0 > $ this ->compare ($ y );
240240 }
0 commit comments