brendt / stitcher.io

Source code of stitcher.io
https://stitcher.io
179 stars 137 forks source link

Deprecate dynamic properties rfc stdClass use #204

Open glensc opened 2 years ago

glensc commented 2 years ago

In https://stitcher.io/blog/new-in-php-82 you say that you can use #[AllowDynamicProperties] attribute for dynamic attributes.

however, you say:

The same goes for objects of stdClass, they will keep supporting dynamic properties.

will it also work to make your class extend stdClass?

class Post extends \stdClass
{
}
$post->name = 'Name';

perhaps add this bit to the blog as well.

brendt commented 2 years ago

That'll work indeed! I'll look at rephrasing it when I've got the time :)

glensc commented 2 years ago

Maybe keep it open until done, so you don't forget! ;)

glensc commented 2 years ago

Reminds me python2 introducing similar thing for "new" classes: