> In the thread for deprecation of dynamic properties, Rowan suggested that > we alias "stdClass" to "DynamicObject" in > https://externals.io/message/115800#115802. I wanted to split this > discussion off into a separate thread, as this can be decided > independently. > > The rationale for this is that "stdClass" is something of a misnomer: The > name makes it sound like this is a common base class, as used in a number > of other languages. However, PHP does not have a common base class. The > only way in which "stdClass" is "standard" is that it is the return type of > casting an array to (object). > > The actual role of stdClass is to serve as a container for dynamic > properties, thus the suggested DynamicObject name. > > What do people think about adding such an alias? Is this worthwhile? >
Hi Nikita, Rowan, I'm reading the discussion about the side of the alias. Can't we solve these concerns by making DynamicObject extend stdClass instead of aliasing? That wouldn't allow an stdClass object to get through the DynamicObject typehint, but that shouldn't be an issue since no such code has yet been written, isn't it? Nicolas