How to automatically generate parameter assignations in class constructors in PhpStorm?

后端 未结 3 2078
花落未央
花落未央 2021-02-19 00:03

Does anyone know how to save typing in PhpStorm when you create a class constructor and you want to assign all the parameters to the respective class fields? I write it by hand

3条回答
  •  無奈伤痛
    2021-02-19 00:25

    If you move the cursor to the word '__constructor', within a second or two a lightbulb pops up. when you press it you get an option "Initialize properties". If you select that option a popup appears where you can specify for which argument you want to create and assign a property.

    [Lightbulb[1]]

提交回复
热议问题