<?php
class A {
function test() {
var_dump('super class');
}
}
class B extends A {
function test($a) {
var_dump('inherited class');
}
}
$b = new B;
$b->test();
$b->test(1);
Fatal error: Declaration of B::test($a) must be compatible with A::test() in /in/FDKbO on line 9
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::test($a) should be compatible with A::test() in /in/FDKbO on line 9
Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::test(), 0 passed in /in/FDKbO on line 15 and exactly 1 expected in /in/FDKbO:9
Stack trace:
#0 /in/FDKbO(15): B->test()
#1 {main}
thrown in /in/FDKbO on line 9
Process exited with code 255.
Warning: Declaration of B::test($a) should be compatible with A::test() in /in/FDKbO on line 12
Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::test(), 0 passed in /in/FDKbO on line 15 and exactly 1 expected in /in/FDKbO:9
Stack trace:
#0 /in/FDKbO(15): B->test()
#1 {main}
thrown in /in/FDKbO on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of B::test($a) should be compatible with A::test() in /in/FDKbO on line 12
Warning: Missing argument 1 for B::test(), called in /in/FDKbO on line 15 and defined in /in/FDKbO on line 9
string(15) "inherited class"
string(15) "inherited class"
Strict Standards: Declaration of B::test() should be compatible with A::test() in /in/FDKbO on line 12
Warning: Missing argument 1 for B::test(), called in /in/FDKbO on line 15 and defined in /in/FDKbO on line 9
string(15) "inherited class"
string(15) "inherited class"
Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /in/FDKbO on line 12
Warning: Missing argument 1 for B::test(), called in /in/FDKbO on line 15 and defined in /in/FDKbO on line 9
string(15) "inherited class"
string(15) "inherited class"
Output for 5.0.0 - 5.0.5
Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /in/FDKbO on line 12
Warning: Missing argument 1 for B::test() in /in/FDKbO on line 9
string(15) "inherited class"
string(15) "inherited class"
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Warning: Missing argument 1 for test() in /in/FDKbO on line 9
string(15) "inherited class"
string(15) "inherited class"