2018-08-09 08:01
浏览 100


In PhpStorm, I am adding some code to a class. The class has a private property defined via this line:

private $pdfService

... but the line is underlined by the IDE's syntax checker. Hovering over the line shows the following error message:

Private member variable "jobRepository" must be prefixed with an underscore

This is annoying, since using an underscore to indicate privacy on a property is explicitly discouraged by PSR-2.

Is there a simple way to update the syntax checking so that it adheres to PSR-2 in regards to this rule?


Edit: Here's a screenshot.

enter image description here

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

在PhpStorm中,我将一些代码添加到类中。 该类有一个通过以下行定义的私有属性:

  private $ pdfService 

...但是 IDE的语法检查器强调了行的下划线。 将鼠标悬停在该行上会显示以下错误消息:

私有成员变量“jobRepository”必须以 下划线为前缀

这很烦人,因为 PSR-2




  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duandao8607 2018-08-09 08:48

    The whole message starts with phpcs: .. which means that it comes from PHP Code Sniffer which you have configured and enabled integration for this project.

    Adjust your Code Sniffer rules accordingly or choose different Coding standard (at Settings/Preferences | Editor | Inspections | PHP | Quality tools | PHP Code Sniffer validation) where you do not have such requirement.

    enter image description here

    解决 无用
    打赏 举报

相关推荐 更多相似问题