Skip to content

Commit 4a4b29d

Browse files
committed
Add all the missing parameter types to stubs
1 parent 046cc5e commit 4a4b29d

27 files changed

+236
-184
lines changed

ext/dom/php_dom.stub.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ public function __construct(string $data = "") {}
1818

1919
interface DOMParentNode
2020
{
21-
/** @var ...DOMNode|string $nodes */
21+
/** @param DOMNode|string $nodes */
2222
public function append(...$nodes): void;
2323

24-
/** @var ...DOMNode|string $nodes */
24+
/** @param DOMNode|string $nodes */
2525
public function prepend(...$nodes): void;
2626
}
2727

2828
interface DOMChildNode
2929
{
3030
public function remove(): void;
3131

32-
/** @var ...DOMNode|string $nodes */
32+
/** @param DOMNode|string $nodes */
3333
public function before(... $nodes): void;
3434

35-
/** @var ...DOMNode|string $nodes */
35+
/** @param DOMNode|string $nodes */
3636
public function after(...$nodes): void;
3737

38-
/** @var ...DOMNode|string $nodes */
38+
/** @param DOMNode|string $nodes */
3939
public function replaceWith(...$nodes): void;
4040
}
4141

@@ -116,10 +116,10 @@ public function __construct() {}
116116
/** @return bool */
117117
public function appendXML(string $data) {}
118118

119-
/** @var ...DOMNode|string $nodes */
119+
/** @param DOMNode|string $nodes */
120120
public function append(...$nodes): void {}
121121

122-
/** @var ...DOMNode|string $nodes */
122+
/** @param DOMNode|string $nodes */
123123
public function prepend(...$nodes): void {}
124124
}
125125

@@ -151,15 +151,15 @@ public function deleteData(int $offset, int $count) {}
151151
/** @return bool */
152152
public function replaceData(int $offset, int $count, string $data) {}
153153

154-
/** @var ...DOMNode|string $nodes */
154+
/** @param DOMNode|string $nodes */
155155
public function replaceWith(...$nodes): void {}
156156

157157
public function remove(): void {}
158158

159-
/** @var ...DOMNode|string $nodes */
159+
/** @param DOMNode|string $nodes */
160160
public function before(... $nodes): void {}
161161

162-
/** @var ...DOMNode|string $nodes */
162+
/** @param DOMNode|string $nodes */
163163
public function after(...$nodes): void {}
164164
}
165165

@@ -231,19 +231,19 @@ public function setIdAttributeNode(DOMAttr $attr, bool $isId) {}
231231

232232
public function remove(): void {}
233233

234-
/** @var ...DOMNode|string $nodes */
234+
/** @param DOMNode|string $nodes */
235235
public function before(... $nodes): void {}
236236

237-
/** @var ...DOMNode|string $nodes */
237+
/** @param DOMNode|string $nodes */
238238
public function after(...$nodes): void {}
239239

240-
/** @var ...DOMNode|string $nodes */
240+
/** @param DOMNode|string $nodes */
241241
public function replaceWith(...$nodes): void {}
242242

243-
/** @var ...DOMNode|string $nodes */
243+
/** @param DOMNode|string $nodes */
244244
public function append(...$nodes): void {}
245245

246-
/** @var ...DOMNode|string $nodes */
246+
/** @param DOMNode|string $nodes */
247247
public function prepend(...$nodes): void {}
248248
}
249249

@@ -348,10 +348,10 @@ public function xinclude(int $options = 0) {}
348348
/** @return DOMNode|false */
349349
public function adoptNode(DOMNode $node) {}
350350

351-
/** @var ...DOMNode|string $nodes */
351+
/** @param DOMNode|string $nodes */
352352
public function append(...$nodes): void {}
353353

354-
/** @var ...DOMNode|string $nodes */
354+
/** @param DOMNode|string $nodes */
355355
public function prepend(...$nodes): void {}
356356
}
357357

ext/dom/php_dom_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: 3ecc7d640235675f1f573f043e68f11a4fca0bad */
2+
* Stub hash: 6d25769eb3f8686042dccc55d8d8bd5e3852676f */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
55
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)

ext/ffi/ffi.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,7 +3747,7 @@ ZEND_METHOD(FFI, free) /* {{{ */
37473747
ZEND_METHOD(FFI, cast) /* {{{ */
37483748
{
37493749
zend_string *type_def = NULL;
3750-
zval *ztype = NULL;
3750+
zend_object *ztype = NULL;
37513751
zend_ffi_type *old_type, *type, *type_ptr;
37523752
zend_ffi_cdata *old_cdata, *cdata;
37533753
zend_bool is_const = 0;
@@ -3756,12 +3756,8 @@ ZEND_METHOD(FFI, cast) /* {{{ */
37563756

37573757
ZEND_FFI_VALIDATE_API_RESTRICTION();
37583758
ZEND_PARSE_PARAMETERS_START(2, 2)
3759-
if (Z_TYPE_P(EX_VAR_NUM(0)) == IS_STRING) {
3760-
Z_PARAM_STR(type_def)
3761-
} else {
3762-
Z_PARAM_OBJECT_OF_CLASS(ztype, zend_ffi_ctype_ce)
3763-
}
3764-
Z_PARAM_ZVAL(zv);
3759+
Z_PARAM_STR_OR_OBJ_OF_CLASS(type_def, ztype, zend_ffi_ctype_ce)
3760+
Z_PARAM_ZVAL(zv)
37653761
ZEND_PARSE_PARAMETERS_END();
37663762

37673763
arg = zv;
@@ -3818,7 +3814,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */
38183814

38193815
type_ptr = dcl.type;
38203816
} else {
3821-
zend_ffi_ctype *ctype = (zend_ffi_ctype*)Z_OBJ_P(ztype);
3817+
zend_ffi_ctype *ctype = (zend_ffi_ctype*) ztype;
38223818

38233819
type_ptr = type = ctype->type;
38243820
if (ZEND_FFI_TYPE_IS_OWNED(type)) {

ext/ffi/ffi.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ public static function new($type, bool $owned = true, bool $persistent = false):
1717
public static function free(FFI\CData $ptr): void {}
1818

1919
/**
20-
* @param FFI\CType|string $type
20+
* @param FFI\CData $ptr
2121
* @prefer-ref $ptr
2222
*/
23-
public static function cast($type, $ptr): ?FFI\CData {}
23+
public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
2424

2525
public static function type(string $type): ?FFI\CType {}
2626

@@ -39,9 +39,9 @@ public static function sizeof(object $ptr): ?int {}
3939
public static function alignof(object $ptr): ?int {}
4040

4141
/**
42+
* @param FFI\CData|string $src
4243
* @prefer-ref $dst
4344
* @prefer-ref $src
44-
* @param string|FFI\CData $dst
4545
*/
4646
public static function memcpy(FFI\CData $dst, $src, int $size): void {}
4747

ext/ffi/ffi_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: e66d306e0dbe08ec3d66935c69ab9e36b9b8165a */
2+
* Stub hash: fc700bbcced0689e4e5363e4003a84d162258555 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"")
@@ -25,7 +25,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_free, 0, 1, IS_VOID, 0
2525
ZEND_END_ARG_INFO()
2626

2727
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cast, 0, 2, FFI\\CData, 1)
28-
ZEND_ARG_INFO(0, type)
28+
ZEND_ARG_OBJ_TYPE_MASK(0, type, FFI\\CType, MAY_BE_STRING, NULL)
2929
ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
3030
ZEND_END_ARG_INFO()
3131

ext/gd/gd.stub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ function imagettfbbox(float $size, float $angle, string $font_file, string $text
224224
function imagettftext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text): array|false {}
225225
#endif
226226

227+
/**
228+
* @param int|float $arg1
229+
* @param int|bool $arg2
230+
* @param array|int $arg3
231+
* @param int $arg4
232+
*/
227233
function imagefilter(GdImage $im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
228234

229235
function imageconvolution(GdImage $im, array $matrix3x3, float $div, float $offset): bool {}

ext/gd/gd_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: a792b0c5497013c85cca83c4baab928a5191f3b9 */
2+
* Stub hash: 9d4762ce89c5d601dc70cd9d2f4535c9c470d502 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
55
ZEND_END_ARG_INFO()

ext/pcre/php_pcre.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,8 +2380,10 @@ PHP_FUNCTION(preg_replace_callback)
23802380
/* {{{ Perform Perl-style regular expression replacement using replacement callback. */
23812381
PHP_FUNCTION(preg_replace_callback_array)
23822382
{
2383-
zval zv, *replace, *subject, *zcount = NULL;
2383+
zval zv, *replace, *zcount = NULL;
23842384
HashTable *pattern;
2385+
zend_string *subject_str;
2386+
HashTable *subject_ht;
23852387
zend_string *str_idx_regex;
23862388
zend_long limit = -1, flags = 0;
23872389
size_t replace_count = 0;
@@ -2391,7 +2393,7 @@ PHP_FUNCTION(preg_replace_callback_array)
23912393
/* Get function parameters and do error-checking. */
23922394
ZEND_PARSE_PARAMETERS_START(2, 5)
23932395
Z_PARAM_ARRAY_HT(pattern)
2394-
Z_PARAM_ZVAL(subject)
2396+
Z_PARAM_STR_OR_ARRAY_HT(subject_str, subject_ht)
23952397
Z_PARAM_OPTIONAL
23962398
Z_PARAM_LONG(limit)
23972399
Z_PARAM_ZVAL(zcount)
@@ -2419,14 +2421,7 @@ PHP_FUNCTION(preg_replace_callback_array)
24192421
ZVAL_COPY_VALUE(&fci.function_name, replace);
24202422

24212423
replace_count += preg_replace_func_impl(&zv, str_idx_regex, /* regex_ht */ NULL, &fci, &fcc,
2422-
Z_STR_P(subject), Z_ARRVAL_P(subject),
2423-
limit, flags);
2424-
2425-
if (subject != return_value) {
2426-
subject = return_value;
2427-
} else {
2428-
zval_ptr_dtor(return_value);
2429-
}
2424+
subject_str, subject_ht, limit, flags);
24302425

24312426
ZVAL_COPY_VALUE(return_value, &zv);
24322427

ext/pcre/php_pcre.stub.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22

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

5+
/** @param array $subpatterns */
56
function preg_match(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false {}
67

8+
/** @param array $subpatterns */
79
function preg_match_all(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false|null {}
810

11+
/** @param int $count */
912
function preg_replace(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
1013

14+
/** @param int $count */
1115
function preg_filter(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
1216

17+
/** @param int $count */
1318
function preg_replace_callback(string|array $regex, callable $callback, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
1419

15-
/** @param string|array $subject */
16-
function preg_replace_callback_array(array $pattern, $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
20+
/** @param int $count */
21+
function preg_replace_callback_array(array $pattern, array|string $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
1722

1823
function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false {}
1924

ext/pcre/php_pcre_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: 88e664fe3f4714ab7760a99bffef5c11eafcf0aa */
2+
* Stub hash: 55b55ddac9aafd3a3db5dd8eafe884769fad1d6a */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
@@ -38,7 +38,7 @@ ZEND_END_ARG_INFO()
3838

3939
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace_callback_array, 0, 2, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
4040
ZEND_ARG_TYPE_INFO(0, pattern, IS_ARRAY, 0)
41-
ZEND_ARG_INFO(0, subject)
41+
ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
4242
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "-1")
4343
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, count, "null")
4444
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")

0 commit comments

Comments
 (0)