Skip to content

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

Open

Description

@Simbiat

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.

Activity

  1. rvalitov commented on Apr 25, 2025

    @rvalitov
    Contributor

    Perhaps related to #72 because dynamic properties are deprecated?

  2. silvanocerza commented on Mar 26, 2026

    @silvanocerza
    Member

    I'm unsure about this change. I can easily add __isset but we don't need __get nor __set, so I don't see why we should add those.

    Also I don't have access to PHPStorm so I can't verify if my changes work.

  3. linear-code commented on Oct 15, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions