Structure browser opening the wrong file (PhpStorm EAP 98.271)

This is most easily noticeable when "Show Inherited" is enabled.  This displays the magic PHP methods like __sleep, __call, etc.  If the class in question doesn't have these functions defined, phpstorm simply opens the first file that it can find that DOES have them defined, whether the class it opens is a parent of the original class or not.  (i.e. This happened on a class which does not extend anything.)

4 comments

Hi signe,

If class does not extend anything and does not has that specific magic method implemented (for example, __construct() ), then PhpStorm will open stub file where object class is defined (file name _types.php and it is a part of PhpStorm distribution; stub file is done so that autocompletion and related features will work).

If PhpStorm does not load that file, but load some other completely random file from your project -- then this may be a bug. Could you please illustrate it? (a screenshot or two where the class declaration can be seen with Structure window included).

P.S.
I'm using this build heavily for the last 2 days, and have not encountered such behaviour so far. Have you tried File | Invalidate Caches "medicine"?

0

You are, of course, correct...  it's opening the _types file.  At first glance it looked like that was something that it had pulled up out of PEAR.

Is there any way to prevent this behavior?  I, now, understand why it happens... but it's really counter-productive to open up a file that has absolutely nothing to do with the project being edited.  Showing inherited functions shouldn't show magic functions which aren't defined anywhere in the class inheritance.  They should only appear if a parent actually defines them.

0

Hi signe,

Well ... there are few ways of bypassing this unwanted behaviour, but I do not think than any of them will match your needs completely:
1) Make sure that "Show inherited" option in Structure window is turned OFF / unchecked (you know -- nothing to show = nothing to click ;) );
2) Do not click on such not-implemented methods (they are displayed in different colour for a reason -- light grey on default scheme).

In other words -- if you want to see inherited methods but, at the same time, prevent PhpStorm from taking you to stub files (when such class method/normal function is not implemented) -- the answer is NO -- not possible at the current moment.

There is one feature request, which should solve such behaviour (to a some degree, of course). Vote for/comment it if your like it: http://youtrack.jetbrains.net/issue/WI-3506?projectKey=WI
or create your own request: http://youtrack.jetbrains.net/issues/WI#newissue=yes

0

Please sign in to leave a comment.