Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93861 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46471 invoked from network); 10 Jun 2016 12:55:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2016 12:55:19 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.163 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.163 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.163] ([81.169.146.163:45944] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/88-00193-3B8BA575 for ; Fri, 10 Jun 2016 08:55:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1465563313; l=4582; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=5M+URvtYH/VTKzr7cew6Hqw6cM9OR/oPlE0eNLv8rGs=; b=etClbAeZ8cmKP6MmA6Lb6bGTJyZVm3O4UD4uCoXuizF9XtQ3iWqA3gcy73ycqQ/8YPr TeMnwBtBkGiHF2s7ojySYKA3y91JfsOalZRr0+gdwmetgZkBi0qZ1hT4foF6KvJ/1SjzA mObQEYnzPaF58AuzRtgUO/Pttl7EZc/dQY0= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtO3U6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f46.google.com ([74.125.82.46]) by smtp.strato.de (RZmta 38.3 AUTH) with ESMTPSA id 60047es5ACtC1gh (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Fri, 10 Jun 2016 14:55:12 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id m124so100869513wme.1 for ; Fri, 10 Jun 2016 05:55:12 -0700 (PDT) X-Gm-Message-State: ALyK8tKEfL0hhN/PjWqxoadbDTeA2rvS/cqw+8MXfBfH/uRiyuhFc0pyaXwbHK2EBXpYvp5LUos+bzwLTxQo6g== X-Received: by 10.28.92.66 with SMTP id q63mr14846378wmb.73.1465563312107; Fri, 10 Jun 2016 05:55:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.199.67 with HTTP; Fri, 10 Jun 2016 05:55:11 -0700 (PDT) In-Reply-To: References: Date: Fri, 10 Jun 2016 14:55:11 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Marco Pivetta Cc: Joe Watkins , PHP internals , Phil Sturgeon Content-Type: multipart/alternative; boundary=001a114687ea9d439d0534ec0c78 Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: me@kelunik.com (Niklas Keller) --001a114687ea9d439d0534ec0c78 Content-Type: text/plain; charset=UTF-8 2016-06-10 14:39 GMT+02:00 Marco Pivetta : > As already mentioned on twitter, I voted "no" on this RFC as it currently > stands. I might reconsider if following points are addressed: > > 1. __get semantics are not changed: let __get behave like it usually does, > and let the user define a type hint on __get, should any be applicable. > Basically: > > class Foo > { > private int $bar = 123; > public function __get($name) { return 'banana'; } // *ALWAYS* works - > why would I even want a type error here? > } > You want a type error if bar is unset, mainly because Foo->bar should always be an int. If you unset it and set it again, it still has to be an int. And reflection will tell you it's always an int. So why should __get be allowed to return something different? > * by-ref access should be enabled when the reference property has the same > declared type as the source one > > class Foo > { > public int $bar = 123; > } > > class Bar > { > public int $baz = 456; > public string $taz = 'taz'; > } > > $foo = new Foo; > $bar = new Bar; > > $bar->baz = & $foo->bar; // works > $bar->taz = & $foo->bar; // crashes > > Cheers, > > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > On 10 June 2016 at 12:38, Joe Watkins wrote: > > > Afternoon internals, > > > > The vote for typed properties has been restarted. > > > > Please take part: https://wiki.php.net/rfc/typed-properties > > > > Cheers > > Joe > > > --001a114687ea9d439d0534ec0c78--