bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.56k stars 92 forks source link

I can't go to the method definition #2877

Closed cbazand closed 2 months ago

cbazand commented 2 months ago

Hi, I use codeigniter v.4.5.2 and vscode Version: 1.89.0 Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 5.4.0-177-generic

and I have the following problem: I have a file where I use a class of model type "App\Models\MslbUserDb"

I declare my main class and the property $mslbUserDb inside.

use App\Models\MslbUserDb;
class User extends BaseController {
   /**
      * Summary of mslbUserDb
      * @var object
      */
     private $mslbUserDb;

I initialize my class using initController method..

     /**
      * Summary of initController
      *
      * @param RequestInterface $request
      * @param ResponseInterface $response
      * @param LoggerInterface $logger
      * @return void
      */
     public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) {
         parent::initController($request, $response, $logger);
         helper(['form', 'array']);
         $this->mslbUserDb = new MslbUserDb();
     }

Here I have a method that references a method of the mslbUserDb class

     /**
      * Summary of getNewusers
      *
      * @param int $my_index
      * @return ResponseInterface|RedirectResponse|string
      */
     public function getNewusers(int $my_index = 0): ResponseInterface|RedirectResponse|string {
         ....
         ....
         $retUsers = $this->mslbUserDb->readUsers(); <<---

The problem is that when I place the cursor over the readUsers() method, no information is displayed and if through the menu I give it the option to go to the definition or press the F12 key, it tells me that there is no definition for "readUsers". Why could this be happening?

Thanks

bmewburn commented 2 months ago

You gave your $mslUserDb prop a type of object instead of App\Models\MslbUserDb

cbazand commented 1 month ago

Thank you very much.