Skip to content

Prepare more array functions for named parameters #6032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ function array_merge(array ...$arrays): array {}

function array_merge_recursive(array ...$arrays): array {}

function array_replace(array $array1, array ...$arrays): array {}
function array_replace(array $input, array ...$replacements): array {}

function array_replace_recursive(array $array1, array ...$arrays): array {}
function array_replace_recursive(array $input, array ...$replacements): array {}

function array_keys(array $array, mixed $search_value = UNKNOWN, bool $strict = false): array {}

Expand All @@ -179,26 +179,26 @@ function array_change_key_case(array $array, int $case = CASE_LOWER): array {}

function array_unique(array $array, int $flags = SORT_STRING): array {}

function array_intersect_key(array $array1, array $array2, array ...$arrays): array {}
function array_intersect_key(array $input, array $include, array ...$arrays): array {}

/** @param array|callable $rest */
function array_intersect_ukey(array $array1, array $array2, ...$rest): array {}
function array_intersect_ukey(array $input, array $include, ...$rest): array {}

function array_intersect(array $array1, array $array2, array ...$arrays): array {}
function array_intersect(array $input, array $include, array ...$arrays): array {}

/** @param array|callable $rest */
function array_uintersect(array $array1, array $array2, ...$rest): array {}
function array_uintersect(array $input, array $include, ...$rest): array {}

function array_intersect_assoc(array $array1, array $array2, array ...$arrays): array {}
function array_intersect_assoc(array $input, array $include, array ...$rest): array {}

/** @param array|callable $rest */
function array_uintersect_assoc(array $array1, array $array2, ...$rest): array {}
function array_uintersect_assoc(array $input, array $include, ...$rest): array {}

/** @param array|callable $rest */
function array_intersect_uassoc(array $array1, array $array2, ...$rest): array {}
function array_intersect_uassoc(array $input, array $include, ...$rest): array {}

/** @param array|callable $rest */
function array_uintersect_uassoc(array $array1, array $array2, ...$rest): array {}
function array_uintersect_uassoc(array $input, array $include, ...$rest): array {}

function array_diff_key(array $array1, array $array2, array ...$arrays): array {}

Expand Down Expand Up @@ -243,7 +243,7 @@ function array_reduce(array $array, callable $callback, mixed $initial = null):

function array_filter(array $array, ?callable $callback = null, int $use_keys = 0): array {}

function array_map(?callable $callback, array $array1, array ...$arrays): array {}
function array_map(?callable $callback, array $input, array ...$rest): array {}

/** @param int|string $key */
function array_key_exists($key, array $search): bool {}
Expand Down
48 changes: 30 additions & 18 deletions ext/standard/basic_functions_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8b6ef365e9635c92ef86adb40b2aba077867f3b2 */
* Stub hash: 0f6a324f551636fb1d95c9c0c3f75da312f2d38a */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
Expand Down Expand Up @@ -220,8 +220,8 @@ ZEND_END_ARG_INFO()
#define arginfo_array_merge_recursive arginfo_array_merge

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_replace, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, replacements, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

#define arginfo_array_replace_recursive arginfo_array_replace
Expand Down Expand Up @@ -274,44 +274,56 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unique, 0, 1, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_key, 0, 2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, include, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_ukey, 0, 2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, include, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_INFO(0, rest)
ZEND_END_ARG_INFO()

#define arginfo_array_intersect arginfo_array_intersect_key

#define arginfo_array_uintersect arginfo_array_intersect_ukey

#define arginfo_array_intersect_assoc arginfo_array_intersect_key
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_assoc, 0, 2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, include, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, rest, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

#define arginfo_array_uintersect_assoc arginfo_array_intersect_ukey

#define arginfo_array_intersect_uassoc arginfo_array_intersect_ukey

#define arginfo_array_uintersect_uassoc arginfo_array_intersect_ukey

#define arginfo_array_diff_key arginfo_array_intersect_key
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_diff_key, 0, 2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array2, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

#define arginfo_array_diff_ukey arginfo_array_intersect_ukey
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_diff_ukey, 0, 2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, array2, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_INFO(0, rest)
ZEND_END_ARG_INFO()

#define arginfo_array_diff arginfo_array_intersect_key
#define arginfo_array_diff arginfo_array_diff_key

#define arginfo_array_udiff arginfo_array_intersect_ukey
#define arginfo_array_udiff arginfo_array_diff_ukey

#define arginfo_array_diff_assoc arginfo_array_intersect_key
#define arginfo_array_diff_assoc arginfo_array_diff_key

#define arginfo_array_diff_uassoc arginfo_array_intersect_ukey
#define arginfo_array_diff_uassoc arginfo_array_diff_ukey

#define arginfo_array_udiff_assoc arginfo_array_intersect_ukey
#define arginfo_array_udiff_assoc arginfo_array_diff_ukey

