Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I want PHPdoc blocks were considered within the blade template.

PhpStorm 9, Laravel 5.1, blade template file:

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

I tried different variants:

{{
/**
* @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...

How to make the autocomplete worked in all blocks for blade templates?

like image 456
Ivan Orlov Avatar asked Dec 07 '15 10:12

Ivan Orlov


1 Answers

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

 @php /** @var App\Models\User $user */ @endphp
 {{ $user->email }}
like image 123
Nikola Dimitrijevic Avatar answered Oct 28 '22 07:10

Nikola Dimitrijevic