Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Twig template in PhpStorm with Symfony 4 Plugin

PhpStorm version: 2018.2
Symfony Plugin Version: 0.16.165
Symfony version: 4.1.3
OS: Windows 10

I don't understand why, but every include and extend in my twig pages contain warning highlights about missing templates. All my twig pages are in the templates folder.

The code works, but I get complaints about them when I want to commit in git.

I've tried all answers in "Missing Twig template in PhpStorm with Symfony Plugin" to no avail.

enter image description here

Namespace has already been set.

enter image description here

Twig is showing correct configuration as far as I can tell.

$ php bin/console debug:config twig

Current configuration for extension with alias "twig"
=====================================================

twig:
    paths:
        'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp\vendor\knplabs\knp-menu\src\Knp\Menu/Resources/views': null
        'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp/templates': null
    debug: true
    strict_variables: true
    exception_controller: 'twig.controller.exception::showAction'
    form_themes:
        - form_div_layout.html.twig
    globals: {  }
    autoescape: name
    autoescape_service: null
    autoescape_service_method: null
    cache: 'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp\var\cache\dev/twig'
    charset: UTF-8
    default_path: 'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp/templates'
    date:
        format: 'F j, Y H:i'
        interval_format: '%d days'
        timezone: null
    number_format:
        decimals: 0
        decimal_point: .
        thousands_separator: ','

twig.yaml

twig:
    paths: ['%kernel.project_dir%/templates']
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
like image 828
rmsluimers Avatar asked Oct 16 '22 14:10

rmsluimers


People also ask

Does Symfony use Twig?

Templates in Symfony are created with Twig: a flexible, fast, and secure template engine.

What is Twig in Symfony?

Twig is a template engine for the PHP programming language. Its syntax originates from Jinja and Django templates. It's an open source product licensed under a BSD License and maintained by Fabien Potencier. The initial version was created by Armin Ronacher.

Is Twig a template engine?

Twig is a modern template engine for PHPSecure: Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design.

What is Twig file extension?

File created by Twig, a PHP optimizing template engine; contains a template that will be generated into a specific final format, such as a HTML, JavaScript, XML, or CSS based file; the twig extension determines what engine should be used to create the final format whether it's the Twig or PHP engine.


1 Answers

I hadn't tried deleting the .idea folder because it doesn't show up in Project and assumed that Symfony 4 must have stopped using them as the question was aimed at Symfony 3.

like image 93
rmsluimers Avatar answered Oct 21 '22 08:10

rmsluimers