Skip to content

Commit 0d330e1

Browse files
committed
Add a few missing parameter types in stubs
Related to GH-5627
1 parent 41de27e commit 0d330e1

35 files changed

+137
-114
lines changed

Zend/tests/argument_restriction_005.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ class Sub implements ArrayAccess {
88
}
99
?>
1010
--EXPECTF--
11-
Fatal error: Declaration of Sub::offsetSet() must be compatible with ArrayAccess::offsetSet($offset, $value) in %sargument_restriction_005.php on line %d
11+
Fatal error: Declaration of Sub::offsetSet() must be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value) in %sargument_restriction_005.php on line %d

Zend/zend_builtin_functions.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function strncasecmp(string $string1, string $string2, int $length): int {}
2323
function error_reporting(?int $error_level = null): int {}
2424

2525
/** @param mixed $value */
26-
function define(string $constant_name, $value, $case_insensitive = false): bool {}
26+
function define(string $constant_name, $value, bool $case_insensitive = false): bool {}
2727

2828
function defined(string $constant_name): bool {}
2929

Zend/zend_builtin_functions_arginfo.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: d1ab4864c1159916b45c8f272a2a1d708b2dca65 */
2+
* Stub hash: 1f644f72600eddbbb01a4c3912a2c9c5fe12188e */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()
@@ -40,7 +40,7 @@ ZEND_END_ARG_INFO()
4040
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_define, 0, 2, _IS_BOOL, 0)
4141
ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
4242
ZEND_ARG_INFO(0, value)
43-
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, case_insensitive, "false")
43+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, case_insensitive, _IS_BOOL, 0, "false")
4444
ZEND_END_ARG_INFO()
4545

4646
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_defined, 0, 1, _IS_BOOL, 0)

Zend/zend_closures.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public function bindTo(?object $newThis, $newScope = UNKNOWN): ?Closure {}
1717

1818
public function call(object $newThis, mixed ...$arguments): mixed {}
1919

20-
/** @param callable $callback Not a proper type annotation due to bug #78770 */
20+
/** @param callable $callback callable is not a proper type due to bug #78770. */
2121
public static function fromCallable($callback): Closure {}
2222
}

Zend/zend_closures_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 57771cb65a3193bd683be75efd04f7daff0f8585 */
2+
* Stub hash: 62198e96940fe0e86fe89601015c837aa5390e92 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure___construct, 0, 0, 0)
55
ZEND_END_ARG_INFO()

Zend/zend_interfaces.stub.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ public function rewind();
3131
interface ArrayAccess
3232
{
3333
/** @return bool */
34-
public function offsetExists($offset);
34+
public function offsetExists(mixed $offset);
3535

36-
/* actually this should be return by ref but atm cannot be */
37-
/** @return mixed */
38-
public function offsetGet($offset);
36+
/**
37+
* Actually this should be return by ref but atm cannot be.
38+
* @return mixed
39+
*/
40+
public function offsetGet(mixed $offset);
3941

4042
/** @return void */
41-
public function offsetSet($offset, $value);
43+
public function offsetSet(mixed $offset, mixed $value);
4244

4345
/** @return void */
44-
public function offsetUnset($offset);
46+
public function offsetUnset(mixed $offset);
4547
}
4648

4749
interface Serializable

Zend/zend_interfaces_arginfo.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: c3b97b8a9c7522fc5b58e63fbf9cd6a801f4bbc2 */
2+
* Stub hash: 1aa9ef81a738328a334176d37683646b60b2f6fa */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -15,14 +15,14 @@ ZEND_END_ARG_INFO()
1515
#define arginfo_class_Iterator_rewind arginfo_class_IteratorAggregate_getIterator
1616

1717
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetExists, 0, 0, 1)
18-
ZEND_ARG_INFO(0, offset)
18+
ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0)
1919
ZEND_END_ARG_INFO()
2020

2121
#define arginfo_class_ArrayAccess_offsetGet arginfo_class_ArrayAccess_offsetExists
2222

2323
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetSet, 0, 0, 2)
24-
ZEND_ARG_INFO(0, offset)
25-
ZEND_ARG_INFO(0, value)
24+
ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0)
25+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
2626
ZEND_END_ARG_INFO()
2727

2828
#define arginfo_class_ArrayAccess_offsetUnset arginfo_class_ArrayAccess_offsetExists

