禁止导入PHPDoc的类 [英] Disable import of classes for PHPDoc
问题描述
我对PhpStorm的一件事是很容易地导入类(为您添加use语句).但是,这种烦恼是当您实际上不希望它导入类时.例如,当我将一个方法的返回值记录为另一个类时.
One thing I love about PhpStorm is the easy import of classes (adding the use statement for you). However, the annoyance with this is when you don't actually want it to import the class. For example, when I'm documenting a method's return value as another class.
是否只有在PHPDoc块中进行注释时,才能禁用PhpStorm的类导入?
Is there any way to disable PhpStorm's import of classes only when annotating in PHPDoc blocks?
推荐答案
如果我正确理解了您的要求...
If I understand your request correctly...
-
Settings/Preferences
-
Editor | Code Style | PHP
-
PHPDoc
标签 -
Generated Doc Blocks
下有
Use fully-qualified class names
Settings/Preferences
Editor | Code Style | PHP
PHPDoc
tab- There is
Use fully-qualified class names
underGenerated Doc Blocks
在完成@return
中的尚未导入的课程时,该选项即可完成工作(对@param
和其他人应该执行相同的操作-自己未测试其他标签-仅选中了在@return
上).
That option does the job when completing not-yet-imported class in @return
(should do the same for @param
and others -- have not tested other tags myself -- only checked on @return
).
相关说明:该票据要求具有始终在PHPDoc块中使用FQN的功能(实现为Inspection ..可以打开或关闭).可能对您有用-考虑投票.
On related note: this ticket is asking to have an ability to always use FQN in PHPDoc blocks (implemented as Inspection .. so can be turned on or off). Might be useful for you -- consider voting.
https://youtrack.jetbrains.com/issue/WI-28591
这篇关于禁止导入PHPDoc的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!