Re: [RFC] [Discussion] Typed class constants

From: Date: Wed, 01 Feb 2023 06:20:43 +0000
Subject: Re: [RFC] [Discussion] Typed class constants
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-119438@lists.php.net to get a copy of this message
On Tue, Jan 31, 2023 at 11:01 PM Máté Kocsis <kocsismate90@gmail.com> wrote: > Hi Everyone, > > A few years ago, Benas Seliuginas announced the "Typed constants" RFC ( > https://externals.io/message/110755) which apparently had a > positive reception overall. > Unfortunately, there were some issues with the implementation (namely, with > the parser) > so the RFC was stuck. > > A few weeks ago, I reached out to Benas whether he intended to resurrect > the proposal, but > due to time constraints, he couldn't, and was OK with me continuing it. > With some help from > Bob Weinand, I managed to overcome the implementation difficulties, and > adapted it > to the newly added type-related features. > > Please find the updated RFC here: > https://wiki.php.net/rfc/typed_class_constants. > > Regards, > Máté > Hi Máté, Looks great! Two small things: 1. Why is object type not supported? I can't see a real reason and also there is no explanation why. 2. In the examples for illegal values, it would be good to explain why they are not legal. I don't understand why "public const ?Foo M = null;" wouldn't be legal. I think "?Foo" should work the same as "Foo|null" that would be legal. Thank you, Alex

« previous php.internals (#119438) next »