What is wrong with this example of class inheritance? [duplicate]
问题 This question already has answers here : Override method parameter with child interface as a new parameter (2 answers) Abstract function parameter type hint overriding in PHP 7 (2 answers) Closed 4 months ago . This code of dependency inversion should work fine but instead it gives error. What am I doing wrong in here? interface A { } abstract class B implements A { } class C extends B { } abstract class D { public function foo(A $a) { } } class E extends D { public function foo(C $c) { } }