ext/com_dotnet/com_com.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,23 @@ PHP_FUNCTION(com_get_active_object)
288288
CLSID clsid;
289289
char *module_name;
290290
size_t module_name_len;
291-
zend_long code_page = COMG(code_page);
291+
zend_long code_page;
292+
zend_bool code_page_is_null = 1;
292293
IUnknown *unk = NULL;
293294
IDispatch *obj = NULL;
294295
HRESULT res;
295296
OLECHAR *module = NULL;
296297

297298
php_com_initialize();
298-
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
299-
&module_name, &module_name_len, &code_page)) {
299+
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l!",
300+
&module_name, &module_name_len, &code_page, &code_page_is_null)) {
300301
RETURN_THROWS();
301302
}
302303

304+
if (code_page_is_null) {
305+
code_page = COMG(code_page);
306+
}
307+
303308
module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page);
304309

305310
res = CLSIDFromString(module, &clsid);

ext/com_dotnet/com_extension.c

+1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
259259
COM_CONST(VARCMP_EQ);
260260
COM_CONST(VARCMP_GT);
261261
COM_CONST(VARCMP_NULL);
262+
COM_CONST(LOCALE_SYSTEM_DEFAULT);
262263

263264
COM_CONST(NORM_IGNORECASE);
264265
COM_CONST(NORM_IGNORENONSPACE);

ext/com_dotnet/com_extension.stub.php

+25-25
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,63 @@
22

33
/** @generate-function-entries */
44

5-
function variant_set(variant $variant, $value): void {}
5+
function variant_set(variant $variant, mixed $value): void {}
66

7-
function variant_add($left, $right): variant {}
7+
function variant_add(mixed $left, mixed $right): variant {}
88

9-
function variant_cat($left, $right): variant {}
9+
function variant_cat(mixed $left, mixed $right): variant {}
1010

11-
function variant_sub($left, $right): variant {}
11+
function variant_sub(mixed $left, mixed $right): variant {}
1212

13-
function variant_mul($left, $right): variant {}
13+
function variant_mul(mixed $left, mixed $right): variant {}
1414

15-
function variant_and($left, $right): variant {}
15+
function variant_and(mixed $left, mixed $right): variant {}
1616

17-
function variant_div($left, $right): variant {}
17+
function variant_div(mixed $left, mixed $right): variant {}
1818

19-
function variant_eqv($left, $right): variant {}
19+
function variant_eqv(mixed $left, mixed $right): variant {}
2020

21-
function variant_idiv($left, $right): variant {}
21+
function variant_idiv(mixed $left, mixed $right): variant {}
2222

23-
function variant_imp($left, $right): variant {}
23+
function variant_imp(mixed $left, mixed $right): variant {}
2424

25-
function variant_mod($left, $right): variant {}
25+
function variant_mod(mixed $left, mixed $right): variant {}
2626

27-
function variant_or($left, $right): variant {}
27+
function variant_or(mixed $left, mixed $right): variant {}
2828

29-
function variant_pow($left, $right): variant {}
29+
function variant_pow(mixed $left, mixed $right): variant {}
3030

31-
function variant_xor($left, $right): variant {}
31+
function variant_xor(mixed $left, mixed $right): variant {}
3232

33-
function variant_abs($left): variant {}
33+
function variant_abs(mixed $left): variant {}
3434

35-
function variant_fix($left): variant {}
35+
function variant_fix(mixed $left): variant {}
3636

37-
function variant_int($left): variant {}
37+
function variant_int(mixed $left): variant {}
3838

39-
function variant_neg($left): variant {}
39+
function variant_neg(mixed $left): variant {}
4040

41-
function variant_not($left): variant {}
41+
function variant_not(mixed $left): variant {}
4242

43-
function variant_round($left, int $decimals): ?variant {}
43+
function variant_round(mixed $left, int $decimals): ?variant {}
4444

45-
function variant_cmp($left, $right, int $lcid = UNKNOWN, int $flags = 0): int {}
45+
function variant_cmp(mixed $left, mixed $right, int $lcid = LOCALE_SYSTEM_DEFAULT, int $flags = 0): int {}
4646

4747
function variant_date_to_timestamp(variant $variant): ?int {}
4848

49-
/** @return variant|false */
50-
function variant_date_from_timestamp(int $timestamp) {}
49+
function variant_date_from_timestamp(int $timestamp): variant|false {}
5150

