PHPStorm cannot parse a variable path?

Not so awesome picture

As you can see, the first require_once does not give a weak warning. The latter does, but I do not understand why. Is there a reason why this is happening? The file exists and contains the class. If this is useful, this is the file structure:

-| Project -| Anomius - Anomius.php (This is the included file) -| Sites -| Foo - app.php (This is the file on the image) 
+7
php phpstorm
source share
2 answers

Just turn off the setting in PhpStorm that issues a warning:

In Settings search for "unauthorized inclusions" which is under Editor > Inspections ; PHP > General > Unresolved include

and uncheck the box.

+3
source share

By default, PHPStorm only remembers variable names, not values. Therefore, if you start typing $ano , it will give you autocomplete for $anomius , but it does not know what $anomius actually contains.

To make PHPStorm understand where your file is located, try the following:

 $anomius = "your_file.php"; /** @define "$anomius" "/absolute/path/to/your/php/file" */ require_once($anomius); 
+2
source share

All Articles