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

5
PhpStorm version: 2018.2
Symfony Plugin Version: 0.16.165
Symfony version: 4.1.3
OS: Windows 10
我不明白为什么我的twig页面中的每个include和extend都会出现有关缺少模板的警告。 我的所有twig页面都在templates文件夹中。 代码可以正常工作,但是当我想在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个回答

阿里云服务器只需要99元/年,新老用户同享,点击查看详情
3

我之前没有尝试删除.idea文件夹,因为它不会在项目中显示出来,而且我认为Symfony 4可能已经停止使用它们,因为这个问题是针对Symfony 3的。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,