Skip to content

Commit 43ce18f

Browse files
committed
Add proper count() parameter type
We can make this Countable|array now.
1 parent 41b096b commit 43ce18f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

ext/standard/basic_functions.stub.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,10 @@ function krsort(array &$array, int $flags = SORT_REGULAR): bool {}
6262

6363
function ksort(array &$array, int $flags = SORT_REGULAR): bool {}
6464

65-
/** @param Countable|array $var */
66-
function count($var, int $mode = COUNT_NORMAL): int {}
65+
function count(Countable|array $var, int $mode = COUNT_NORMAL): int {}
6766

68-
/**
69-
* @param Countable|array $var
70-
* @alias count
71-
*/
72-
function sizeof($var, int $mode = COUNT_NORMAL): int {}
67+
/** @alias count */
68+
function sizeof(Countable|array $var, int $mode = COUNT_NORMAL): int {}
7369

7470
function natsort(array &$array): bool {}
7571

ext/standard/basic_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: 5275c2ba801f36ecf17e6b615b19373aca34e852 */
2+
* Stub hash: 97187c073137b8fdfc03bdecf72377ef73d79290 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -82,7 +82,7 @@ ZEND_END_ARG_INFO()
8282
#define arginfo_ksort arginfo_krsort
8383

8484
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 1, IS_LONG, 0)
85-
ZEND_ARG_INFO(0, var)
85+
ZEND_ARG_OBJ_TYPE_MASK(0, var, Countable, MAY_BE_ARRAY, NULL)
8686
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "COUNT_NORMAL")
8787
ZEND_END_ARG_INFO()
8888

0 commit comments

Comments
 (0)