Haehnchen / idea-php-symfony2-plugin

IntelliJ IDEA / PhpStorm Symfony Plugin
https://plugins.jetbrains.com/plugin/7219
MIT License
910 stars 137 forks source link

Variable types in Twig don't support union types #1327

Open stof opened 5 years ago

stof commented 5 years ago

When using a {# @var #} comment in Twig to document the type of a variable, union types are not supported properly. Only the first type of the union is used by the autocomplementation after that.

01e9 commented 4 years ago

+1

Now I always add at the beginning of twig template

{# @var \App\Entity\Foo foo #}
{# @var \App\Entity\Bar[] bar #}
{# @var string|null baz #}

and it kind of works sometimes.

I would like this feature to be officially supported and the autocomplete and type resolving to be as good as in regular php files.