How I can make variables autocomplete in the PhpStorm 9 for Blade templates?

旧时模样 提交于 2019-11-30 13:10:29

ATM PhpStorm does not support PHPDoc comments in blade templates using blade syntax (especially for completing blade variables).

Please follow these tickets (star/vote/comment) to get notified on progress:

You can now do it like you wanted:

<?php
/* @var App\Models\User $user */
?>
...
{{ $user->email }} <- autocomplete working

see https://blog.jetbrains.com/phpstorm/2017/02/code-completion-in-laravel-blade-templates/

As of right now this isn't entirely possible due to PHPStorm's lack of support for Blade templates.

This package may be of some use for other Laravel related issues https://github.com/barryvdh/laravel-ide-helper

More or less same answer, just wrapped in a blade directive:

 @php /** @var App\Models\User $user */ @endphp
 {{ $user->email }}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!