Symfony – Typehint (intellisense) objects within a twig loop

phpstormsymfonytwig

I've searched for a solution but I can't find any suitable for Twig, I know it's a quality of life thing. But it would make templating slightly easier.

Example

{% for userObj in userObjCollection %}
  {{ userObj.property }} 
  {# I want to type hint userObj so I can use intellisense to get the right property #}
{% endfor %}

I'm currently using the PHPStorm IDE,
any suggestions or pointers are greatly appreciated.

Edit
Note that this is pure a question for an easier way to code within the loop. Not something a user of a site would come in contact with. (Also added phpstorm tag to clarify)

Edit 2
I've got the Symfony2 and PHP Annotations plugins installed (Sorry for not pointing this out earlier)

Best Answer

Use this in your twig:

{# @var foo \FooObject #}