|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-11-02 16:48 UTC] nikic@php.net
Description:
------------
Should be allowed and was allowed in 5.6. Off by one error caused by the variadic parameter no longer counting as an argument.
Test script:
---------------
class Foo {
public function test($bar = null) {}
}
class Baz extends Foo {
public function test(...$args) {}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 14:00:01 2025 UTC |
Actually this issue also exists in PHP 5.6 if you have more than one optional parameter: class Foo { public function test($foo = null, $bar = null) {} } class Baz extends Foo { public function test(...$args) {} } The fact that it worked for one was just an accident that PHP 7 fixed. We should allow changing any number of optional arguments to a variadic one in both 5.6 and 7.0.