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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 8 additions & 6 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 8 additions & 3 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 25 additions & 25 deletions
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

0 commit comments

Comments
 (0)