> Le 19 janv. 2023 à 10:12, Claude Pache <claude.pa...@gmail.com> a écrit : > > > >> Le 19 janv. 2023 à 09:01, Máté Kocsis <kocsismat...@gmail.com> a écrit : >> >> Hi Everyone, >> >> As discussion apparently stalled, and since we managed to update the RFC >> with the recently brought up arguments, we would like to start the vote >> soon, possibly early next week, unless someone finds a new topic to discuss. >> >> Máté >> > > Hi, > > One shortcoming around readonly classes that I just figured out, is that it > is not possible to use them as anonymous class: > > ```php > $c = new readonly class { }; // parse error > ``` > > While it does not makes sense to have `abstract` and it is not useful to have > `final` in this position, on the other hand, it is perfectly reasonable to > have readonly here. (This is especially problematic in case we keep the > limitation that only readonly classes may extend readonly classes, because in > that case, an anonymous class could not extend a readonly class. However, > this is an orthogonal concern.) > > —Claude
As I think that this limitation is most probably a bug and not a deliberate decision (the RFC introducing readonly classes did not mention restrictions around anonymous classes), I have open a bug report: https://github.com/php/php-src/issues/10377 —Claude