Get rid of continue 2; and use array_filter instead of manual looping
parent
451bab1c2c
commit
a395bc04d7
|
@ -57,15 +57,16 @@ class RuleWatchGraph
|
|||
if (!$node->getRule()->isDisabled() && !call_user_func($skipCallback, $otherWatch)) {
|
||||
$ruleLiterals = $node->getRule()->getLiterals();
|
||||
|
||||
foreach ($ruleLiterals as $ruleLiteral) {
|
||||
if ($literal !== $ruleLiteral &&
|
||||
$alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $conflictCallback) {
|
||||
return $literal !== $ruleLiteral &&
|
||||
$otherWatch !== $ruleLiteral &&
|
||||
!call_user_func($conflictCallback, $ruleLiteral)) {
|
||||
!call_user_func($conflictCallback, $ruleLiteral);
|
||||
});
|
||||
|
||||
$this->moveWatch($literal, $ruleLiteral, $node);
|
||||
|
||||
continue 2;
|
||||
}
|
||||
if ($alternativeLiterals) {
|
||||
reset($alternativeLiterals);
|
||||
$this->moveWatch($literal, current($alternativeLiterals), $node);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (call_user_func($conflictCallback, $otherWatch)) {
|
||||
|
|
Loading…
Reference in New Issue