type hinting works within php block but not in blade

Hi there,

I have been using PhpStorm 2016.3.3 version with Laravel and Blade plugins.

The plugins work great inside the model and controllers but not as well inside the blade view.

In my dashboard.blade.php file, I have th following code: https://paste.laravel.io/49676377-385f-4287-adf5-fc9cc609832a

The code completion works inside the <?php ?> block but it doesn't work inside the {{ }} blade block.

What can I do to make it work inside the {{ }} block? Is this not possible?

Thank you in advance.

7 comments
Comment actions Permalink

Hi there,

Where exactly it does not work? A screenshot showing the exact situation is welcome.

But in general -- using latest stable PhpStorm 2017.2.4 with Laravel plugin & IDE helper:

IDE does not provide completion assistance for me for "$league" itself.. (e.g. "{{ $le[CARET] }}") but does provide for it's methods ("$league->[CARET]"). At the same time if the same variable was already used in the same block (e.g. "{{ $league->doSomething($lea[CARET]) }}") then it shows $league in completion.

P.S. You may try 2017.3 EAP build to see if it shows better behaviour (AFAIK there were some improvements in this regard)

2
Comment actions Permalink

Hi Andriy,

Sorry for not being clear about my question.  As you have guessed it correctly, I was referring to the auto completion assistance within blade syntax not working well.

I'm surprised (and happy) to hear that auto-completion for variable method ("$league->[CARET]") works on PhpStorm 2017.2.4 but not in 2016.3.3.  

As mentioned in my original post, the auto completion works without any issue within the <php? ?> block but not in the {{ }} block (I see "no suggestions").

As you suggested, I'm going to first try the 2017.3 EAP build and if it does indeed work then I guess it's a good enough of a reason for me to upgrade!

Thanks again for your help and suggestions. Cheers!

 

0
Comment actions Permalink

Hi Andriy,

I have confirmed that auto-completion assistance works wonderfully within {{ }} blade in 2017.3 EAP build.

I guess I will use the EAP build until official 2017.3 is released then make the purchase.

Thanks again!

Regards,

David

0
Comment actions Permalink

Hello. I guess i still have same problem in 2018.1.1 build.

i've declared some variable in @php @endphp block, and then try to output it via {{  }} or {!!  !!}, not any of them have auto completion of this variable name - http://prntscr.com/j9vm72

am i doing something wrong or there still a bug / incomplete blade support?

0
Comment actions Permalink

@Alexey Sv

Sorry, no idea.

I never write a code like that myself.

Blade file for me is a template ... which means that ALL data that is passed to it is already ready for displaying .. or I call some method on passed variable/object directly with no additionally introduced local variables (and such calls are simple: get some class name used for displaying this element; transform date or stuff like that -- all heavy logic/calculations are already done before getting into blade template).

0
Comment actions Permalink

@Andriy Bazanov

The thing is that it works in another @php block, but not in {{}} and shorthand @php() 

http://prntscr.com/j9vv8b http://prntscr.com/j9vvxb

0
Comment actions Permalink

@Alexey Sv

From my end I may only suggest to make some simple code example and file a ticket to the Issue Tracker where devs will tell for sure.

It could be this one (https://youtrack.jetbrains.com/issue/WI-41272) .. but the guy was using older 2017.2 version ... and no feedback since then.

Or this one (https://youtrack.jetbrains.com/issue/WI-37741) -- old ticket / old IDE version and therefore may not be relevant by now...

0

Please sign in to leave a comment.