Skip to content

Commit 1209f59

Browse files
authored
Allow CTE on basic type/math functions (#10842)
1 parent 976d7ed commit 1209f59

File tree

2 files changed

+171
-66
lines changed

2 files changed

+171
-66
lines changed

ext/standard/basic_functions.stub.php

Lines changed: 117 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,14 +1722,14 @@ function array_pad(array $array, int $length, mixed $value): array {}
17221722

17231723
/**
17241724
* @return array<int|string, int|string>
1725-
* @refcount 1
17261725
* @compile-time-eval
1726+
* @refcount 1
17271727
*/
17281728
function array_flip(array $array): array {}
17291729

17301730
/**
1731-
* @refcount 1
17321731
* @compile-time-eval
1732+
* @refcount 1
17331733
*/
17341734
function array_change_key_case(array $array, int $case = CASE_LOWER): array {}
17351735

@@ -1738,7 +1738,10 @@ function array_change_key_case(array $array, int $case = CASE_LOWER): array {}
17381738
*/
17391739
function array_unique(array $array, int $flags = SORT_STRING): array {}
17401740

1741-
/** @refcount 1 */
1741+
/**
1742+
* @compile-time-eval
1743+
* @refcount 1
1744+
*/
17421745
function array_intersect_key(array $array, array ...$arrays): array {}
17431746

17441747
/**
@@ -1747,7 +1750,10 @@ function array_intersect_key(array $array, array ...$arrays): array {}
17471750
*/
17481751
function array_intersect_ukey(array $array, ...$rest): array {}
17491752

1750-
/** @refcount 1 */
1753+
/**
1754+
* @compile-time-eval
1755+
* @refcount 1
1756+
*/
17511757
function array_intersect(array $array, array ...$arrays): array {}
17521758

17531759
/**
@@ -1756,7 +1762,10 @@ function array_intersect(array $array, array ...$arrays): array {}
17561762
*/
17571763
function array_uintersect(array $array, ...$rest): array {}
17581764

1759-
/** @refcount 1 */
1765+
/**
1766+
* @compile-time-eval
1767+
* @refcount 1
1768+
*/
17601769
function array_intersect_assoc(array $array, array ...$arrays): array {}
17611770

17621771
/**
@@ -1778,8 +1787,8 @@ function array_intersect_uassoc(array $array, ...$rest): array {}
17781787
function array_uintersect_uassoc(array $array, ...$rest): array {}
17791788

17801789
/**
1781-
* @refcount 1
17821790
* @compile-time-eval
1791+
* @refcount 1
17831792
*/
17841793
function array_diff_key(array $array, array ...$arrays): array {}
17851794

@@ -1801,8 +1810,8 @@ function array_diff(array $array, array ...$arrays): array {}
18011810
function array_udiff(array $array, ...$rest): array {}
18021811

18031812
/**
1804-
* @refcount 1
18051813
* @compile-time-eval
1814+
* @refcount 1
18061815
*/
18071816
function array_diff_assoc(array $array, array ...$arrays): array {}
18081817

@@ -1867,8 +1876,8 @@ function array_is_list(array $array): bool {}
18671876
/* base64.c */
18681877

18691878
/**
1870-
* @refcount 1
18711879
* @compile-time-eval
1880+
* @refcount 1
18721881
*/
18731882
function base64_encode(string $string): string {}
18741883

@@ -2280,8 +2289,8 @@ function wordwrap(string $string, int $width = 75, string $break = "\n", bool $c
22802289

22812290
/**
22822291
* @return array<int, string>
2283-
* @refcount 1
22842292
* @compile-time-eval
2293+
* @refcount 1
22852294
*/
22862295
function explode(string $separator, string $string, int $limit = PHP_INT_MAX): array {}
22872296

@@ -2958,42 +2967,61 @@ function mail(string $to, string $subject, string $message, array|string $additi
29582967

29592968
/* math.c */
29602969

2970+
/** @compile-time-eval */
29612971
function abs(int|float $num): int|float {}
29622972

2973+
/** @compile-time-eval */
29632974
function ceil(int|float $num): float {}
29642975

2976+
/** @compile-time-eval */
29652977
function floor(int|float $num): float {}
29662978

2979+
/** @compile-time-eval */
29672980
function round(int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float {}
29682981

2982+
/** @compile-time-eval */
29692983
function sin(float $num): float {}
29702984

2985+
/** @compile-time-eval */
29712986
function cos(float $num): float {}
29722987

2988+
/** @compile-time-eval */
29732989
function tan(float $num): float {}
29742990

2991+
/** @compile-time-eval */
29752992
function asin(float $num): float {}
29762993

2994+
/** @compile-time-eval */
29772995
function acos(float $num): float {}
29782996

2997+
/** @compile-time-eval */
29792998
function atan(float $num): float {}
29802999

3000+
/** @compile-time-eval */
29813001
function atanh(float $num): float {}
29823002

3003+
/** @compile-time-eval */
29833004
function atan2(float $y, float $x): float {}
29843005

3006+
/** @compile-time-eval */
29853007
function sinh(float $num): float {}
29863008

3009+
/** @compile-time-eval */
29873010
function cosh(float $num): float {}
29883011

3012+
/** @compile-time-eval */
29893013
function tanh(float $num): float {}
29903014

3015+
/** @compile-time-eval */
29913016
function asinh(float $num): float {}
29923017

3018+
/** @compile-time-eval */
29933019
function acosh(float $num): float {}
29943020

3021+
/** @compile-time-eval */
29953022
function expm1(float $num): float {}
29963023

3024+
/** @compile-time-eval */
29973025
function log1p(float $num): float {}
29983026

29993027
/** @compile-time-eval */
@@ -3014,18 +3042,25 @@ function is_infinite(float $num): bool {}
30143042
/** @compile-time-eval */
30153043
function pow(mixed $num, mixed $exponent): int|float|object {}
30163044

3045+
/** @compile-time-eval */
30173046
function exp(float $num): float {}
30183047

3048+
/** @compile-time-eval */
30193049
function log(float $num, float $base = M_E): float {}
30203050

3051+
/** @compile-time-eval */
30213052
function log10(float $num): float {}
30223053

3054+
/** @compile-time-eval */
30233055
function sqrt(float $num): float {}
30243056

3057+
/** @compile-time-eval */
30253058
function hypot(float $x, float $y): float {}
30263059

3060+
/** @compile-time-eval */
30273061
function deg2rad(float $num): float {}
30283062

3063+
/** @compile-time-eval */
30293064
function rad2deg(float $num): float {}
30303065

30313066
/** @compile-time-eval */
@@ -3055,14 +3090,26 @@ function decoct(int $num): string {}
30553090
*/
30563091
function dechex(int $num): string {}
30573092

3058-
/** @refcount 1 */
3093+
/**
3094+
* @compile-time-eval
3095+
* @refcount 1
3096+
*/
30593097
function base_convert(string $num, int $from_base, int $to_base): string {}
30603098

3061-
/** @refcount 1 */
3099+
/**
3100+
* @compile-time-eval
3101+
* @refcount 1
3102+
*/
30623103
function number_format(float $num, int $decimals = 0, ?string $decimal_separator = ".", ?string $thousands_separator = ","): string {}
30633104

3105+
/**
3106+
* @compile-time-eval
3107+
*/
30643108
function fmod(float $num1, float $num2): float {}
30653109

3110+
/**
3111+
* @compile-time-eval
3112+
*/
30663113
function fdiv(float $num1, float $num2): float {}
30673114

30683115
/* microtime.c */
@@ -3088,11 +3135,15 @@ function getrusage(int $mode = 0): array|false {}
30883135

30893136
/* pack.c */
30903137

3091-
/** @refcount 1 */
3138+
/**
3139+
* @compile-time-eval
3140+
* @refcount 1
3141+
*/
30923142
function pack(string $format, mixed ...$values): string {}
30933143

30943144
/**
30953145
* @return array<int|string, mixed>|false
3146+
* @compile-time-eval
30963147
* @refcount 1
30973148
*/
30983149
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
33583409

33593410
/* type.c */
33603411

3412+
/**
3413+
* @compile-time-eval
3414+
*/
33613415
function gettype(mixed $value): string {}
33623416

3417+
/**
3418+
* @compile-time-eval
3419+
*/
33633420
function get_debug_type(mixed $value): string {}
33643421

33653422
function settype(mixed &$var, string $type): bool {}
33663423

3424+
/**
3425+
* @compile-time-eval
3426+
*/
33673427
function intval(mixed $value, int $base = 10): int {}
33683428

3429+
/**
3430+
* @compile-time-eval
3431+
*/
33693432
function floatval(mixed $value): float {}
33703433

33713434
/** @alias floatval */
33723435
function doubleval(mixed $value): float {}
33733436

3437+
/**
3438+
* @compile-time-eval
3439+
*/
33743440
function boolval(mixed $value): bool {}
33753441

3442+
/**
3443+
* @compile-time-eval
3444+
*/
33763445
function strval(mixed $value): string {}
33773446

3447+
/**
3448+
* @compile-time-eval
3449+
*/
33783450
function is_null(mixed $value): bool {}
33793451

3452+
/**
3453+
* @compile-time-eval
3454+
*/
33803455
function is_resource(mixed $value): bool {}
33813456

3457+
/**
3458+
* @compile-time-eval
3459+
*/
33823460
function is_bool(mixed $value): bool {}
33833461

3462+
/**
3463+
* @compile-time-eval
3464+
*/
33843465
function is_int(mixed $value): bool {}
33853466

33863467
/** @alias is_int */
@@ -3389,26 +3470,50 @@ function is_integer(mixed $value): bool {}
33893470
/** @alias is_int */
33903471
function is_long(mixed $value): bool {}
33913472

3473+
/**
3474+
* @compile-time-eval
3475+
*/
33923476
function is_float(mixed $value): bool {}
33933477

33943478
/** @alias is_float */
33953479
function is_double(mixed $value): bool {}
33963480

3481+
/**
3482+
* @compile-time-eval
3483+
*/
33973484
function is_numeric(mixed $value): bool {}
33983485

3486+
/**
3487+
* @compile-time-eval
3488+
*/
33993489
function is_string(mixed $value): bool {}
34003490

3491+
/**
3492+
* @compile-time-eval
3493+
*/
34013494
function is_array(mixed $value): bool {}
34023495

3496+
/**
3497+
* @compile-time-eval
3498+
*/
34033499
function is_object(mixed $value): bool {}
34043500

3501+
/**
3502+
* @compile-time-eval
3503+
*/
34053504
function is_scalar(mixed $value): bool {}
34063505

34073506
/** @param string $callable_name */
34083507
function is_callable(mixed $value, bool $syntax_only = false, &$callable_name = null): bool {}
34093508

3509+
/**
3510+
* @compile-time-eval
3511+
*/
34103512
function is_iterable(mixed $value): bool {}
34113513

3514+
/**
3515+
* @compile-time-eval
3516+
*/
34123517
function is_countable(mixed $value): bool {}
34133518

34143519
/* uniqid.c */

0 commit comments

Comments
 (0)