PHPMD 告诉我,我应该在这个测试中避免 else 阻塞,但在这种情况下,我找不到删除它们的方法。
这是代码:
if ($fight->c1 == NULL) {
if ($fight->c2 == NULL) {
// C1 and C2 Is Bye
$this->assertEquals($parentFight->$toUpdate, NULL);
}
else {
// C1 Is Bye
$this->assertEquals($parentFight->$toUpdate, $fight->c2);
}
}
else {
if ($fight->c2 == NULL) {
// C2 Is Bye
$this->assertEquals($parentFight->$toUpdate, $fight->c1);
}
else {
// C1 and C2 Are all set
$this->assertEquals($parentFight->$toUpdate, NULL);
}
}
任何想法???