We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 text was updated successfully, but these errors were encountered:
The easiest solution is to add #[AllowDynamicProperties] attribute, like so:
#[AllowDynamicProperties]
#[AllowDynamicProperties] class Post { public string $title; }
Sorry, something went wrong.
No branches or pull requests
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?
The text was updated successfully, but these errors were encountered: