PhpStorm-从调用中创建方法 [英] PhpStorm - Create a method from it's call

查看:174
本文介绍了PhpStorm-从调用中创建方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于快速类原型,我正在寻找一种从调用中创建方法声明的方法.

For fast class prototyping I'm looking for a way to create methods declaration from it's call.

示例:

我在写.

$this->doStuff($action);

魔术发生了.生成以下代码:

Magic happens. Following code is generated :

function doStuff ($action) {
    //My cursor is here
}

PhpStorm是否可能?

Is it possible with PhpStorm ?

我看到了代码提取的实现,这很好,但是不一样. Getter和setter的插入也不相同,因为应该首先声明一个类属性.

I saw code extraction implementation, it's nice, but it's not the same. Getters and setters inserting is not the same also, because a class property should be declared initially.

推荐答案

Alt + Enter ,同时在此呼叫中插入,并从中选择适当的选项.

Alt + Enter while having caret on such call and choose appropriate option from there.

这篇关于PhpStorm-从调用中创建方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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