interface I<p>{<p>function foo(stdClass $arg);<p>}<p>class Test extends stdClass<p>{<p>}<p>class Implementation implements I<p>{<p>function foo(Test $arg)<p>{<p>}<p>}<p>Result:<p>Fatal error: Declaration of InterfaceImplementation::foo() must be compatible with I::foo(stdClass $arg) in test.php on line XY<p>How come that I can't type hint a subtype in the implementation?
It has to work with all subtypes of stdClass, since in order for the interface to hold its word, I need to be able to get an object thats implements I, and pass it any stdClass, regardless of what they do with it.