[php-src] Issue #20821: func_get_args(associative: true)
| From: | geek-merlin | Date: | Fri, 02 Jan 2026 13:43:55 +0000 |
| Subject: | [php-src] Issue #20821: func_get_args(associative: true) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251462@lists.php.net to get a copy of this message | ||
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.');
...
}
```