mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
* The array "subject" of a function gets called $array. * Further parameters should be self-descriptive if used as a named parameter, and a full word, not an abbreviation. * If there is a "bunch more arrays" variadic, it gets called $arrays (because that's what was already there). * A few functions have a variadic "a bunch more arrays, and then a callable", and were already called $rest. I left those as is and died a little inside. * Any callable provided to an array function that acts on the array is called $callback. (Nearly all were already, I just fixed the one or two outliers.) * array_multisort() is beyond help so I ran screaming.
39 lines
768 B
PHP
39 lines
768 B
PHP
--TEST--
|
|
Required parameter not passed
|
|
--FILE--
|
|
<?php
|
|
|
|
function test($a, $b, $c, $d) {
|
|
}
|
|
|
|
try {
|
|
test(a: 'a', d: 'd');
|
|
} catch (ArgumentCountError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
array_keys(strict: true);
|
|
} catch (ArgumentCountError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
array_keys([], strict: true);
|
|
} catch (ArgumentCountError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
// This works fine, as search_value is explicitly specified.
|
|
var_dump(array_keys([41, 42], filter_value: 42, strict: true));
|
|
|
|
?>
|
|
--EXPECT--
|
|
test(): Argument #2 ($b) not passed
|
|
array_keys(): Argument #1 ($array) not passed
|
|
array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
|
|
array(1) {
|
|
[0]=>
|
|
int(1)
|
|
}
|