Thursday 15 July 2010

php - PHPStorm autocomplete twig vars -



php - PHPStorm autocomplete twig vars -

i'm using phpstorm 8.1 ide in php project (laravel 4.1 project twig on view side)

will great have autocomplete hint on vars on "twig side" can see here on phpstorm plugin symfony2: http://symfony2-plugin.espend.de/languages/twig/index.html#phptypes

basically in twig view declare var "type" using comment, see hints on model (farmaco):

{# farmaco \farmaco #} {% farmaco. %} <-- see hints -->

note: i'm not using symfony, i've symfony plugin installed autocomplete doesn't work me on twig files laravel project.

you seem missing @var annotation. right form be:

{# @var foo \fooservice #} {{ foo. }} <!-- press ctrl+space typehints -->

i got working non-symfony project without issues. sure check symfony plugin enabled project (it isn't default) , restart ide after enable it.

also create sure type-hint point fully qualified class name.

as sidenote, have not (yet) gotten work properties, i.e. foo.bar.* when property accessed through magic (using __get). instances property needs set variable of own:

{# @var foo \fooservice #} {{ foo.bar. }} <!-- no typehints bar :-( --> {% set bar = foo.bar %} {# @var bar \barservice #} {{ bar. }} <!-- press ctrl+space typehints :-) -->

php laravel phpstorm

No comments:

Post a Comment