[php-src] Issue #8599: Warn when passing extra undeclared (unnamed) argument

From: Date: Sat, 21 May 2022 11:33:52 +0000
Subject: [php-src] Issue #8599: Warn when passing extra undeclared (unnamed) argument
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241568@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8599 Author: mvorisek ### Description This is a feature request. Code: ``` function f($x = 5) { } f(10, 10); ``` demo: https://3v4l.org/8JI1J should emit at least warning if the passed argument count is greater than the declared parameters. Most of the time, it is an issue/typo in the code and this feature request will detect it. When accepting an extra arguments is desired, ...$args param can be declared. For cases, when the child interfaces cannot be adjusted (https://3v4l.org/1E25q), a special attribute should be introduced and when declared, the check from this feature request will not apply.

« previous php.bugs (#241568) next »