Re: [RFC][Vote] Return Types

From: Date: Thu, 06 Nov 2014 15:15:55 +0000
Subject: Re: [RFC][Vote] Return Types
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-78822@lists.php.net to get a copy of this message
> On 6 Nov 2014, at 15:08, Dmitry Stogov <dmitry@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/

« previous php.internals (#78822) next »