PhpStorm version: 9.0.2
Symfony Plugin version: 0.11.109
Symfony version: 3.0.1
Template referencing works fine for template files placed under app/Resources/views
but not for files placed under Bundle/Resources/views
.
Here goes screenshot. As you can see there is no warning highlight at first line that references to the test.html.twig
file placed under app/
directory, but it warns on templates that are placed under bundle resources.
Code works well and bundle templates renders in browser.
Symfony plugin configuration:
I had the same issue with Symfony 3 / 4 / 5
. The fix is really simple.
All you have to do is add the app/Resources/views
(or templates
in case of Flex
) directory manually to Twig namespaces as follows:
This way you can also support custom Twig namespaces, so PhpStorm can autocomplete those as well.
If it's not working immediately, you should invalidate the cache:
File -> Invalidate Caches / Restart
I just had the same problem as well, however I didn't want to follow @Andrey Rudenko's answer because I would lose all my project specific configuration. Instead I followed @COil's comment and jusnt invalidated my cache and the problem was solved.
File -> Invalidate Caches / Restart -> Invailidate and Restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With