Skip to content

Update gmp+bcmath parameter names #6205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions ext/bcmath/bcmath.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

/** @generate-function-entries */

function bcadd(string $left_operand, string $right_operand, ?int $scale = null): string {}
function bcadd(string $num1, string $num2, ?int $scale = null): string {}

function bcsub(string $left_operand, string $right_operand, ?int $scale = null): string {}
function bcsub(string $num1, string $num2, ?int $scale = null): string {}

function bcmul(string $left_operand, string $right_operand, ?int $scale = null): string {}
function bcmul(string $num1, string $num2, ?int $scale = null): string {}

function bcdiv(string $dividend, string $divisor, ?int $scale = null): string {}
function bcdiv(string $num1, string $num2, ?int $scale = null): string {}

function bcmod(string $dividend, string $divisor, ?int $scale = null): string {}
function bcmod(string $num1, string $num2, ?int $scale = null): string {}

function bcpowmod(string $base, string $exponent, string $modulus, ?int $scale = null): string {}
function bcpowmod(string $num, string $exponent, string $modulus, ?int $scale = null): string {}

function bcpow(string $base, string $exponent, ?int $scale = null): string {}
function bcpow(string $num, string $exponent, ?int $scale = null): string {}

function bcsqrt(string $operand, ?int $scale = null): string {}
function bcsqrt(string $num, ?int $scale = null): string {}

function bccomp(string $left_operand, string $right_operand, ?int $scale = null): int {}
function bccomp(string $num1, string $num2, ?int $scale = null): int {}

function bcscale(?int $scale = null): int {}
24 changes: 10 additions & 14 deletions ext/bcmath/bcmath_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,41 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: a1e223f29a06a2292a88c0e90e104cb956f80500 */
* Stub hash: 0c1e2a6163a5fc0f42bf79bbc530af7c5fd77074 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcadd, 0, 2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, left_operand, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, right_operand, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scale, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

#define arginfo_bcsub arginfo_bcadd

#define arginfo_bcmul arginfo_bcadd

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcdiv, 0, 2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, dividend, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, divisor, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scale, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_bcdiv arginfo_bcadd

#define arginfo_bcmod arginfo_bcdiv
#define arginfo_bcmod arginfo_bcadd

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcpowmod, 0, 3, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, modulus, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scale, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcpow, 0, 2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scale, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcsqrt, 0, 1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, operand, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scale, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bccomp, 0, 2, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, left_operand, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, right_operand, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scale, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

Expand Down
2 changes: 1 addition & 1 deletion ext/bcmath/tests/bcsqrt_error1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ try {
}
?>
--EXPECT--
bcsqrt(): Argument #1 ($operand) must be greater than or equal to 0
bcsqrt(): Argument #1 ($num) must be greater than or equal to 0
2 changes: 1 addition & 1 deletion ext/bcmath/tests/bug75178.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ try {
}
?>
--EXPECT--
bcpowmod(): Argument #1 ($base) cannot have a fractional part
bcpowmod(): Argument #1 ($num) cannot have a fractional part
bcpowmod(): Argument #3 ($modulus) cannot have a fractional part
96 changes: 48 additions & 48 deletions ext/gmp/gmp.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,105 +6,105 @@ class GMP
{
}

function gmp_init(int|string $number, int $base = 0): GMP {}
function gmp_init(int|string $num, int $base = 0): GMP {}

