On Sat, Aug 19, 2023, at 4:21 AM, Claude Pache wrote: > At the time I filed https://github.com/php/php-src/issues/10497, I was > merely exploring the potential of the new ability to have an object in > a constant. The potential use I had back in my head was the following. > Currently, I store some settings in global constants. I was > contemplating replacing those by properties of a readonly object stored > in a global constant. (A fatal issue I discovered later in my journey > is that readonly properties can only be initialised by code inside the > class itself.)
As a tangent here, that has a workaround: https://peakd.com/hive-168588/@crell/php-tricks-access-control-bypass Which I make use of in Crell/Serde, which is then used by my own config library to produce exactly what you describe: https://github.com/Crell/Config --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php