> On 6 Nov 2014, at 15:08, Dmitry Stogov <dmi...@zend.com> wrote: > > Use A or B for return type in B::foo(). It'll lead to compile error anyway > (Class C is not defined). > It's not possible to compile this by design.
Ok, let’s try this: <?php class A { function foo(): C {} } class B extends A { function foo(): B {} } class C extends B { function foo(): C {} } ?> I don’t think this can’t be compiled. When you get to B, you know that A doesn’t extend anything, and B doesn’t extend C, so C can’t possibly be a superclass of B, and it would fail, right? -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php