Re: [RFC][Vote] Typed Properties

From: Date: Fri, 10 Jun 2016 12:39:16 +0000
Subject: Re: [RFC][Vote] Typed Properties
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-93860@lists.php.net to get a copy of this message
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? } * 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 <pthreads@pthreads.org> wrote: > Afternoon internals, > > The vote for typed properties has been restarted. > > Please take part: https://wiki.php.net/rfc/typed-properties > > Cheers > Joe >

« previous php.internals (#93860) next »