2018-02-21 14:21
浏览 304

在IntelliJ / PhpStorm中搜索所有文件以查找特定错误类型

We recently upgraded on of our projects to PHP7, which doesn't allow the following:

class SomeTestClass {

   * This is the constructor
  public function SomeTestClass (){

The constructor should be renamed to __construct instead of the class-name. PhpStorm correctly indicates this as "Old style constructor usage". Can I search all files of my project for this specific error type?

图片转代码服务由CSDN问答提供 功能建议


  class SomeTestClass {
 / ** 
 * / 
 // Whatever 

构造函数应该重命名为 __ construct 而不是class-name。 PhpStorm正确地将此表示为“旧式构造函数用法”。 我可以针对此特定错误类型搜索项目的所有文件吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongyinzhi4689 2018-02-21 14:27

    There's an inspection for this: PHP → Code Style → Old style constructor. You can then use the menu Code → Inspect code to find them all.

    Code inspections

    打赏 评论
  • dsfs5420 2018-02-21 14:44

    Expansion on jlh's answer: I created a custom Inspection profile with only the one inspection needed:

    enter image description here

    This can then be chosen in the inspect code dialog:

    enter image description here

    If you run the inspection on the project now, it only shows this specific error type.

    打赏 评论

相关推荐 更多相似问题