Your project should not use function in loops conditions 3
- Read doc
- Reputation
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.for_loop_uses_test_function
- // Keep highest priority, cancel others
- $kept = $objectives[0];
- $cancelled = [];
- for ($i = 1; $i < count($objectives); $i++) {
- $obj = $objectives[$i];
- $registry->cancelObjective($obj->getId(), 'Cancelled due to conflict with higher priority objective');
- $cancelled[] = $obj->getId();
- }
- {
- // Find logical inconsistencies
- $inconsistencies = [];
- // Simple contradiction detection
- for ($i = 0; $i < count($statements); $i++) {
- for ($j = $i + 1; $j < count($statements); $j++) {
- if ($this->areContradictory($statements[$i], $statements[$j])) {
- $inconsistencies[] = [
- 'statement1' => $statements[$i],
- 'statement2' => $statements[$j],
- // Find logical inconsistencies
- $inconsistencies = [];
- // Simple contradiction detection
- for ($i = 0; $i < count($statements); $i++) {
- for ($j = $i + 1; $j < count($statements); $j++) {
- if ($this->areContradictory($statements[$i], $statements[$j])) {
- $inconsistencies[] = [
- 'statement1' => $statements[$i],
- 'statement2' => $statements[$j],
- 'type' => 'contradiction'