dongshan4549 2015-08-30 11:04
浏览 45
已采纳

PhpStorm在CakePHP上显示我的Bake主题错误

On PhpStorm 9 I have associated *.ctp with PHP.

I have also created my own Bake Theme

http://book.cakephp.org/3.0/en/bake/development.html#creating-a-bake-theme.

Because inside these files there is code written like this

<%
$done = [];
        foreach ($associations as $type => $data):
            foreach ($data as $alias => $details):
                if (!empty($details['navLink']) && $details['controller'] !== $this->name &&
                    !in_array($details['controller'],
                    $done)):
        %>

It shows these files with red underline like the have an error. PhpStorm doesn't recognize <% and other stuff like this as valid PHP code. But it doesn't only show these files it also shows all the parent folders too and I don't know if there is actually an error on these folders and sometimes I go through the folders to check again. Just to be sure.

One way to solve this would be to change the extension of the files to something else. So they won't be associated anymore with PHP. But I don't know how I can tell CakePHP to bake the template from files with different extension than *.ctp.

The other solution would be to tell PhpStorm to ignore a certain path from inspections but I don't know how to do this either.

  • 写回答

1条回答 默认 最新

  • douya2433 2015-08-30 15:50
    关注

    Changing the extension used by the bake view doesn't seem to be possible, while you can get access to the view class via the Bake.initialize event, the property that holds the extension is protected and can only be changed via inheritance.

    A quick fix on the IDE side of the story would be exclusions.

    Right Click > Mark Directory As > Excluded

    This will exclude the folder from search, inspections, code completion and indexing.

    See also https://www.jetbrains.com/phpstorm/help/directories.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度