gpt4 book ai didi

php - 如何在 PhpStorm 9 for Blade 模板中使变量自动完成?

转载 作者:可可西里 更新时间:2023-11-01 12:17:13 30 4
gpt4 key购买 nike

我希望在 Blade 模板中考虑 PHPdoc block 。

PhpStorm 9、Laravel 5.1、 Blade 模板文件:

<?php
/* @var App\Models\User $user */
?>
...
<?= $user->email ?> <- autocomplete for the word "email" is working
...
{{ $user->email }} <- autocomplete not working

我尝试了不同的变体:

{{
/**
* @var App\Models\User $user
**/
}}
{{ /* @var App\Models\User $user */ }}
...
{{ $user->email }} <- autocomplete not working...
...
In such variant autocomplete works, but only within that block:
{{
/* @var App\Models\User $user */
$user->email
}}
...
{{ $user->email }} <- here does not work again...

如何使自动完成功能在 Blade 模板的所有 block 中工作?

最佳答案

大致相同的答案,只是包裹在 Blade 指令中:

 @php /** @var App\Models\User $user */ @endphp
{{ $user->email }}

关于php - 如何在 PhpStorm 9 for Blade 模板中使变量自动完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34131021/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com