Re: [RFC][Vote] Typed Properties

From: Date: Thu, 26 May 2016 16:46:00 +0000
Subject: Re: [RFC][Vote] Typed Properties
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-93573@lists.php.net to get a copy of this message
On 26/05/2016 17:40, Tom Worster wrote:
0. Fatal error after __construct was called.
1. Fatal error and abort. 2. Initialize with appropriate type. 3. Initialize with null. Under another 5th option, the problem you state does not arise. Disallow "public int $x;". Under this option you may declare $x with type int and an initial value or you may declare $x without type but you may not declare $x with type (nullable or not) and undefined initial value.
That has the same problem as 2 - not all types can be initialised statically, so can't be declared this way: class Foo { HTTPRequest $request = SOMETHING; } How do I safely initialise that? Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#93573) next »