<?php
class foo {
public function bar($a) {
echo "$a $b";
}
}
class baz extends foo {
public function bar($a, $b) {
echo "$b $a";
}
}
$bar = new baz;
$bar->bar();
Fatal error: Declaration of baz::bar($a, $b) must be compatible with foo::bar($a) in /in/QQ3AU on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of baz::bar($a, $b) should be compatible with foo::bar($a) in /in/QQ3AU on line 10
Fatal error: Uncaught ArgumentCountError: Too few arguments to function baz::bar(), 0 passed in /in/QQ3AU on line 16 and exactly 2 expected in /in/QQ3AU:10
Stack trace:
#0 /in/QQ3AU(16): baz->bar()
#1 {main}
thrown in /in/QQ3AU on line 10
Process exited with code 255.
Warning: Declaration of baz::bar($a, $b) should be compatible with foo::bar($a) in /in/QQ3AU on line 13
Fatal error: Uncaught ArgumentCountError: Too few arguments to function baz::bar(), 0 passed in /in/QQ3AU on line 16 and exactly 2 expected in /in/QQ3AU:10
Stack trace:
#0 /in/QQ3AU(16): baz->bar()
#1 {main}
thrown in /in/QQ3AU on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Warning: Declaration of baz::bar($a, $b) should be compatible with foo::bar($a) in /in/QQ3AU on line 13
Warning: Missing argument 1 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10
Warning: Missing argument 2 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10
Notice: Undefined variable: b in /in/QQ3AU on line 11
Notice: Undefined variable: a in /in/QQ3AU on line 11
Strict Standards: Declaration of baz::bar() should be compatible with foo::bar($a) in /in/QQ3AU on line 13
Warning: Missing argument 1 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10
Warning: Missing argument 2 for baz::bar(), called in /in/QQ3AU on line 16 and defined in /in/QQ3AU on line 10
Notice: Undefined variable: b in /in/QQ3AU on line 11
Notice: Undefined variable: a in /in/QQ3AU on line 11