<?php
class Pass
{
public function test($a, $b = 'test') {
}
}
class PassToo
extends Pass
{
public function test($a, $b = 'test', $c = null) {
}
}
class Fail
extends Pass
{
public function test($a, $b = 'test', $c) {
}
}
class FailToo
extends Pass
{
public function test($a, $b, $c) {
}
}
(new Pass)->test(1, 2);
(new PassToo)->test(1, 2);
(new Fail)->test(1, 2);
(new FailToo)->test(1, 2);
Deprecated: Optional parameter $b declared before required parameter $c is implicitly treated as a required parameter in /in/pD4NO on line 19
Fatal error: Declaration of Fail::test($a, $b, $c) must be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 19
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $c follows optional parameter $b in /in/pD4NO on line 19
Fatal error: Declaration of Fail::test($a, $b, $c) must be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 19
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of Fail::test($a, $b, $c) should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 19
Warning: Declaration of FailToo::test($a, $b, $c) should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 27
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Fail::test(), 2 passed in /in/pD4NO on line 35 and exactly 3 expected in /in/pD4NO:19
Stack trace:
#0 /in/pD4NO(35): Fail->test(1, 2)
#1 {main}
thrown in /in/pD4NO on line 19
Process exited with code 255.
Warning: Declaration of Fail::test($a, $b, $c) should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 21
Warning: Declaration of FailToo::test($a, $b, $c) should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 29
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Fail::test(), 2 passed in /in/pD4NO on line 35 and exactly 3 expected in /in/pD4NO:19
Stack trace:
#0 /in/pD4NO(35): Fail->test(1, 2)
#1 {main}
thrown in /in/pD4NO on line 19
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of Fail::test($a, $b, $c) should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 21
Warning: Declaration of FailToo::test($a, $b, $c) should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 29
Warning: Missing argument 3 for Fail::test(), called in /in/pD4NO on line 35 and defined in /in/pD4NO on line 19
Warning: Missing argument 3 for FailToo::test(), called in /in/pD4NO on line 36 and defined in /in/pD4NO on line 27
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Declaration of Fail::test() should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 21
Strict Standards: Declaration of FailToo::test() should be compatible with Pass::test($a, $b = 'test') in /in/pD4NO on line 29
Warning: Missing argument 3 for Fail::test(), called in /in/pD4NO on line 35 and defined in /in/pD4NO on line 19
Warning: Missing argument 3 for FailToo::test(), called in /in/pD4NO on line 36 and defined in /in/pD4NO on line 27