Traits and return $this value from static method


(phpStorm EAP build #PS-126.36)

I am trying to implement trait with basic singleton functionality

But I can't find how to let IDE know that static method getInstance() returns instance of class where trait is used

As you can see here - @return value not specified, so IDE know nothing about properties of mySingleton, so I tried to specify return value

Actually $this in this case is mySingleton but IDE highlights singletonTrait and property hello still not recognized.

Also I tried @return self and static - didn't help much. IDE still shows me only methods and properties of trait.

Funny thing, sometimes in suggestion list i saw hello and localVariable but they were not highlited and after I deleted "->" and typed it again - they are disappeared from suggestion list.

So, my question is - is it possible to get what i dried to get?

(Source code attached)


Please sign in to leave a comment.