note 128019 added to class.allow-dynamic-properties
| From: | josh at joshhanley dot com dot au | Date: | Thu, 15 Dec 2022 02:35:06 +0000 |
| Subject: | note 128019 added to class.allow-dynamic-properties | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219975@lists.php.net to get a copy of this message | ||
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";
}
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.175 (proxied: 2406:2d40:40d4:cf10:f063:fbd6:8d1:4e21)
----
Manual Page -- https://php.net/manual/en/class.allow-dynamic-properties.php
Edit -- https://main.php.net/note/edit/128019
Del: integrated -- https://main.php.net/note/delete/128019/integrated
Del: useless -- https://main.php.net/note/delete/128019/useless
Del: bad code -- https://main.php.net/note/delete/128019/bad+code
Del: spam -- https://main.php.net/note/delete/128019/spam
Del: non-english -- https://main.php.net/note/delete/128019/non-english
Del: in docs -- https://main.php.net/note/delete/128019/in+docs
Del: other reasons-- https://main.php.net/note/delete/128019
Reject -- https://main.php.net/note/reject/128019
Search -- https://main.php.net/manage/user-notes.php