5251
function variant_get_type(variant $variant): int {}
5352

5453
function variant_set_type(variant $variant, int $type): void {}
5554

5655
function variant_cast(variant $variant, int $type): variant {}
5756

58-
function com_get_active_object(string $progid, int $code_page = UNKNOWN): variant {}
57+
function com_get_active_object(string $progid, ?int $code_page = null): variant {}
5958

6059
function com_create_guid(): string|false {}
6160

61+
/** @param array|string|null $sinkinterface */
6262
function com_event_sink(variant $comobject, object $sinkobject, $sinkinterface = UNKNOWN): bool {}
6363

6464
function com_print_typeinfo($comobject, ?string $dispinterface = null, bool $wantsink = false): bool {}
@@ -69,7 +69,7 @@ function com_load_typelib(string $typelib_name, bool $case_insensitive = true):
6969

7070
class variant
7171
{
72-
public function __construct($value = null, int $type = VT_EMPTY, int $codepage = CP_ACP) {}
72+
public function __construct(mixed $value = null, int $type = VT_EMPTY, int $codepage = CP_ACP) {}
7373
}
7474

7575
class com

ext/com_dotnet/com_extension_arginfo.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 965dcbb494d51bb3fd41a2898a1c53d7478fd699 */
2+
* Stub hash: caec4bba1103a07a86803ac0192782fef7d6680f */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0)
55
ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
6-
ZEND_ARG_INFO(0, value)
6+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
77
ZEND_END_ARG_INFO()
88

99
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_add, 0, 2, variant, 0)
10-
ZEND_ARG_INFO(0, left)
11-
ZEND_ARG_INFO(0, right)
10+
ZEND_ARG_TYPE_INFO(0, left, IS_MIXED, 0)
11+
ZEND_ARG_TYPE_INFO(0, right, IS_MIXED, 0)
1212
ZEND_END_ARG_INFO()
1313

1414
#define arginfo_variant_cat arginfo_variant_add
@@ -36,7 +36,7 @@ ZEND_END_ARG_INFO()
3636
#define arginfo_variant_xor arginfo_variant_add
3737

3838
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_abs, 0, 1, variant, 0)
39-
ZEND_ARG_INFO(0, left)
39+
ZEND_ARG_TYPE_INFO(0, left, IS_MIXED, 0)
4040
ZEND_END_ARG_INFO()
4141

4242
#define arginfo_variant_fix arginfo_variant_abs
@@ -48,22 +48,22 @@ ZEND_END_ARG_INFO()
4848
#define arginfo_variant_not arginfo_variant_abs
4949

5050
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_round, 0, 2, variant, 1)
51-
ZEND_ARG_INFO(0, left)
51+
ZEND_ARG_TYPE_INFO(0, left, IS_MIXED, 0)
5252
ZEND_ARG_TYPE_INFO(0, decimals, IS_LONG, 0)
5353
ZEND_END_ARG_INFO()
5454

5555
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_cmp, 0, 2, IS_LONG, 0)
56-
ZEND_ARG_INFO(0, left)
57-
ZEND_ARG_INFO(0, right)
58-
ZEND_ARG_TYPE_INFO(0, lcid, IS_LONG, 0)
56+
ZEND_ARG_TYPE_INFO(0, left, IS_MIXED, 0)
57+
ZEND_ARG_TYPE_INFO(0, right, IS_MIXED, 0)
58+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, lcid, IS_LONG, 0, "LOCALE_SYSTEM_DEFAULT")
5959
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
6060
ZEND_END_ARG_INFO()
6161

6262
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_date_to_timestamp, 0, 1, IS_LONG, 1)
6363
ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
6464
ZEND_END_ARG_INFO()
6565

66-
ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_from_timestamp, 0, 0, 1)
66+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_variant_date_from_timestamp, 0, 1, variant, MAY_BE_FALSE)
6767
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
6868
ZEND_END_ARG_INFO()
6969

@@ -83,7 +83,7 @@ ZEND_END_ARG_INFO()
8383

8484
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_com_get_active_object, 0, 1, variant, 0)
8585
ZEND_ARG_TYPE_INFO(0, progid, IS_STRING, 0)
86-
ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0)
86+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code_page, IS_LONG, 1, "null")
8787
ZEND_END_ARG_INFO()
8888

