Skip to content
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

\ipinfo\ipinfo\Details needs to implement __isset to properly work here. #83

Open
Simbiat opened this issue Jul 5, 2024 · 0 comments
Open

Comments

@Simbiat
Copy link

Simbiat commented Jul 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant