使用Symfony 4插件的PhpStorm中缺少Twig模板

时间:2018-08-16 11:48:31

标签: twig phpstorm symfony4

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

我不明白为什么,但是我的树枝页面中的每个包含和扩展都包含有关缺少模板的警告重点。我所有的树枝页面都在模板文件夹中。

代码有效,但是当我想在git中提交时,我会抱怨它们。

我尝试了“ Missing Twig template in PhpStorm with Symfony Plugin”中的所有答案,但无济于事。

enter image description here

名称空间已经设置。

enter image description here

据我所知,Twig正在显示正确的配置。

$ 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%'

1 个答案:

答案 0 :(得分:1)

我没有尝试删除.idea文件夹,因为它没有出现在Project中,并假定Symfony 4必须停止使用它们,因为问题是针对Symfony 3的。