Hi Nikita,

I think this might be a good idea, but I would like to propose yet another
variant.
Replace stdClass with DynamicObject and keep stdClass as an alias. It can
be deprecated in 8.3.
If we only add an alias, I am afraid that it will not catch on quickly
enough. What I am proposing is that the cast to object will create
DynamicObject by default.

$arr = [1,2];
var_dump((object) $arr);
Output:
object(DynamicObject)#1 (2) {
  ["0"]=>
  int(1)
  ["1"]=>
  int(2)
}

It will break unit tests and it might break some code (e.g. `if ('stdClass'
=== $class)`), but it will help people understand what is the preferred
name going forward without deprecating it right now.

Regards,
Kamil

Reply via email to