A
A
Alex Surname2017-01-30 15:08:24
phpstorm
Alex Surname, 2017-01-30 15:08:24

How to make friends PHPShorm and external variables?

There is a head.php file.
This file declares variables like $login, $login_id, ... (etc)
This file is included in all project interfaces, and as a result, variables are actively used.
PHPShorm swears that it does not see these variables:
fe86539d2ae343cfbdfc0565fa5ef053.png
In principle, one can not discuss the fact that such a format for using variables is evil, since we are talking about project support with a minimum of refactoring.
So hence the question. Is it possible to somehow make friends PhpSHtorm and external variables without disabling code inspection?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Novikov, 2017-02-08
@BOOMER_74

Is the file in a project? Is it included in the required file (include/require)? If yes, then PhpStorm should pick up the variables itself. If not, or they are declared in a "magical" way (as in Yii, for example), then you need to use PHPDoc:

/**
 * @var int $login_id
 */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question