[php-src] Issue #9540: Declaration should be compatible warning/error should be relieved on ...$args

From: Date: Wed, 14 Sep 2022 14:33:40 +0000
Subject: [php-src] Issue #9540: Declaration should be compatible warning/error should be relieved on ...$args
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242415@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9540 Author: AlexAT ### Description ``` class A { public function a($x, $y, $z) { } } class B extends A { protected $t; public function a($x, ...$args) { if ($this->t) return false; parent::a($x, ...$args); } } ``` Results in ``` Declaration of B::f($x, ...$args) should be compatible with A::f($x, $y, $z) ``` warning/error, while it is perfectly compatible. Extra lines in example are to present specific usage pattern of extending object method with specific check without listing all arguments that are only needed to parent method. ### PHP Version PHP 7.x, 8.x ### Operating System _No response_

« previous php.bugs (#242415) next »