Scout APM helps PHP developers pinpoint N+1 queries, memory leaks & more so you can troubleshoot fast & get back to coding faster. Take for example a look at a DTO in PHP 5.6: And compare it to its PHP 8.0's equivalent: That's already quite the difference, though I think there's still one big issue: all those getters.
So, if you can't change readonly properties, and if you can't unset them, how can you create a copy of your DTOs or VOs and change some of its data?
Well, you can copy over objects with changed readonly properties, if you rely on a little bit of reflection magic.
The readonly properties RFCWhat's new in PHP 8.1Evolution of objects in PHP over the yearsCloning readonly properties