MIR0016
InvalidDynamicProperty
Enums and readonly classes cannot hold dynamic properties: writing a property they do not declare throws Error: Cannot create dynamic property E::$x. On other classes the same write is DynamicPropertyCreation.
Example
Section titled “Example”<?phpreadonly class Point { public function __construct(public int $x) {}}
$p = new Point(1);$p->y = 2;How to fix
Section titled “How to fix”Declare the property, or keep the extra data elsewhere.
