如何告诉PHPStorm重构名称空间和类名称? [英] How can I tell PHPStorm to refactor namespaces and class names?

查看:242
本文介绍了如何告诉PHPStorm重构名称空间和类名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在PHPStorm中移动文件时,它根本不会调整名称空间.我的项目使用PSR-0,因此目录结构反映了名称间隔.移动文件时,PHPStorm是否可以调整名称空间?

I've noticed when I move a file in PHPStorm, it doesn't adjust the namespace at all. My project uses PSR-0, so directory structure mirrors the namespacing. Is it possible to have PHPStorm adjust the namespace when a file is moved?

此外,重命名文件时,类名未更改,然后我必须进入并重命名该类.是否可以在一个步骤中重命名文件和类?

Also, when renaming a file the class name is not changed and I then have to go in and rename the class. Is it possible to rename a file and the class in a single step?

我正在使用7.1.3

I'm using 7.1.3

推荐答案

由于我的应用程序是Laravel应用程序,因此根目录不是命名空间的来源. PHPStorm从8.0开始提供了一个新选项,允许您将目录指定为名称空间根目录: http://youtrack.jetbrains. com/issue/WI-22585

Because my application is a Laravel app the root directory was not the source of the namespacing. PHPStorm has a new option as of 8.0 that allows you to specify a directory as the namespace root: http://youtrack.jetbrains.com/issue/WI-22585

这篇关于如何告诉PHPStorm重构名称空间和类名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