Closed ghost closed 1 year ago
These are not cases ide-helper handles (or was designed to handle) 🤷🏼 I suggest to read the docs to get a better idea.
I'm not using vscode, but I can give you some suggestions what might work:
In the first one you likely can help yourself, I've two suggestion:
handle
method and document what the closure accepts/returns:
/**
* @param Request $request
* @param Closure(Request):Response $next
*/
public function handle(Request $request, Closure $next): Response
{
/** @var Response $result */
$result = $next($request);
In the second example, Laravel documents $this->app
as \Illuminate\Contracts\Foundation\Application
, but isLocal
is from the concrete class which implements the interface, this one here https://github.com/laravel/framework/blob/c1569099594168870cb4bdabfbaa35e5d172310b/src/Illuminate/Foundation/Application.php#L666-L669
At least in phpstorm, once you wrote isLocal()
it infers it (and does not underline it)
The yolo
one is made up, isLocal
shows no indicator and you can also jump to source here.
But alas, phpstorm does not provide autocomplete to it per se. However, the github copilot will certainly suggest it 😅
I'm not ware if vscode supports stubbing for those or even how to write them, phpstorm supports the meta file format but I could not see either aspects being supported.
Versions:
Question:
I can't get it to work. I have tried using this but vscode still complains. I honestly don't know what to do other than to just ignore the error. All I get is
Undefined method
The code works just fine.