Re: [RFC] [VOTE] Typed properties v2

From: Date: Fri, 21 Sep 2018 15:54:54 +0000
Subject: Re: [RFC] [VOTE] Typed properties v2
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-103222@lists.php.net to get a copy of this message
On 21.09.2018 at 17:25, Rasmus Schultz wrote: > this doesn't provide *any* additional guarantees: > > class Foo { > public int $bar; > } > > $foo = new Foo(); // invalid state allowed > > $foo->bar = 123; // valid state > > $foo->bar = null; // invalid state NOT allowed?! > > [snip] > > In terms of reliability, it's actually sub-par to hand-written accessors. You have no guarantee that a declared public property even exists (regardless of the Typed Properties 2.0 RFC), because it might have been unset. And no, the property is not really NULL in this case, but rather undefined. -- Christoph M. Becker

« previous php.internals (#103222) next »