使用 Symfony 4 插件的 PhpStorm 中缺少 Twig 模板
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
我不明白为什么,但我的 twig 页面中的每个包含和扩展都包含有关缺少模板的警告突出显示。我所有的树枝页面都在模板文件夹中。
代码有效,但是当我想在 git 中提交时,我收到了关于它们的投诉。
我试过“”中的所有答案都无济于事。
命名空间已经设置。
据我所知,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%'
我没有尝试删除 .idea
文件夹,因为它没有出现在项目中,并且假设 Symfony 4 一定已经停止使用它们,因为问题是针对 Symfony 3 的。
PhpStorm version: 2018.2
Symfony Plugin Version: 0.16.165
Symfony version: 4.1.3
OS: Windows 10
我不明白为什么,但我的 twig 页面中的每个包含和扩展都包含有关缺少模板的警告突出显示。我所有的树枝页面都在模板文件夹中。
代码有效,但是当我想在 git 中提交时,我收到了关于它们的投诉。
我试过“
命名空间已经设置。
据我所知,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%'
我没有尝试删除 .idea
文件夹,因为它没有出现在项目中,并且假设 Symfony 4 一定已经停止使用它们,因为问题是针对 Symfony 3 的。