> Le 24 avr. 2023 à 12:28, Daniil Gentili <dan...@daniil.it> a écrit : > > Hi all, > > I've submitted https://github.com/php/php-src/pull/11126 to add support for > final anonymous classes, though as noted by iluuu1994, it would probably make > more sense to just make all anonymous classes final by default, what do you > think? > > Daniil Gentili. >
Hi, Extending an anonymous class is indeed possible (https://3v4l.org/pDFTL), but it is a hack as best. If someone wants a non-final class, could they not write a non-anonymous one? As a bonus, they wouldn’t need to instantiate the class before referencing it. —Claude