Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73799 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1233 invoked from network); 25 Apr 2014 15:00:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2014 15:00:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=willfitch@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=willfitch@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 66.111.4.25 as permitted sender) X-PHP-List-Original-Sender: willfitch@php.net X-Host-Fingerprint: 66.111.4.25 out1-smtp.messagingengine.com Received: from [66.111.4.25] ([66.111.4.25:59934] helo=out1-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/81-24508-D687A535 for ; Fri, 25 Apr 2014 10:59:59 -0400 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 7C5B020B21; Fri, 25 Apr 2014 10:59:55 -0400 (EDT) Received: from web4 ([10.202.2.214]) by compute6.internal (MEProxy); Fri, 25 Apr 2014 10:59:55 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:cc:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=fkTtdSzHGobN63NUPEZkPk5tKtU=; b=LM9 pfu/i27DIX8r2GGMc8GHZCi7H8zDhGV2ybTrnhZwUTawhoNwnDryEFre0Y6XZumw pAP2fkbXvJDsZQguVirVKxmTwVzjoXfEbcEKPpdfWLqNa0Q4ly7LV46yG2javxk+ VnZZeBRknLIDT41Vy5uq2ePxWpugCDyKnOux6i2I= Received: by web4.nyi.mail.srv.osa (Postfix, from userid 99) id 55B7C10E25F; Fri, 25 Apr 2014 10:59:55 -0400 (EDT) Message-ID: <1398437995.20097.110370617.51C52C36@webmail.messagingengine.com> X-Sasl-Enc: UQ+nzYnlXJR/6g9qjcTGDvijA9/4Bw39NCvUA+tpubNq 1398437995 To: Levi Morrison , Lazare Inepologlou Cc: internals MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-aafac2c3 In-Reply-To: References: Date: Fri, 25 Apr 2014 07:59:55 -0700 Subject: Re: [PHP-DEV] [RFC] Return Type Declarations From: willfitch@php.net (Will Fitch) On Fri, Apr 25, 2014, at 07:52 AM, Levi Morrison wrote: > On Fri, Apr 25, 2014 at 3:09 AM, Lazare Inepologlou > wrote: > > > Hello, > > > > 2014-04-24 17:59 GMT+02:00 Levi Morrison : > > > > My dear Internals friends, > >> > >> I have spent the last month drafting an RFC that allows return types: > >> https://wiki.php.net/rfc/returntypehinting > >> > >> Notable items: > >> - Differences from past RFCs are summarized in the RFC: > >> https://wiki.php.net/rfc/returntypehinting#differences_from_past_rfcs > >> - The patch includes basic opcache and reflection support. It also has > >> phpt tests. > >> - Informal performance tests indicate that the patch did not fubar > >> performance; if desired a more detailed test can be conducted before > >> voting. > >> - This RFC does not add, modify, or remove keywords at all; this notably > >> excludes type-hints for scalars. Supporting scalar type declarations is > >> outside the scope of this RFC; if you are interested in supporting scalar > >> type declarations please discuss it elsewhere. > >> > >> As a friendly reminder, everyone on this list is interested in developing > >> a > >> better PHP and the definitions of 'better' vary from person to person. > >> Please be civil and constructive while discussing this RFC. Thank you! > >> > >> Some thanks, regardless if the RFC is accepted: > >> - For providing a patch: Joe Watkins. > >> - For helping me iterate on RFC drafts: Bob Wienand, Nikita Popov and > >> Anthony Ferrara > >> - For previous RFCs on this topic: Felipe Pena and Will Fitch. I gleaned > >> valuable knowledge from your proposals and the discussion around them. > >> > > > > > > This is a nice and well thought proposal. > > > > I would like to suggest the addition of the "self" and "static" pseudo > > types. Most IDEs support this through @return syntax: > > > > class Foo { > > /** @return static */ > > public function SetBar( $bar ) { > > // ... > > return $this; > > } > > } > > > > With the new syntax, the above could be transformed into this: > > > > class Foo { > > public function SetBar( $bar ) : static { > > // ... > > return $this; > > } > > } > > > > As the patch currently stands you can use the type-hint 'self'. How will this patch work with LSB?