function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP {}
function gmp_import(string $data, int $word_size = 1, int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP {}

function gmp_export(GMP|int|string $gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string {}
function gmp_export(GMP|int|string $num, int $word_size = 1, int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string {}

function gmp_intval(GMP|int|string $gmpnumber): int {}
function gmp_intval(GMP|int|string $num): int {}

function gmp_strval(GMP|int|string $gmpnumber, int $base = 10): string {}
function gmp_strval(GMP|int|string $num, int $base = 10): string {}

function gmp_add(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_add(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_sub(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_sub(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_mul(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_mul(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_div_qr(GMP|int|string $a, GMP|int|string $b, int $round = GMP_ROUND_ZERO): array {}
function gmp_div_qr(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): array {}

function gmp_div_q(GMP|int|string $a, GMP|int|string $b, int $round = GMP_ROUND_ZERO): GMP {}
function gmp_div_q(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): GMP {}

function gmp_div_r(GMP|int|string $a, GMP|int|string $b, int $round = GMP_ROUND_ZERO): GMP {}
function gmp_div_r(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): GMP {}

/** @alias gmp_div_q */
function gmp_div(GMP|int|string $a, GMP|int|string $b, int $round = GMP_ROUND_ZERO): GMP {}
function gmp_div(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): GMP {}

function gmp_mod(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_mod(GMP|int|string $num1, GMP|int|string $num2): GMP {}
Copy link
Member

@Girgias Girgias Sep 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function gmp_mod(GMP|int|string $num1, GMP|int|string $num2): GMP {}
function gmp_mod(GMP|int|string $num, GMP|int|string $mod): GMP {}

To align with BCMath?
EDIT: Got confused by bcpowmod()


function gmp_divexact(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_divexact(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_neg(GMP|int|string $a): GMP {}
function gmp_neg(GMP|int|string $num): GMP {}

function gmp_abs(GMP|int|string $a): GMP {}
function gmp_abs(GMP|int|string $num): GMP {}

function gmp_fact(GMP|int|string $a): GMP {}
function gmp_fact(GMP|int|string $num): GMP {}

function gmp_sqrt(GMP|int|string $a): GMP {}
function gmp_sqrt(GMP|int|string $num): GMP {}

function gmp_sqrtrem(GMP|int|string $a): array {}
function gmp_sqrtrem(GMP|int|string $num): array {}

function gmp_root(GMP|int|string $a, int $nth): GMP {}
function gmp_root(GMP|int|string $num, int $nth): GMP {}

function gmp_rootrem(GMP|int|string $a, int $nth): array {}
function gmp_rootrem(GMP|int|string $num, int $nth): array {}

function gmp_pow(GMP|int|string $base, int $exp): GMP {}
function gmp_pow(GMP|int|string $num, int $exponent): GMP {}

function gmp_powm(GMP|int|string $base, GMP|int|string $exp, GMP|int|string $mod): GMP {}
function gmp_powm(GMP|int|string $num, GMP|int|string $exponent, GMP|int|string $modulus): GMP {}

function gmp_perfect_square(GMP|int|string $a): bool {}
function gmp_perfect_square(GMP|int|string $num): bool {}

function gmp_perfect_power(GMP|int|string $a): bool {}
function gmp_perfect_power(GMP|int|string $num): bool {}

function gmp_prob_prime(GMP|int|string $a, int $reps = 10): int {}
function gmp_prob_prime(GMP|int|string $num, int $repetitions = 10): int {}

function gmp_gcd(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_gcd(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_gcdext(GMP|int|string $a, GMP|int|string $b): array {}
function gmp_gcdext(GMP|int|string $num1, GMP|int|string $num2): array {}

function gmp_lcm(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_lcm(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_invert(GMP|int|string $a, GMP|int|string $b): GMP|false {}
function gmp_invert(GMP|int|string $num1, GMP|int|string $num2): GMP|false {}

function gmp_jacobi(GMP|int|string $a, GMP|int|string $b): int {}
function gmp_jacobi(GMP|int|string $num1, GMP|int|string $num2): int {}

function gmp_legendre(GMP|int|string $a, GMP|int|string $b): int {}
function gmp_legendre(GMP|int|string $num1, GMP|int|string $num2): int {}

function gmp_kronecker(GMP|int|string $a, GMP|int|string $b): int {}
function gmp_kronecker(GMP|int|string $num1, GMP|int|string $num2): int {}

function gmp_cmp(GMP|int|string $a, GMP|int|string $b): int {}
function gmp_cmp(GMP|int|string $num1, GMP|int|string $num2): int {}

function gmp_sign(GMP|int|string $a): int {}
function gmp_sign(GMP|int|string $num): int {}

function gmp_random_seed(GMP|int|string $seed): void {}

function gmp_random_bits(int $bits): GMP {}

function gmp_random_range(GMP|int|string $min, GMP|int|string $max): GMP {}

function gmp_and(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_and(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_or(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_or(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_com(GMP|int|string $a): GMP {}
function gmp_com(GMP|int|string $num): GMP {}

function gmp_xor(GMP|int|string $a, GMP|int|string $b): GMP {}
function gmp_xor(GMP|int|string $num1, GMP|int|string $num2): GMP {}

function gmp_setbit(GMP $a, int $index, bool $set_clear = true): void {}
function gmp_setbit(GMP $num, int $index, bool $value = true): void {}

function gmp_clrbit(GMP $a, int $index): void {}
function gmp_clrbit(GMP $num, int $index): void {}

function gmp_testbit(GMP|int|string $a, int $index): bool {}
function gmp_testbit(GMP|int|string $num, int $index): bool {}

function gmp_scan0(GMP|int|string $a, int $start): int {}
function gmp_scan0(GMP|int|string $num1, int $start): int {}

function gmp_scan1(GMP|int|string $a, int $start): int {}
function gmp_scan1(GMP|int|string $num1, int $start): int {}

function gmp_popcount(GMP|int|string $a): int {}
function gmp_popcount(GMP|int|string $num): int {}

function gmp_hamdist(GMP|int|string $a, GMP|int|string $b): int {}
function gmp_hamdist(GMP|int|string $num1, GMP|int|string $num2): int {}

function gmp_nextprime(GMP|int|string $a): GMP {}
function gmp_nextprime(GMP|int|string $num): GMP {}

function gmp_binomial(GMP|int|string $a, int $b): GMP {}
function gmp_binomial(GMP|int|string $n, int $k): GMP {}
Loading