3

I'm having trouble getting Twig syntax checking and highlighting for *.php and *.tpl* files in PhpStorm? It throws a lot of syntax errors. The HTML and PHP syntax is already getting picked up.

In Settings | File Types | Twig, I can't add filetype *.php because it's already in use and it asks me to replace it.

5
  • 1
    There is no other way -- only by associating file extensions in Settings | File Types | Twig (yep -- pattern can only be associated with one file type at a time) . BTW -- why do you use twig in PHP files? Commented May 20, 2015 at 9:15
  • I use Twig in files with a PHP extension for some frameworks that load their HTML templates that way. Commented May 20, 2015 at 9:39
  • But why not renaming them with the *.html.twig extension ? Commented May 20, 2015 at 12:23
  • That's outside the scope of the question. They're not my files and it's possible to render correct highlighting on mixed HTML, PHP and JavaScript for example. Commented May 20, 2015 at 12:24
  • 1
    Are you using Symfony2? In this case, you could use the Symfony plugin Commented May 20, 2015 at 13:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.