-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
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
Why "Class needs to implement __isset to properly work here"? #912
Comments
If the property doesn’t exists in the class and it’s accessed via magic getter the only way for interpreter to know if the property exists is to call __isset. |
As @kiler129 says, if a property does not exists or the property is private/property the It's also possible that the codebase creating properties dynamically, like e.g. stdClass used as DTO (Data Transfer objects). Here we can not really fix this and just recommending using less dynamics and write regular DTO instead (they have all fields declared implicitely). |
So if I understand correctly, the condition
is a problem if
On the other hand it is not a problem if the property is public (or undeclared) and the class doesn't implement Is that correct? |
|
Thank you for the explanation, now I understand the inspection and the problem it points to. |
You are welcome. I'll reopen the issue in order to cover the topic in our documentation as well. |
Hello,
I haven't found anything about this inspection in the docs or in the issues.
Can you please explain, why
shows the following error?
Why does the $object's class need to implement
__isset()
?The text was updated successfully, but these errors were encountered: