Le 21/10/2020 à 11:38, Björn Larsson a écrit : > > Well, but for us with a legacy code base where this is heavily used > it would definitely be an improvement! It would enable a so called > stepwise refinement :-) > > One typical usecase we have is populating an object with the result > from a DB query or using an object to write to a DB.
Drupal prior to 8.x used to do this, I definitely hated it for it. I'd recommend that if your data is arbitrary, you can use arrays, if you it's not, you probably always should write typed value objects, it's much more comprehensive and stable (yeah IDE auto-completion and static analysis), and you'll benefit from typing your properties if you rely upon a decent PHP version. > > I'm also wondering how prevalent this feature is used in different > Open Source libraries. > > r//Björn Larsson > I'm not in favor of a shorthand syntax if it's only for \stdClass, but I'm in favor of having a shorthand syntax for all types and classes: both constructor property promotion and named parameters altogether already solve this particular feature quite nicely. \stdClass should probably retire at some point, it'll be honored to contribute some retirement gift and celebrate with a party if that happened :D -- Pierre -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php