PhpStormにのコードを生成するショートカットは$model1
と同じですか?PhpStormコンストラクタparamsの機能を生成するショートカット
class Test{
private $model1;
public function __construct(string $model1, $model2)
{
$this->model1 = $model1;
....
}
}
PhpStormにのコードを生成するショートカットは$model1
と同じですか?PhpStormコンストラクタparamsの機能を生成するショートカット
class Test{
private $model1;
public function __construct(string $model1, $model2)
{
$this->model1 = $model1;
....
}
}
はい、$model2
上の場所のカーソルが、その後、 + が入力Altキーを押して、オプションInitialize fields
を選択してください。
クラスにプライベートフィールドを作成し(まだ存在しない場合)、コンストラクタ内に割り当てます。