Is there a shortcut in PhpStorm to generate code for $model2 same as $model1?
class Test{
private $model1;
public function __construct(string $model1, $model2)
{
$this->model1 = $model1;
....
}
}
Place caret on __construct or inside its' parameters .. and invoke Quick Fix menu (Alt + Enter or via light bulb icon).
Choose appropriate option there -- it will be Initialize fields

Yes, place cursor on $model2, then press Alt+Enter and choose option Initialize fields.
It will create a private field in your class (if it doesn't exists yet), and assign it inside constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With