Allow CTE on basic type/math functions (#10842)

This commit is contained in:
Michael Voříšek 2023-04-24 22:39:20 +02:00 committed by GitHub
parent 976d7ed4c6
commit 1209f593ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 171 additions and 66 deletions

View file

@ -1722,14 +1722,14 @@ function array_pad(array $array, int $length, mixed $value): array {}
/**
* @return array<int|string, int|string>
* @refcount 1
* @compile-time-eval
* @refcount 1
*/
function array_flip(array $array): array {}
/**
* @refcount 1
* @compile-time-eval
* @refcount 1
*/
function array_change_key_case(array $array, int $case = CASE_LOWER): array {}
@ -1738,7 +1738,10 @@ function array_change_key_case(array $array, int $case = CASE_LOWER): array {}
*/
function array_unique(array $array, int $flags = SORT_STRING): array {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_intersect_key(array $array, array ...$arrays): array {}
/**
@ -1747,7 +1750,10 @@ function array_intersect_key(array $array, array ...$arrays): array {}
*/
function array_intersect_ukey(array $array, ...$rest): array {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_intersect(array $array, array ...$arrays): array {}
/**
@ -1756,7 +1762,10 @@ function array_intersect(array $array, array ...$arrays): array {}
*/
function array_uintersect(array $array, ...$rest): array {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_intersect_assoc(array $array, array ...$arrays): array {}
/**
@ -1778,8 +1787,8 @@ function array_intersect_uassoc(array $array, ...$rest): array {}
function array_uintersect_uassoc(array $array, ...$rest): array {}
/**
* @refcount 1
* @compile-time-eval
* @refcount 1
*/
function array_diff_key(array $array, array ...$arrays): array {}
@ -1801,8 +1810,8 @@ function array_diff(array $array, array ...$arrays): array {}
function array_udiff(array $array, ...$rest): array {}
/**
* @refcount 1
* @compile-time-eval
* @refcount 1
*/
function array_diff_assoc(array $array, array ...$arrays): array {}
@ -1867,8 +1876,8 @@ function array_is_list(array $array): bool {}
/* base64.c */
/**
* @refcount 1
* @compile-time-eval
* @refcount 1
*/
function base64_encode(string $string): string {}
@ -2280,8 +2289,8 @@ function wordwrap(string $string, int $width = 75, string $break = "\n", bool $c
/**
* @return array<int, string>
* @refcount 1
* @compile-time-eval
* @refcount 1
*/
function explode(string $separator, string $string, int $limit = PHP_INT_MAX): array {}
@ -2958,42 +2967,61 @@ function mail(string $to, string $subject, string $message, array|string $additi
/* math.c */
/** @compile-time-eval */
function abs(int|float $num): int|float {}
/** @compile-time-eval */
function ceil(int|float $num): float {}
/** @compile-time-eval */
function floor(int|float $num): float {}
/** @compile-time-eval */
function round(int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float {}
/** @compile-time-eval */
function sin(float $num): float {}
/** @compile-time-eval */
function cos(float $num): float {}
/** @compile-time-eval */
function tan(float $num): float {}
/** @compile-time-eval */
function asin(float $num): float {}
/** @compile-time-eval */
function acos(float $num): float {}
/** @compile-time-eval */
function atan(float $num): float {}
/** @compile-time-eval */
function atanh(float $num): float {}
/** @compile-time-eval */
function atan2(float $y, float $x): float {}
/** @compile-time-eval */
function sinh(float $num): float {}
/** @compile-time-eval */
function cosh(float $num): float {}
/** @compile-time-eval */
function tanh(float $num): float {}
/** @compile-time-eval */
function asinh(float $num): float {}
/** @compile-time-eval */
function acosh(float $num): float {}
/** @compile-time-eval */
function expm1(float $num): float {}
/** @compile-time-eval */
function log1p(float $num): float {}
/** @compile-time-eval */
@ -3014,18 +3042,25 @@ function is_infinite(float $num): bool {}
/** @compile-time-eval */
function pow(mixed $num, mixed $exponent): int|float|object {}
/** @compile-time-eval */
function exp(float $num): float {}
/** @compile-time-eval */
function log(float $num, float $base = M_E): float {}
/** @compile-time-eval */
function log10(float $num): float {}
/** @compile-time-eval */
function sqrt(float $num): float {}
/** @compile-time-eval */
function hypot(float $x, float $y): float {}
/** @compile-time-eval */
function deg2rad(float $num): float {}
/** @compile-time-eval */
function rad2deg(float $num): float {}
/** @compile-time-eval */
@ -3055,14 +3090,26 @@ function decoct(int $num): string {}
*/
function dechex(int $num): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function base_convert(string $num, int $from_base, int $to_base): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function number_format(float $num, int $decimals = 0, ?string $decimal_separator = ".", ?string $thousands_separator = ","): string {}
/**
* @compile-time-eval
*/
function fmod(float $num1, float $num2): float {}
/**
* @compile-time-eval
*/
function fdiv(float $num1, float $num2): float {}
/* microtime.c */
@ -3088,11 +3135,15 @@ function getrusage(int $mode = 0): array|false {}
/* pack.c */
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function pack(string $format, mixed ...$values): string {}
/**
* @return array<int|string, mixed>|false
* @compile-time-eval
* @refcount 1
*/
function unpack(string $format, string $string, int $offset = 0): array|false {}
@ -3358,29 +3409,59 @@ function socket_set_timeout($stream, int $seconds, int $microseconds = 0): bool
/* type.c */
/**
* @compile-time-eval
*/
function gettype(mixed $value): string {}
/**
* @compile-time-eval
*/
function get_debug_type(mixed $value): string {}
function settype(mixed &$var, string $type): bool {}
/**
* @compile-time-eval
*/
function intval(mixed $value, int $base = 10): int {}
/**
* @compile-time-eval
*/
function floatval(mixed $value): float {}
/** @alias floatval */
function doubleval(mixed $value): float {}
/**
* @compile-time-eval
*/
function boolval(mixed $value): bool {}
/**
* @compile-time-eval
*/
function strval(mixed $value): string {}
/**
* @compile-time-eval
*/
function is_null(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_resource(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_bool(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_int(mixed $value): bool {}
/** @alias is_int */
@ -3389,26 +3470,50 @@ function is_integer(mixed $value): bool {}
/** @alias is_int */
function is_long(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_float(mixed $value): bool {}
/** @alias is_float */
function is_double(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_numeric(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_string(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_array(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_object(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_scalar(mixed $value): bool {}
/** @param string $callable_name */
function is_callable(mixed $value, bool $syntax_only = false, &$callable_name = null): bool {}
/**
* @compile-time-eval
*/
function is_iterable(mixed $value): bool {}
/**
* @compile-time-eval
*/
function is_countable(mixed $value): bool {}
/* uniqid.c */

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 22d7938e2402143250c99e110b2ab06ae8270a0b */
* Stub hash: 73f82e392f5adf146b9b8dfb39496b3ce8465115 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@ -2897,11 +2897,11 @@ static const zend_function_entry ext_functions[] = {
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_flip, arginfo_array_flip)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_change_key_case, arginfo_array_change_key_case)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_unique, arginfo_array_unique)
ZEND_FE(array_intersect_key, arginfo_array_intersect_key)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_intersect_key, arginfo_array_intersect_key)
ZEND_FE(array_intersect_ukey, arginfo_array_intersect_ukey)
ZEND_FE(array_intersect, arginfo_array_intersect)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_intersect, arginfo_array_intersect)
ZEND_FE(array_uintersect, arginfo_array_uintersect)
ZEND_FE(array_intersect_assoc, arginfo_array_intersect_assoc)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_intersect_assoc, arginfo_array_intersect_assoc)
ZEND_FE(array_uintersect_assoc, arginfo_array_uintersect_assoc)
ZEND_FE(array_intersect_uassoc, arginfo_array_intersect_uassoc)
ZEND_FE(array_uintersect_uassoc, arginfo_array_uintersect_uassoc)
@ -3277,48 +3277,48 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(link, arginfo_link)
#endif
ZEND_FE(mail, arginfo_mail)
ZEND_FE(abs, arginfo_abs)
ZEND_FE(ceil, arginfo_ceil)
ZEND_FE(floor, arginfo_floor)
ZEND_FE(round, arginfo_round)
ZEND_FE(sin, arginfo_sin)
ZEND_FE(cos, arginfo_cos)
ZEND_FE(tan, arginfo_tan)
ZEND_FE(asin, arginfo_asin)
ZEND_FE(acos, arginfo_acos)
ZEND_FE(atan, arginfo_atan)
ZEND_FE(atanh, arginfo_atanh)
ZEND_FE(atan2, arginfo_atan2)
ZEND_FE(sinh, arginfo_sinh)
ZEND_FE(cosh, arginfo_cosh)
ZEND_FE(tanh, arginfo_tanh)
ZEND_FE(asinh, arginfo_asinh)
ZEND_FE(acosh, arginfo_acosh)
ZEND_FE(expm1, arginfo_expm1)
ZEND_FE(log1p, arginfo_log1p)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(abs, arginfo_abs)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(ceil, arginfo_ceil)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(floor, arginfo_floor)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(round, arginfo_round)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(sin, arginfo_sin)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(cos, arginfo_cos)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(tan, arginfo_tan)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(asin, arginfo_asin)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(acos, arginfo_acos)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(atan, arginfo_atan)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(atanh, arginfo_atanh)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(atan2, arginfo_atan2)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(sinh, arginfo_sinh)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(cosh, arginfo_cosh)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(tanh, arginfo_tanh)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(asinh, arginfo_asinh)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(acosh, arginfo_acosh)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(expm1, arginfo_expm1)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(log1p, arginfo_log1p)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(pi, arginfo_pi)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_finite, arginfo_is_finite)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_nan, arginfo_is_nan)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(intdiv, arginfo_intdiv)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_infinite, arginfo_is_infinite)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(pow, arginfo_pow)
ZEND_FE(exp, arginfo_exp)
ZEND_FE(log, arginfo_log)
ZEND_FE(log10, arginfo_log10)
ZEND_FE(sqrt, arginfo_sqrt)
ZEND_FE(hypot, arginfo_hypot)
ZEND_FE(deg2rad, arginfo_deg2rad)
ZEND_FE(rad2deg, arginfo_rad2deg)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(exp, arginfo_exp)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(log, arginfo_log)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(log10, arginfo_log10)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(sqrt, arginfo_sqrt)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(hypot, arginfo_hypot)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(deg2rad, arginfo_deg2rad)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(rad2deg, arginfo_rad2deg)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(bindec, arginfo_bindec)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(hexdec, arginfo_hexdec)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(octdec, arginfo_octdec)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(decbin, arginfo_decbin)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(decoct, arginfo_decoct)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(dechex, arginfo_dechex)
ZEND_FE(base_convert, arginfo_base_convert)
ZEND_FE(number_format, arginfo_number_format)
ZEND_FE(fmod, arginfo_fmod)
ZEND_FE(fdiv, arginfo_fdiv)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(base_convert, arginfo_base_convert)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(number_format, arginfo_number_format)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(fmod, arginfo_fmod)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(fdiv, arginfo_fdiv)
#if defined(HAVE_GETTIMEOFDAY)
ZEND_FE(microtime, arginfo_microtime)
#endif
@ -3328,8 +3328,8 @@ static const zend_function_entry ext_functions[] = {
#if defined(HAVE_GETRUSAGE)
ZEND_FE(getrusage, arginfo_getrusage)
#endif
ZEND_FE(pack, arginfo_pack)
ZEND_FE(unpack, arginfo_unpack)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(pack, arginfo_pack)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(unpack, arginfo_unpack)
ZEND_FE(password_get_info, arginfo_password_get_info)
ZEND_FE(password_hash, arginfo_password_hash)
ZEND_FE(password_needs_rehash, arginfo_password_needs_rehash)
@ -3400,30 +3400,30 @@ static const zend_function_entry ext_functions[] = {
#if (defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32))
ZEND_FALIAS(socket_set_timeout, stream_set_timeout, arginfo_socket_set_timeout)
#endif
ZEND_FE(gettype, arginfo_gettype)
ZEND_FE(get_debug_type, arginfo_get_debug_type)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(gettype, arginfo_gettype)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(get_debug_type, arginfo_get_debug_type)
ZEND_FE(settype, arginfo_settype)
ZEND_FE(intval, arginfo_intval)
ZEND_FE(floatval, arginfo_floatval)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(intval, arginfo_intval)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(floatval, arginfo_floatval)
ZEND_FALIAS(doubleval, floatval, arginfo_doubleval)
ZEND_FE(boolval, arginfo_boolval)
ZEND_FE(strval, arginfo_strval)
ZEND_FE(is_null, arginfo_is_null)
ZEND_FE(is_resource, arginfo_is_resource)
ZEND_FE(is_bool, arginfo_is_bool)
ZEND_FE(is_int, arginfo_is_int)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(boolval, arginfo_boolval)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strval, arginfo_strval)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_null, arginfo_is_null)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_resource, arginfo_is_resource)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_bool, arginfo_is_bool)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_int, arginfo_is_int)
ZEND_FALIAS(is_integer, is_int, arginfo_is_integer)
ZEND_FALIAS(is_long, is_int, arginfo_is_long)
ZEND_FE(is_float, arginfo_is_float)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_float, arginfo_is_float)
ZEND_FALIAS(is_double, is_float, arginfo_is_double)
ZEND_FE(is_numeric, arginfo_is_numeric)
ZEND_FE(is_string, arginfo_is_string)
ZEND_FE(is_array, arginfo_is_array)
ZEND_FE(is_object, arginfo_is_object)
ZEND_FE(is_scalar, arginfo_is_scalar)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_numeric, arginfo_is_numeric)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_string, arginfo_is_string)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_array, arginfo_is_array)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_object, arginfo_is_object)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_scalar, arginfo_is_scalar)
ZEND_FE(is_callable, arginfo_is_callable)
ZEND_FE(is_iterable, arginfo_is_iterable)
ZEND_FE(is_countable, arginfo_is_countable)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_iterable, arginfo_is_iterable)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_countable, arginfo_is_countable)
#if defined(HAVE_GETTIMEOFDAY)
ZEND_FE(uniqid, arginfo_uniqid)
#endif