OiO.lk Blog PHP PhpStorm can't find object declaration to go to, has no suggestions for properties
PHP

PhpStorm can't find object declaration to go to, has no suggestions for properties


This is old PHP 5 code and is probably coded wrong (it doesn’t use typical autoloading), but I’m flummoxed as to how to get the editor to know which class an object in a call is using, like this:

$this->gateKeeper->user

gateKeeper is an object of class GateKeeper instantiated in the $this object (let’s says its of the Account class) construct method, and is referenceable by the editor, but the ‘GateKeeper’ object instantiates a $user object (of the User class), but the editor can’t find the ‘User’ class when it’s called from the ‘Account’ object using the ‘GateKeeper’ object! Note that the editor can find the ‘User’ class from the ‘GateKeeper’ class file. There’s just something about the way the previous coders hooked together the objects that is throwing off the editor.

I’ve tried using a @var tag in a comment block (opened with one or two asterisks), but while PhpStorm can find the ‘User’ class and its path from Ctrl + Space suggestions from there, it still can’t figure out which class ->user is pointing to.



You need to sign in to view this answers

Exit mobile version