PHP快捷名称,PHPStorm重构快捷方式在use语句中给出别名

您可以使用PHPStorm重构功能(游标在SomeOtherClass,Shift F6上),它允许重命名别名及其用法.

如果您已经在脚本中使用了SomeClass而没有别名,那么首先应该设置一个具有相同名称的别名:

use MyNamespace\SomeClass as SomeClass;

然后重构这个别名,如上所述.

另一个解决方案:

If you import a conflicting name, like Foo\MyClass and you already have use Bar\MyClass; in your document, you should be faced with the following prompt

+--------------------------------------------+

| Import class |

+--------------------------------------------+

| Alias name: |

| [________________________________________] |

| |

| [X] Always create alias while class import |

| |

| [ OK ] [ Cancel ] |

+--------------------------------------------+

The trick is to check the “Always create alias” checkbox to always be

faced with the prompt while importing.

Forgot to mention that you should also uncheck the settings

Settings > Editor > General > Auto Import > [ ] Enable auto-import in

file scope

Settings > Editor > General > Auto Import > [ ] Enable auto-import in

namespace scope

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值