#define arginfo_array_udiff_uassoc arginfo_array_intersect_ukey
#define arginfo_array_udiff_uassoc arginfo_array_diff_ukey

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_multisort, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, array1)
Expand Down Expand Up @@ -345,8 +357,8 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_map, 0, 2, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1)
ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
ZEND_ARG_VARIADIC_TYPE_INFO(0, rest, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_key_exists, 0, 2, _IS_BOOL, 0)
Expand Down
96 changes: 48 additions & 48 deletions ext/standard/tests/array/array_intersect_assoc_variation1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -113,75 +113,75 @@ echo "Done";
--EXPECT--
*** Testing array_intersect_assoc() : Passing non-array values to $array1 argument ***

-- Iteration 1 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
-- Iteration 1 --array_intersect_assoc(): Argument #1 ($input) must be of type array, int given
array_intersect_assoc(): Argument #1 ($input) must be of type array, int given

-- Iteration 2 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
-- Iteration 2 --array_intersect_assoc(): Argument #1 ($input) must be of type array, int given
array_intersect_assoc(): Argument #1 ($input) must be of type array, int given

-- Iteration 3 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
-- Iteration 3 --array_intersect_assoc(): Argument #1 ($input) must be of type array, int given
array_intersect_assoc(): Argument #1 ($input) must be of type array, int given

-- Iteration 4 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given
-- Iteration 4 --array_intersect_assoc(): Argument #1 ($input) must be of type array, int given
array_intersect_assoc(): Argument #1 ($input) must be of type array, int given

-- Iteration 5 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
-- Iteration 5 --array_intersect_assoc(): Argument #1 ($input) must be of type array, float given
array_intersect_assoc(): Argument #1 ($input) must be of type array, float given

-- Iteration 6 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
-- Iteration 6 --array_intersect_assoc(): Argument #1 ($input) must be of type array, float given
array_intersect_assoc(): Argument #1 ($input) must be of type array, float given

-- Iteration 7 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
-- Iteration 7 --array_intersect_assoc(): Argument #1 ($input) must be of type array, float given
array_intersect_assoc(): Argument #1 ($input) must be of type array, float given

-- Iteration 8 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
-- Iteration 8 --array_intersect_assoc(): Argument #1 ($input) must be of type array, float given
array_intersect_assoc(): Argument #1 ($input) must be of type array, float given

-- Iteration 9 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given
-- Iteration 9 --array_intersect_assoc(): Argument #1 ($input) must be of type array, float given
array_intersect_assoc(): Argument #1 ($input) must be of type array, float given

-- Iteration 10 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
-- Iteration 10 --array_intersect_assoc(): Argument #1 ($input) must be of type array, null given
array_intersect_assoc(): Argument #1 ($input) must be of type array, null given

-- Iteration 11 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
-- Iteration 11 --array_intersect_assoc(): Argument #1 ($input) must be of type array, null given
array_intersect_assoc(): Argument #1 ($input) must be of type array, null given

-- Iteration 12 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
-- Iteration 12 --array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given

-- Iteration 13 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
-- Iteration 13 --array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given

-- Iteration 14 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
-- Iteration 14 --array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given

-- Iteration 15 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given
-- Iteration 15 --array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given
array_intersect_assoc(): Argument #1 ($input) must be of type array, bool given

-- Iteration 16 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
-- Iteration 16 --array_intersect_assoc(): Argument #1 ($input) must be of type array, string given
array_intersect_assoc(): Argument #1 ($input) must be of type array, string given

-- Iteration 17 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
-- Iteration 17 --array_intersect_assoc(): Argument #1 ($input) must be of type array, string given
array_intersect_assoc(): Argument #1 ($input) must be of type array, string given

-- Iteration 18 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
-- Iteration 18 --array_intersect_assoc(): Argument #1 ($input) must be of type array, string given
array_intersect_assoc(): Argument #1 ($input) must be of type array, string given

-- Iteration 19 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
-- Iteration 19 --array_intersect_assoc(): Argument #1 ($input) must be of type array, string given
array_intersect_assoc(): Argument #1 ($input) must be of type array, string given

-- Iteration 20 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given
-- Iteration 20 --array_intersect_assoc(): Argument #1 ($input) must be of type array, string given
array_intersect_assoc(): Argument #1 ($input) must be of type array, string given

-- Iteration 21 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, classA given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, classA given
-- Iteration 21 --array_intersect_assoc(): Argument #1 ($input) must be of type array, classA given
array_intersect_assoc(): Argument #1 ($input) must be of type array, classA given

-- Iteration 22 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
-- Iteration 22 --array_intersect_assoc(): Argument #1 ($input) must be of type array, null given
array_intersect_assoc(): Argument #1 ($input) must be of type array, null given

-- Iteration 23 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given
-- Iteration 23 --array_intersect_assoc(): Argument #1 ($input) must be of type array, null given
array_intersect_assoc(): Argument #1 ($input) must be of type array, null given

-- Iteration 24 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, resource given
array_intersect_assoc(): Argument #1 ($array1) must be of type array, resource given
-- Iteration 24 --array_intersect_assoc(): Argument #1 ($input) must be of type array, resource given
array_intersect_assoc(): Argument #1 ($input) must be of type array, resource given
Done
Loading