8989
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_com_create_guid, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
@@ -111,7 +111,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_load_typelib, 0, 1, _IS_BOOL
111111
ZEND_END_ARG_INFO()
112112

113113
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_variant___construct, 0, 0, 0)
114-
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, value, "null")
114+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value, IS_MIXED, 0, "null")
115115
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "VT_EMPTY")
116116
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, codepage, IS_LONG, 0, "CP_ACP")
117117
ZEND_END_ARG_INFO()

ext/enchant/enchant.stub.php

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function enchant_broker_set_ordering(EnchantBroker $broker, string $tag, string
3838

3939
function enchant_broker_describe(EnchantBroker $broker): array {}
4040

41+
/** @param array $suggestions */
4142
function enchant_dict_quick_check(EnchantDictionary $dict, string $word, &$suggestions = null): bool {}
4243

4344
function enchant_dict_check(EnchantDictionary $dict, string $word): bool {}

ext/enchant/enchant_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 5a67e10da7a70552110e807118a33d1d7bb028da */
2+
* Stub hash: 22c47f0b30f6952a42546c403fbd2e92836661fa */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE)
55
ZEND_END_ARG_INFO()

ext/gd/gd.stub.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ function imagejpeg(GdImage $im, $to = null, int $quality = -1): bool {}
123123
/** @param resource|string|null $to */
124124
function imagewbmp(GdImage $im, $to = null, ?int $foreground = null): bool {}
125125

126-
function imagegd(GdImage $im, $to = UNKNOWN): bool {}
126+
function imagegd(GdImage $im, string $to = UNKNOWN): bool {}
127127

128-
function imagegd2(GdImage $im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
128+
function imagegd2(GdImage $im, string $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
129129

130130
#ifdef HAVE_GD_BMP
131131
/** @param resource|string|null $to */

ext/gd/gd_arginfo.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 14cd8fc3865f7ef2b88c4834fbf33d360b302794 */
2+
* Stub hash: a792b0c5497013c85cca83c4baab928a5191f3b9 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
55
ZEND_END_ARG_INFO()
@@ -241,12 +241,12 @@ ZEND_END_ARG_INFO()
241241

242242
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd, 0, 1, _IS_BOOL, 0)
243243
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
244-
ZEND_ARG_INFO(0, to)
244+
ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
245245
ZEND_END_ARG_INFO()
246246

247247
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd2, 0, 1, _IS_BOOL, 0)
248248
ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
249-
ZEND_ARG_INFO(0, to)
249+
ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
250250
ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
251251
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
252252
ZEND_END_ARG_INFO()

ext/gmp/gmp.stub.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,26 @@ function gmp_sqrt($a): GMP|false {}
9090
/** @param GMP|int|bool|string $a */
9191
function gmp_sqrtrem($a): array|false {}
9292

93-
/** @param GMP|int|bool|string $a **/
93+
/** @param GMP|int|bool|string $a */
9494
function gmp_root($a, int $nth): GMP|false {}
9595

96-
/** @param GMP|int|bool|string $a **/
96+
/** @param GMP|int|bool|string $a */
9797
function gmp_rootrem($a, int $nth): array|false {}
9898

99-
/** @param GMP|int|bool|string $base **/
99+
/** @param GMP|int|bool|string $base */
100100
function gmp_pow($base, int $exp): GMP|false {}
101101

102102
/**
103103
* @param GMP|int|bool|string $base
104104
* @param GMP|int|bool|string $exp
105105
* @param GMP|int|bool|string $mod
106-
**/
106+
*/
107107
function gmp_powm($base, $exp, $mod): GMP|false {}
108108

109-
/** @param GMP|int|bool|string $a **/
109+
/** @param GMP|int|bool|string $a */
110110
function gmp_perfect_square($a): bool {}
111111

112-
/** @param GMP|int|bool|string $a **/
112+
/** @param GMP|int|bool|string $a */
113113
function gmp_perfect_power($a): bool {}
114114

115115
/** @param GMP|int|bool|string $a */

ext/gmp/gmp_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 3f96612dbbeac0ae619461e400e91b3a15e0cd9c */
2+
* Stub hash: 4b5e54ee34a3cb6471d5a3c30c50e218a80347c0 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_init, 0, 1, GMP, MAY_BE_FALSE)
55
ZEND_ARG_INFO(0, number)

0 commit comments

Comments
 (0)