If you are using #[AllowDynamicProperties] on a class that is namespaced, you need add a backslash #[\AllowDynamicProperties] to use its fully qualified name or import it.
Fully qualified name example:
<?php
namespace App;
#[\AllowDynamicProperties]
class Post
{
__construct()
{
$this->name = "Dynamic Property";
}
}
?>
Import example:
<?php
namespace App;
use AllowDynamicProperties
#[AllowDynamicProperties]
class Post
{
__construct()
{
$this->name = "Dynamic Property";
}
}
?>