问题
I have a piece of code like below and it works perfectly fine but PHP Storm doesn't show code completion and I am unable to CTRL+click to open the method. Is there a way to make PHP storm aware of the method's location for quicker opening?
$data= MyCoolBusinessManager::Instance()->GetSomeData();
Just an FYI, I am also making use of the spl_autoload_register() function instead of having includes all over the place since my classes follow a standard naming format.
回答1:
You need to put a PHPDoc comment on the Instance() function in your singleton, that says your singleton function return a type of that class:
/**
* @return MyCoolBusinessManager
*/
来源:https://stackoverflow.com/questions/26478638/make-php-storm-aware-of-singleton-classes