diff --git a/deprecated/array.php b/deprecated/array.php index 47565d0b..f0b3a20b 100644 --- a/deprecated/array.php +++ b/deprecated/array.php @@ -202,3 +202,27 @@ function usort(array &$array, callable $value_compare_func): void throw ArrayException::createFromPhpError(); } } + +/** + * Creates an array by using the values from the + * keys array as keys and the values from the + * values array as the corresponding values. + * + * @param array $keys Array of keys to be used. Illegal values for key will be + * converted to string. + * @param array $values Array of values to be used + * @return array Returns the combined array, FALSE if the number of elements + * for each array isn't equal. + * @throws ArrayException + * @deprecated + * + */ +function array_combine(array $keys, array $values): array +{ + error_clear_last(); + $result = \array_combine($keys, $values); + if ($result === false) { + throw ArrayException::createFromPhpError(); + } + return $result; +} diff --git a/deprecated/functionsList.php b/deprecated/functionsList.php index 74ce77f1..6b39199c 100644 --- a/deprecated/functionsList.php +++ b/deprecated/functionsList.php @@ -12,6 +12,7 @@ 'apc_load_constants', 'apc_sma_info', 'arsort', + 'array_combine', 'array_flip', 'asort', 'event_add', diff --git a/generated/array.php b/generated/array.php index f1fe2bde..37fa077a 100644 --- a/generated/array.php +++ b/generated/array.php @@ -4,30 +4,6 @@ use Safe\Exceptions\ArrayException; -/** - * Creates an array by using the values from the - * keys array as keys and the values from the - * values array as the corresponding values. - * - * @param array $keys Array of keys to be used. Illegal values for key will be - * converted to string. - * @param array $values Array of values to be used - * @return array Returns the combined array, FALSE if the number of elements - * for each array isn't equal. - * @throws ArrayException - * - */ -function array_combine(array $keys, array $values): array -{ - error_clear_last(); - $result = \array_combine($keys, $values); - if ($result === false) { - throw ArrayException::createFromPhpError(); - } - return $result; -} - - /** * array_replace_recursive replaces the values of * array with the same values from all the following diff --git a/generated/functionsList.php b/generated/functionsList.php index 58e78822..b1c28d6f 100644 --- a/generated/functionsList.php +++ b/generated/functionsList.php @@ -14,7 +14,6 @@ 'apcu_inc', 'apcu_sma_info', 'apc_fetch', - 'array_combine', 'array_replace', 'array_replace_recursive', 'array_walk_recursive', diff --git a/rector-migrate.php b/rector-migrate.php index d6d92b6c..cedb3668 100644 --- a/rector-migrate.php +++ b/rector-migrate.php @@ -24,7 +24,6 @@ 'apcu_inc' => 'Safe\apcu_inc', 'apcu_sma_info' => 'Safe\apcu_sma_info', 'apc_fetch' => 'Safe\apc_fetch', - 'array_combine' => 'Safe\array_combine', 'array_replace' => 'Safe\array_replace', 'array_replace_recursive' => 'Safe\array_replace_recursive', 'array_walk_recursive' => 'Safe\array_walk_recursive',