Re: RFC: Return Types Update

From: Date: Thu, 16 Oct 2014 15:05:45 +0000
Subject: Re: RFC: Return Types Update
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-78117@lists.php.net to get a copy of this message
Hi Levi, This RFC is pretty consistent, small and focused on a specific part of the overall previously desired support. I do think many more subsequent RFCs would come up after this one to expand return typehint support, but as it stands right now is extremely good. Any further inclusion would drastically delay possible acceptance of this RFC and a possible withdrawn, since every piece left out are different discussion points. +1 so far. []s, On Thu, Oct 16, 2014 at 10:46 AM, Nikita Nefedov <inefedor@gmail.com> wrote: > On Thu, 16 Oct 2014 18:39:06 +0400, Davey Shafik <davey@php.net> wrote: > > I very much like this — though I would say it was dependent on the >> nullable >> types RFC (like splat and variadics were codependent). >> >> While I would like to see the introduction of a void type, I understand >> and >> respect the limitations on the RFC. >> >> However, one thing that I do think is missing, is the equivalent of Hacks >> $this return type. You have >> self and parent, but I think without >> a >> static equivalent you can break things: >> >> class foo { >> static public function instanceOf(): self { >> return new static(); >> } >> } >> >> class bar extends foo { } >> >> foo::instanceOf(); // new foo, this is fine, returns self. >> bar::instanceOf(); // new bar, no longer self >> > > Hi, > > bar is considered as instance of foo so shouldn't be any problem. > Otherwise it would break LSP > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco MSN: guilhermeblanco@hotmail.com GTalk: guilhermeblanco Toronto - ON/Canada

« previous php.internals (#78117) next »