Re: RFC: short and inner classes

From: Date: Thu, 06 Mar 2025 06:23:21 +0000
Subject: Re: RFC: short and inner classes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-126593@lists.php.net to get a copy of this message
On Thu, Mar 6, 2025, at 02:08, Juris Evertovskis wrote: > Hi, > > Maybe I didn’t read the RFC carefully enough, but… Do any of these features require the > other one? > > I’m asking because I wouldn’t want to see them both denied just because the voters disagree > with one of them. > > Good luck with this proposal! > > Juris Hi Juris, Yes and no. Without the short syntax, classes explode in size if you just want to have simple inner classes for DTO/organization. For example, I used this for quite a bit over the last couple of weeks. One big usage, from my experiments, was to replace array returns: class StringList(public array $strings); And it makes it “easy on the eyes” to just have a list of classes at the top of the class. By itself, a short syntax makes some sense, but isn’t compelling (IMHO), and inner classes cause an explosion in LoC without it. So, technically, they aren’t required to be in the same RFC; but also, they complement each other very well. If the RFC fails due to them being together, I’ll take the feedback and go back to the drawing board. — Rob

« previous php.internals (#126593) next »