Open glensc opened 2 years ago
In https://stitcher.io/blog/new-in-php-82 you say that you can use #[AllowDynamicProperties] attribute for dynamic attributes.
#[AllowDynamicProperties]
however, you say:
The same goes for objects of stdClass, they will keep supporting dynamic properties.
stdClass
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.
That'll work indeed! I'll look at rephrasing it when I've got the time :)
Maybe keep it open until done, so you don't forget! ;)
Reminds me python2 introducing similar thing for "new" classes:
In https://stitcher.io/blog/new-in-php-82 you say that you can use
#[AllowDynamicProperties]
attribute for dynamic attributes.however, you say:
will it also work to make your class extend
stdClass
?perhaps add this bit to the blog as well.