[php-src] Issue #20821: func_get_args(associative: true)
[email protected] (geek-merlin)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20821
Author: geek-merlin
### Description
As a developer, in a function or method, i want to know, which parameters have been called by name.
Use cases:
```
function foo(string $para): void {
assert(array_key_first(func_get_args(true)) === 0, 'Calling foo with named parameter is not supported, name may change any time, only position is guaranteed.');
...
}
function bar(string $bazBird, string $bazBee, string $bazTree): void {
assert(array_diff(array_keys(func_get_args(true)), ['bazBird', 'bazBee', 'bazTree']) === [] , 'Calling foo with positional parameter is not supported, position may change any time, only name is guaranteed.');
...
}
```