<?php
class Foo {
public static function test($bar = null) {
var_dump(func_get_args());
}
}
class Baz extends Foo {
public static function test($bar, ...$args) {
parent::test(...$args);
}
}
Baz::test();
Baz::test('hello');
Fatal error: Declaration of Baz::test($bar, ...$args) must be compatible with Foo::test($bar = null) in /in/ZgVsS on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of Baz::test($bar, ...$args) should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 10
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Baz::test(), 0 passed in /in/ZgVsS on line 15 and exactly 1 expected in /in/ZgVsS:10
Stack trace:
#0 /in/ZgVsS(15): Baz::test()
#1 {main}
thrown in /in/ZgVsS on line 10
Process exited with code 255.
Warning: Declaration of Baz::test($bar, ...$args) should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 13
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Baz::test(), 0 passed in /in/ZgVsS on line 15 and exactly 1 expected in /in/ZgVsS:10
Stack trace:
#0 /in/ZgVsS(15): Baz::test()
#1 {main}
thrown in /in/ZgVsS on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.32
Warning: Declaration of Baz::test($bar, ...$args) should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 13
Warning: Missing argument 1 for Baz::test(), called in /in/ZgVsS on line 15 and defined in /in/ZgVsS on line 10
array(0) {
}
array(0) {
}
Output for 5.6.0 - 5.6.38
Strict Standards: Declaration of Baz::test() should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 13
Warning: Missing argument 1 for Baz::test(), called in /in/ZgVsS on line 15 and defined in /in/ZgVsS on line 10
array(0) {
}
array(0) {
}
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/ZgVsS on line 10
Process exited with code 255.