PHP:当 parent 改变时更新 child
PHP: Update child when parent changes
有没有人知道编辑器或完成此操作的简单方法:
class A{
public function __construct($a){
//Do something
}
}
Class B extends A{
public function __construct($a,$b){
parent::__construct($a);
//DO something with $b
}
}
假设我更新了 A class 中的 __construct,添加了第二个参数。
class A{
public function __construct($a,$c){
//Do something
}
}
是否有任何 IDE 会自动更新我的 A class 中的所有子项以更新 __construct 方法?
Class B extends A{
public function __construct($a,$b,$c){
parent::__construct($a,$c);
//DO something with $b
}
}
谢谢
PHPStorm IDE 你在标签中提到的可以做到这一点。只需确保使用 Refactor 工具(Refactor > Change signature in your case)——在 ccode 中手动添加参数不会在 children.
上有任何结果
有没有人知道编辑器或完成此操作的简单方法:
class A{
public function __construct($a){
//Do something
}
}
Class B extends A{
public function __construct($a,$b){
parent::__construct($a);
//DO something with $b
}
}
假设我更新了 A class 中的 __construct,添加了第二个参数。
class A{
public function __construct($a,$c){
//Do something
}
}
是否有任何 IDE 会自动更新我的 A class 中的所有子项以更新 __construct 方法?
Class B extends A{
public function __construct($a,$b,$c){
parent::__construct($a,$c);
//DO something with $b
}
}
谢谢
PHPStorm IDE 你在标签中提到的可以做到这一点。只需确保使用 Refactor 工具(Refactor > Change signature in your case)——在 ccode 中手动添加参数不会在 children.
上有任何结果