-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Intellisense for Laravel helper methods #1601
Comments
+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 |
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 foundThe text was updated successfully, but these errors were encountered: