Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94438 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94344 invoked from network); 9 Jul 2016 07:00:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jul 2016 07:00:28 -0000 Received: from [127.0.0.1] ([127.0.0.1:25576]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id F5/48-18622-B01A0875 for ; Sat, 09 Jul 2016 03:00:27 -0400 Authentication-Results: pb1.pair.com header.from=daniel@ciokix.ro; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=daniel@ciokix.ro; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ciokix.ro from 209.85.215.46 cause and error) X-PHP-List-Original-Sender: daniel@ciokix.ro X-Host-Fingerprint: 209.85.215.46 mail-lf0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:36650] helo=mail-lf0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/48-18622-91E90875 for ; Sat, 09 Jul 2016 02:47:54 -0400 Received: by mail-lf0-f46.google.com with SMTP id q132so40185982lfe.3 for ; Fri, 08 Jul 2016 23:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ciokix-ro.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:from:date:message-id:subject:to; bh=T0CYAL0gfscQyNC87HyRtjOqjc6/8dUnJ2TszfjtuWs=; b=knh1h9fzAkr+g5VE6AwyOl5xX5qZSNpANaf+MvT+NH12WmTef2AKkEbHdmMduC81vX yDnuvwrv/l9e0/C+ip1sSNIjmibNhmaQCHH4rU1kXLyCJwE3XDJz6dyopZv0gHGcmB26 F0oiZjkZSTGbQsyAeJ7W2ZfgDBnntwXLmVYKu3zR/FwUf6PKSEFhNondV/278E2WpAh3 QOMO3pHKGCLlhyqX8jqlPaNVoSiYPSCwTKZswbH/cWHTcOqJLTQPLSdR0n+BevtRBkQC InHRPfnl92npp526e6R2hyW0vCAIWYADZl5kmdbsW+Ozt6DZuG8IyYThaVAI9e/95SiZ n1xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=T0CYAL0gfscQyNC87HyRtjOqjc6/8dUnJ2TszfjtuWs=; b=jDkbSXrtXayd/K9E2le72euMbMF4VwqApCQZ0RjHY4d1ObyS+cKKqJlxd3T3Z4OLnI GmZ35o0sFWBGhw6rjlsLe6FHNbbkRe5MHzyPtj9NQ4y0difRwjeH7oToTI/6N6Z5vhKn 7qgna74StGa+Xt7VDc7BI4OkYmaJAzap7n2mFFUB+7lCz/606QwLZF1hoUGAqScijzvi 85TGnX1dnfV9OkMHYctjNiiX1VVQZ5hnzugsQPmoFYzUt+6Jq/xWrPekXzQ6ycH/y5yT IWrej1jETRbguTylJL7JJqwsyNWtb1rD4sHGBY1xTQsRQkfV/yLs0fyyvExqdeIhRKr/ 5lbg== X-Gm-Message-State: ALyK8tJ0wE/BH4lLgmi4BCRQhd65Ob/L+lSBfGzGnB5wsqtI3+J0LhuOPYV/EARGSRC0qK3wAIdDSltWjyk27Q== X-Received: by 10.25.214.97 with SMTP id n94mr2613586lfg.105.1468046870552; Fri, 08 Jul 2016 23:47:50 -0700 (PDT) MIME-Version: 1.0 Sender: daniel@ciokix.ro Received: by 10.114.200.80 with HTTP; Fri, 8 Jul 2016 23:47:49 -0700 (PDT) X-Originating-IP: [86.126.42.70] Date: Sat, 9 Jul 2016 09:47:49 +0300 X-Google-Sender-Auth: Kw7i2ldZuGZA-uY_YAQ6rR39jEs Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a1140ef7a3bb81c05372e4cc3 Subject: Proposal for php7 class method return From: daniel@ciochiu.ro (Daniel Ciochiu) --001a1140ef7a3bb81c05372e4cc3 Content-Type: text/plain; charset=UTF-8 Hi, I have a proposal that for a given method with a return type of , if method does not return anything than it should it's instance. It will reduce code by only one line, but will improve consecutive method calls. class myClass { protected $value; function setValue($value) : self { $this->value = $value; } function doubleValue() : self { $this->value*=2; } function getValue() : self { return $this->value; } } $calculator = new myClass(); $returnValue = $calculator->setValue(3) ->doubleValue() ->getValue(); echo $returnValue; Any return defined in the methods body would override the return of the class instance. I am looking forward to your reaction. Thank you! DanielCiochiu --001a1140ef7a3bb81c05372e4cc3--