Open deg-pl opened 1 year ago
Dynamic class properties will be deprecated in PHP8.2 and will thow an ErrorException in PHP 9. For example below code will throw an error:
class Post { public string $title; } // … $post->name = 'Name';
We use dynamic properties in our code. Main in View and (nearly?) all templates.
But classes implementing get and set will still work as intended:
class Post { private array $properties = []; public function __set(string $name, mixed $value): void { $this->properties[$name] = $value; } } // … $post->name = 'Name';
Maybe this is simple/temporary solution?
The easiest solution is to add #[AllowDynamicProperties] attribute, like so:
#[AllowDynamicProperties]
#[AllowDynamicProperties] class Post { public string $title; }
Dynamic class properties will be deprecated in PHP8.2 and will thow an ErrorException in PHP 9. For example below code will throw an error:
We use dynamic properties in our code. Main in View and (nearly?) all templates.
But classes implementing get and set will still work as intended:
Maybe this is simple/temporary solution?