手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆

来自官方:‘Extract Function/Method’ refactoring for PHP

首页 > Software >

先不说什么功能,只能说这种功能对我们来说太有用了。
refactor,这种重构,其实在ZS和NETBEANS 中效果并没有现在这个软件(phpstorm)那么明显。看看它的功能就知道了。
官方网址(http://blog.jetbrains.com/webide/2011/05/extract-function-method-refactoring-for-php/)说:
We are working hard on new features for PhpStorm 2.1, and the ‘Extract Function/Method’ refactoring for PHP is one of them. This feature has been available since the first PhpStorm 2.1 EAP(106.444), and we are looking forward for your feedback.

Picture 1b: Select an expression

Invoke the refactoring from the menu ‘Refactor -> Extract Method‘ or using  a hotkey. The default hotkey is Ctrl+Alt+M for Windows/Linux and Cmd+Opt+M for Mac.
Depending on the context of the selected code fragment, ‘Extract method’ (the  code fragment is inside a method) (Picture 2b) or ‘Extract Function’(the code fragment is inside a function or script) (Picture 2a).

Picture 2a: ‘Extract Function’ dialog

Picture 2b: ‘Extract Method’ dialog

Enter the name of the new function/method. Press OK.

Picture 3a:  The code fragment is replaced with a function call statement

Picture 3b: The expression is replaced with a method call expression

Picture 4a: Definition of the extracted function

Picture 4b: Definition of the extracted method

Develop with pleasure!
------------
看完上面的内容,你是否觉 得,原来重构也可以这样简单?




本站采用创作共享版权协议, 要求署名、非商业和保持一致. 本站欢迎任何非商业应用的转载, 但须注明出自"易栈网-膘叔", 保留原始链接, 此外还必须标注原文标题和链接.

Tags: phpstorm, refactor

« 上一篇 | 下一篇 »

只显示10条记录相关文章

我为什么会选用phpstorm (浏览: 54024, 评论: 5)
phpstorm试用 (浏览: 30596, 评论: 2)
phpstorm 函数提示 (浏览: 27118, 评论: 1)
备份:PhpStorm字体修改终极方案 (浏览: 26224, 评论: 0)
解决phpstorm 3.0 乱码问题 (浏览: 26165, 评论: 0)
PhpStorm中因为JS版本低而提示错误的解决 (浏览: 24395, 评论: 0)
官方wiki:Configuring PhpStorm IDE for Yii (浏览: 24225, 评论: 0)
phpstorm4:自定义代码折叠区域 (浏览: 22700, 评论: 1)
收到phpstorm序列号 (浏览: 22486, 评论: 0)
安装St2的Dash插件 (浏览: 21012, 评论: 0)

发表评论

评论内容 (必填):