You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using PHPStorm+EA Inspections and when I am accessing any of Details dynamic properties, I get errors like
[EA] \ipinfo\ipinfo\Details needs to implement __isset to properly work here.
when doing something like
if (empty($ipinfo->country_name)) {}
I found this explanation of the inspection. So essentially the issue is that there are no magic __get, __set and __isset (and probably __unset() for good measure). While this is not necessarily an issue, since empty() is going to work normally, it may be a good idea to adjust the code so that inspections would not complain like this. I mean, empty() or isset() feel pretty reasonable operators here.
Alternative is to add all possible attributes as, well, actual attributes in the class, but I do understand that since this is API parser, it may make sense to make the attributes dynamic, so that you do not need to update things in PHP code every time the output of the API changes. On the other hand, it may help with some sanitization, in case something does go wrong with the API output.
The text was updated successfully, but these errors were encountered:
I am using PHPStorm+EA Inspections and when I am accessing any of
Details
dynamic properties, I get errors likewhen doing something like
I found this explanation of the inspection. So essentially the issue is that there are no magic
__get
,__set
and__isset
(and probably__unset()
for good measure). While this is not necessarily an issue, sinceempty()
is going to work normally, it may be a good idea to adjust the code so that inspections would not complain like this. I mean,empty()
orisset()
feel pretty reasonable operators here.Alternative is to add all possible attributes as, well, actual attributes in the class, but I do understand that since this is API parser, it may make sense to make the attributes dynamic, so that you do not need to update things in PHP code every time the output of the API changes. On the other hand, it may help with some sanitization, in case something does go wrong with the API output.
The text was updated successfully, but these errors were encountered: