<?php
namespace{
class B{}
class A{
function test(B $b){}
}
}
namespace NS{
class B extends \B{}
class A1 extends \A{
function test(B $b){}
}
}
namespace{
$x = new \NS\A1;
$x->test(new \B);
$x->test(new \NS\B);
}
Fatal error: Declaration of NS\A1::test(NS\B $b) must be compatible with A::test(B $b) in /in/Ptq2g on line 13
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of NS\A1::test(NS\B $b) should be compatible with A::test(B $b) in /in/Ptq2g on line 13
Fatal error: Uncaught TypeError: Argument 1 passed to NS\A1::test() must be an instance of NS\B, instance of B given, called in /in/Ptq2g on line 19 and defined in /in/Ptq2g:13
Stack trace:
#0 /in/Ptq2g(19): NS\A1->test(Object(B))
#1 {main}
thrown in /in/Ptq2g on line 13
Process exited with code 255.
Warning: Declaration of NS\A1::test(NS\B $b) should be compatible with A::test(B $b) in /in/Ptq2g on line 14
Fatal error: Uncaught TypeError: Argument 1 passed to NS\A1::test() must be an instance of NS\B, instance of B given, called in /in/Ptq2g on line 19 and defined in /in/Ptq2g:13
Stack trace:
#0 /in/Ptq2g(19): NS\A1->test(Object(B))
#1 {main}
thrown in /in/Ptq2g on line 13
Process exited with code 255.
Catchable fatal error: Argument 1 passed to NS\A1::test() must be an instance of NS\B, instance of B given, called in /in/Ptq2g on line 19 and defined in /in/Ptq2g on line 13
Process exited with code 255.