The AllowDynamicProperties attributeIntroductionThis attribute is used to mark classes that allow dynamic properties.
Class synopsis
#[\Attribute]
final
AllowDynamicProperties
/* Methods */
public __construct()
ExamplesDynamic properties are deprecated as of PHP 8.2.0, thus using them without marking the class with this attribute will emit a deprecation notice. Example #1 AllowDynamicProperties with non-existing property Output of the above example in PHP 8.2: Deprecated: Creation of dynamic property DefaultBehaviour::$nonExistingProp is deprecated in file on line 10 Example #2 AllowDynamicProperties with non-existing property in inherited class Output of the above example in PHP 8.2: Deprecated: Creation of dynamic property DefaultBehaviour::$nonExistingProp is deprecated in file on line 12 See Also
|