gpt4 book ai didi

PhpStorm 生成构造函数参数功能的快捷方式

转载 作者:行者123 更新时间:2023-12-02 19:51:23 26 4
gpt4 key购买 nike

PhpStorm 中是否有快捷方式可以为 $model2 生成与 $model1 相同的代码?

class Test{    
private $model1;
public function __construct(string $model1, $model2)
{
$this->model1 = $model1;
....
}
}

最佳答案

  1. 将脱字符号放在 __construct 上或其参数内...并调用“快速修复”菜单(Alt + Enter 或通过灯泡图标)。

  2. 在那里选择适当的选项 - 它将是初始化字段

enter image description here

关于PhpStorm 生成构造函数参数功能的快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43433980/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com