Undefined class self in included file
Hello,
I have a class that in a function has a quite long HTML part.
I've decided to move this block in a separated file and include it where I need it.
However, this file, to get data from some static method and fields, often makes use of the "self" object (eg.: self::$somefield).
The problem is that PhpStorm inspection keeps saying that self is undefined.
I know how to solve this with variables, using comments like /** @var $myvariable string */, but how can I do the same in this case?
Please sign in to leave a comment.
Yeah, this is weird, i never saw PHP is deprecating the keyword self. Does somebody have a link about this?
That's a 3+ years old post and got noticed only now :)
I can't even remember was I was talking about and for sure I manage to live with this issue (provided it didn't get fixed meanwhile).
The issue still exists.
Looks like the only way is to refer to the static variables via getters/setters.
Could you please attach a sample project or just two files that would illustrate the problem clearly? You can submit this at http://youtrack.jetbrains.com/issues/WI#newissue=yes
the solution of this is with the tag
@Dmitry Tronin
https://youtrack.jetbrains.com/issue/WI-45672