Re: RFC: Return Types Update

From: Date: Thu, 16 Oct 2014 14:39:06 +0000
Subject: Re: RFC: Return Types Update
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-78115@lists.php.net to get a copy of this message
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 On Thu, Oct 16, 2014 at 12:39 AM, Levi Morrison <levi_morrison@byu.edu> wrote: > Dear Internals, > > I finally have a working implementation for return types RFC[1] built > on top of master. There are a few notes in the PR[2] about the > implementation. I invite you all to review the PR and provide > feedback. > > This means that I will soon move the return types RFC to voting phase. > If you have not yet had time to review the RFC recently I invite you > to do so now. > > The RFC has been slightly altered since the last discussion: > - The RFC now targets PHP 7 (previously PHP 5.7). > - There is a new section about disallowing return types on certain > methods[4]. > - The design and accompanying section of reflection[3] has been > rewritten entirely. > > Regardless of the result of the RFC, I want to thank the many people > who have been helpful to me as I have learned php-src and iterated > over this RFC. > > [1]: https://wiki.php.net/rfc/returntypehinting > [2]: https://github.com/php/php-src/pull/820 > [3]: https://wiki.php.net/rfc/returntypehinting#reflection > [4]: > > https://wiki.php.net/rfc/returntypehinting#methods_which_cannot_declare_return_types > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#78115) next »