Search code examples
phpclassmethodsphpstormcode-hinting

Why PhpStorm doesn't show my class?


I created a class like this:

class FOO {

        public function __construct(){}

        public function getArr(){}

}

$x=new FOO(); //don't show "FOO" suggestions
$x-> //don't show suggestions

The problem is that PhpStorm doesn't show me the suggestions to my class in the "new" statement and if I create in instance of FOO it doesn't show me the FOO methods...

I don't know if it is a problem of PhpStorm; I have imported the Facebook php sdk class and it give the correct hints to me...

UPDATE:

I think I have found the problem:

-if I have opened a project and I import the file with the class (that is outside from the project directory, drag & drop into the IDE) to quick edit it, the IDE don't give me the suggestions

-instead, if I open the single file Itself and have no others projects opened the IDE works correct


Solution

  • Thanks to @LazyOne, the answer is that the behavior is correct from the moment that I opened the file from outsite the project where I were working on.

    if I have opened a project and I import the file with the class (that is outside from the project directory, drag & drop into the IDE) to quick edit it, the IDE don't give me the suggestions


    Yes -- that's expected behaviour (limitation(?) of their system). The file MUST be inside the project to have code completion properly working there.