PhpStorm :: "Find usages" does not find anything useful

Dear community,

i'm using PhpStorm 4.0.1 , Linux, Sun JDK 1.6.0. The "Find usages..." tool applied to a function/method declaration does not return any results.
I've for example the following class and method declaration in one file X:

class tx_arricommonapi_pi1 extends tslib_pibase {
     public function execSelectQuery($sql)
     {

          ...some code here...
     }
}

and some code using this method in another file Y:

class tx_arripca_pi3 extends tslib_pibase {


     function __construct()
     {
          $this->cApi = new tx_arricommonapi_pi1;
     }



     function main()
     {
         $result = $this->cApi->execSelectQuery('update phpstorm where word="please"');

     }



}

i would expect "Find usages..." applied to execSelectQuery in file X to retrieve the usage of that method in file Y, but it doesn't.

Of course i already googled around a lot and tried several things which are said to help out with similar issues:

  • i did the "File -> Invalidate Caches -> Restart" procedure, no change
  • clicking with Ctrl + Left Mouse on method declaration says "Cannot find declaration to go to", thus duplicate declaration should not be the problem
  • i defined a custom scope just with file X and Y without success


Am i doing something wrong or do i misunderstand the very basic concept of "Find usages..."? This could be, i'm a PhpStorm beginner. I migrated from Netbeans.
There exists the same tool which worked as expected with the same code base.

Any hint is appreciated!

Thx a lot

Harald

2 comments
Comment actions Permalink

Hi Harald,

Please provide some standalone reproducible project as this feature just works for me (and always worked before, at very least on codebase that I'm using).

For example, it works OK on this simple code of yours (try it in empty project):

fileA.php

<?php

class tslib_pibase
{
    protected $cApi;
}


class tx_arricommonapi_pi1 extends tslib_pibase
{

    public function execSelectQuery($sql)
    {
        return strtolower($sql);
    }
}

fileB.php

<?php
class tx_arripca_pi3 extends tslib_pibase
{

    function __construct()
    {
        $this->cApi = new tx_arricommonapi_pi1;
    }

    function main()
    {
        return $this->cApi->execSelectQuery('update phpstorm where word="please"');
    }
}

It is possible that your code has something else that maybe preventing PhpStorm from detecting the correct usage or there is bug in PhpStorm that does not work in your case -- I cannot say for sure from overhere.

0
Comment actions Permalink

hi andriy,

thank you very much for your help;

i started an empty project from scratch with the example files and "find usages..." works as expected;

the problem is, that i have the (SVN) working copies of productive branch and trunk within the same project resulting in duplicate files and classes and therefore
in duplicate declarations; i split branch and trunk into separate projects and, hey, it works; (strange enough that i did not get a warning about double declarations; i had seen those before...)

sorry for bothering you with something like this, thanks for your effort anyway; maybe this is useful to somebody else with the same problem;

cheers

harald

0

Please sign in to leave a comment.