Open saade opened 2 weeks ago
+1. I was wondering about the exact same thing. I'm assuming one could use the 'interfaces' option in the ide-helper config to add docs to the interface. But I haven't been succesfull in making it work.
@Tjaitil same here, couldn't make interfaces
option work
My temporary solution is to make an custom ide-helper file with the macro docs and then include it in extra section in the ide-helper.config
<?php
namespace Illuminate\Contracts\Routing {
interface ResponseFactory
{
/**
* @param array<int|string, mixed> $data
* @param array<int, \App\ValueObjects\GameLog>|\App\ValueObjects\GameLog> $messages
* @param int $code
* @param array<int|string, mixed> $headers
* @param int $options
* @return \Illuminate\Http\JsonResponse
*/
public function jsonWithGameLogs($data = [], array|\App\ValueObjects\GameLog $messages = [], $code = 200, $headers = [], $options = 0);
}
}
/** In ide-helper.config */
` /*
|--------------------------------------------------------------------------
| Helper files to include
|--------------------------------------------------------------------------
|
| Include helper files. By default not included, but can be toggled with the
| -- helpers (-H) option. Extra helper files can be included.
|
*/
'include_helpers' => true,
'helper_files' => [
base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
base_path().'_macro_ide_helper.php',
],
At least in my setup (intelephense and larastan) this extra doc file is providing everything that is needed.
Perhaps not the ideal solution, but works while we wait for another answer :)
Versions:
Question:
When defining a macro, let's say for the Response class:
is it possible to get intellisense when using? :
This also occurs when macroing Auth too:
PS: The method works as expected, just the intellisense cannot pick the defined macro PS2: Even
auth()->user()
which is a standard method is not being found