Show the list of used variables?

Hi! Sorry if this is a stupid question. In all PHP IDEs I've tried out there is a Code Explorer which lists functions, constants, variables etc.

I assume that the equivalent for "Code Explorer" in PhpStorm is the "Structure" tool panel? However the "Structure" panel in PhpStorm only lists includes, constants and functions.

So how can I show a list of used variables from the file?

5 comments

Hi there,

However the "Structure" panel in PhpStorm only lists includes, constants and functions.

Class variables / properties as well.

So how can I show a list of used variables from the file?

As of v6 (I believe) the Structure panel is no longer showing ordinary variables (it was showing globals vars only).

I do not think it's possible to bring it back -- I don't remember seeing any option for that.

0

Bazzik wrote:

As of v6 (I believe) the Structure panel is no longer showing ordinary variables (it was showing globals vars only).

I do not think it's possible to bring it back -- I don't remember seeing any option for that.


Is there a reason why they decided to not show "ordinary variables" anymore?

0

1) I was wrong -- this was introduced in v5

2) http://youtrack.jetbrains.com/issue/WI-10511#comment=27-345831 (maybe somewhere in another comment it is described better in details but I have not found it)

As I understand (and I personally agree):

  • Framework are very popular these days. They do use OOP heavily (easier to abstract and extend to specific functionality/requirements while keeping the same approach). With more or less proper OOP approach you will have like 2-3-5 global variables per whole project -- why showing them at all?
  • If you do not use OOP but mix of functions and code in global namespace .. in big files it is difficult to navigate to functions if you have a lot of code in one file. Navigating to function/class is needed much more often than navigating to variable (especially if variable / the same variable is heavily used in that file (like 5-10 times or so). 2-3 of such variables and Structure panel is full.
  • At that time the internal "type-hinting" engine (don't know the exact name/functionality .. but it was the part responsible for analyzing the code and tracking variable types and similar stuff ) was re-done dramatically (e.g. to support case where the same variable is re-used multiple times for completely different purposes: e.g. it is a string; 2 lines later it is an instance of some class .. few lines later it has boolean value; to support much more complex inspections where if-else are involved etc) and structure panel became pretty useless for such cases (displays wrong info etc).


P.S.
If you just need to navigate to some variable .. you could use "Navigate | Symbol" (although it works across all files in a project and not just current file).

0

Why not let the user have a CHOICE himself? I love doing things where I decide what is being displayed an what kind of environment I want to use.

Everything else smells of "communism" ... ;-)

0

Please sign in to leave a comment.