Passed
Push — master ( c27bb9...b29dfd )
by Jean
03:16
created
src/Rule/AndRule.php 2 patches
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function rootifyDisjunctions(array $simplification_options)
23 23
     {
24
-        if ( ! $this->isNormalizationAllowed($simplification_options)) {
24
+        if (!$this->isNormalizationAllowed($simplification_options)) {
25 25
             return $this;
26 26
         }
27 27
 
28
-        $this->moveSimplificationStepForward( self::rootify_disjunctions, $simplification_options );
28
+        $this->moveSimplificationStepForward(self::rootify_disjunctions, $simplification_options);
29 29
 
30 30
         $upLiftedOperands = [];
31 31
         foreach ($this->getOperands() as $operand) {
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         }
39 39
 
40 40
         // If the AndRule doesn't contain any OrRule , there is nothing to uplift
41
-        if ( ! array_filter($upLiftedOperands, function($operand) {
41
+        if (!array_filter($upLiftedOperands, function($operand) {
42 42
             return $operand instanceof OrRule;
43 43
         })) {
44 44
             return new AndRule($upLiftedOperands);
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 
57 57
         foreach ($upLiftedOperands as $i => $operand) {
58 58
             if ($operand instanceof NotRule) {
59
-                if (    ($operand instanceof NotEqualRule || $operand instanceof NotInRule)
60
-                    && ! $operand->isNormalizationAllowed($simplification_options)
59
+                if (($operand instanceof NotEqualRule || $operand instanceof NotInRule)
60
+                    && !$operand->isNormalizationAllowed($simplification_options)
61 61
                 ) {
62 62
                     foreach ($upLiftedOr->getOperands() as $upLifdtedOperand) {
63
-                        $upLifdtedOperand->addOperand( $operand->copy() );
63
+                        $upLifdtedOperand->addOperand($operand->copy());
64 64
                     }
65 65
                 }
66 66
                 else {
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
                 foreach ($operand->getOperands() as $subOperand) {
83 83
                     foreach ($upLiftedOr->getOperands() as $upLiftedOrSubOperand) {
84 84
                         $newUpLiftedOrSubOperand = $upLiftedOrSubOperand->copy();
85
-                        $newUpLiftedOrSubOperand->addOperand( $subOperand->copy() );
85
+                        $newUpLiftedOrSubOperand->addOperand($subOperand->copy());
86 86
                         if ($newUpLiftedOrSubOperand->simplify($simplification_options)->hasSolution($simplification_options)) {
87
-                            $newUpLiftedOr->addOperand( $newUpLiftedOrSubOperand );
87
+                            $newUpLiftedOr->addOperand($newUpLiftedOrSubOperand);
88 88
                         }
89 89
                     }
90 90
                 }
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
             else {
95 95
                 // append the operand to all the operands of the $upLiftedOr
96 96
                 foreach ($upLiftedOr->getOperands() as $upLifdtedOperand) {
97
-                    if ( ! $upLifdtedOperand instanceof AndRule) {
97
+                    if (!$upLifdtedOperand instanceof AndRule) {
98 98
                         throw new \LogicException(
99 99
                              "Operands of the uplifted OrRule MUST be AndRules during"
100 100
                             ."the combination."
101 101
                         );
102 102
                     }
103 103
 
104
-                    $upLifdtedOperand->addOperand( $operand->copy() );
104
+                    $upLifdtedOperand->addOperand($operand->copy());
105 105
                 }
106 106
             }
107 107
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @todo same as OrRule
118 118
      */
119
-    public function toArray(array $options=[])
119
+    public function toArray(array $options = [])
120 120
     {
121 121
         $default_options = [
122 122
             'show_instance' => false,
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
             'semantic'      => false,
125 125
         ];
126 126
         foreach ($default_options as $default_option => &$default_value) {
127
-            if ( ! isset($options[ $default_option ])) {
128
-                $options[ $default_option ] = $default_value;
127
+            if (!isset($options[$default_option])) {
128
+                $options[$default_option] = $default_value;
129 129
             }
130 130
         }
131 131
 
132
-        if ( ! $options['show_instance'] && ! empty($this->cache['array'])) {
132
+        if (!$options['show_instance'] && !empty($this->cache['array'])) {
133 133
             return $this->cache['array'];
134 134
         }
135 135
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $operands_as_array[] = $operand->toArray($options);
154 154
             }
155 155
 
156
-            if ( ! $options['show_instance']) {
156
+            if (!$options['show_instance']) {
157 157
                 return $this->cache['array'] = $operands_as_array;
158 158
             }
159 159
             else {
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 
165 165
     /**
166 166
      */
167
-    public function toString(array $options=[])
167
+    public function toString(array $options = [])
168 168
     {
169 169
         $operator = self::operator;
170
-        if ( ! $this->operands) {
170
+        if (!$this->operands) {
171 171
             return $this->cache['string'] = "['{$operator}']";
172 172
         }
173 173
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         foreach ($this->operands as $operand) {
180 180
             $out .= implode("\n", array_map(function($line) use (&$indent_unit) {
181 181
                 return $indent_unit.$line;
182
-            }, explode("\n", $operand->toString($options)) )) . ",$line_break";
182
+            }, explode("\n", $operand->toString($options)))).",$line_break";
183 183
         }
184 184
 
185 185
         $out .= ']';
@@ -193,17 +193,17 @@  discard block
 block discarded – undo
193 193
     public function removeSameOperationOperands()
194 194
     {
195 195
         foreach ($this->operands as $i => $operand) {
196
-            if ( ! is_a($operand, AndRule::class)) {
196
+            if (!is_a($operand, AndRule::class)) {
197 197
                 continue;
198 198
             }
199 199
 
200
-            if ( ! $operands = $operand->getOperands()) {
200
+            if (!$operands = $operand->getOperands()) {
201 201
                 continue;
202 202
             }
203 203
 
204 204
             // Id AND is an operand on AND they can be merge (and the same with OR)
205 205
             foreach ($operands as $sub_operand) {
206
-                $this->addOperand( $sub_operand->copy() );
206
+                $this->addOperand($sub_operand->copy());
207 207
             }
208 208
             unset($this->operands[$i]);
209 209
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $has_been_changed = true;
212 212
         }
213 213
 
214
-        return ! empty($has_been_changed);
214
+        return !empty($has_been_changed);
215 215
     }
216 216
 
217 217
     /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function removeInvalidBranches(array $simplification_options)
224 224
     {
225
-        if ( ! $this->isNormalizationAllowed($simplification_options)) {
225
+        if (!$this->isNormalizationAllowed($simplification_options)) {
226 226
             return $this;
227 227
         }
228 228
 
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 
231 231
         foreach ($this->operands as $i => $operand) {
232 232
             // if ($operand instanceof AndRule || $operand instanceof OrRule ) {
233
-            if ( in_array( get_class($operand), [AndRule::class, OrRule::class]) ) {
233
+            if (in_array(get_class($operand), [AndRule::class, OrRule::class])) {
234 234
                 $this->operands[$i] = $operand->removeInvalidBranches($simplification_options);
235
-                if ( ! $this->operands[$i]->hasSolution()) {
235
+                if (!$this->operands[$i]->hasSolution()) {
236 236
                     $this->operands = [];
237 237
                     return $this;
238 238
                 }
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
         // $this->dump(true);
245 245
 
246 246
         foreach ($operandsByFields as $field => $operandsByOperator) {
247
-            if ( ! empty($operandsByOperator[ EqualRule::operator ])) {
248
-                foreach ($operandsByOperator[ EqualRule::operator ] as $equalRule) {
247
+            if (!empty($operandsByOperator[EqualRule::operator])) {
248
+                foreach ($operandsByOperator[EqualRule::operator] as $equalRule) {
249 249
                     // Multiple equal rules without the same value is invalid
250 250
                     if (isset($previousEqualRule) && $previousEqualRule->getValue() != $equalRule->getValue()) {
251 251
                         $this->operands = [];
@@ -255,55 +255,55 @@  discard block
 block discarded – undo
255 255
                 }
256 256
                 unset($previousEqualRule);
257 257
 
258
-                $equalRule = reset($operandsByOperator[ EqualRule::operator ]);
258
+                $equalRule = reset($operandsByOperator[EqualRule::operator]);
259 259
 
260
-                if (   ! empty($operandsByOperator[ BelowRule::operator ])
260
+                if (!empty($operandsByOperator[BelowRule::operator])
261 261
                     && null === $equalRule->getValue()
262 262
                 ) {
263 263
                     $this->operands = [];
264 264
                     return $this;
265 265
                 }
266 266
 
267
-                if (   ! empty($operandsByOperator[ BelowRule::operator ])
268
-                    && $equalRule->getValue() >= reset($operandsByOperator[ BelowRule::operator ])->getUpperLimit()
267
+                if (!empty($operandsByOperator[BelowRule::operator])
268
+                    && $equalRule->getValue() >= reset($operandsByOperator[BelowRule::operator])->getUpperLimit()
269 269
                 ) {
270 270
                     $this->operands = [];
271 271
                     return $this;
272 272
                 }
273 273
 
274
-                if (   ! empty($operandsByOperator[ AboveRule::operator ])
274
+                if (!empty($operandsByOperator[AboveRule::operator])
275 275
                     && null === $equalRule->getValue()
276 276
                 ) {
277 277
                     $this->operands = [];
278 278
                     return $this;
279 279
                 }
280 280
 
281
-                if (   ! empty($operandsByOperator[ AboveRule::operator ])
282
-                    && $equalRule->getValue() <= reset($operandsByOperator[ AboveRule::operator ])->getLowerLimit()
281
+                if (!empty($operandsByOperator[AboveRule::operator])
282
+                    && $equalRule->getValue() <= reset($operandsByOperator[AboveRule::operator])->getLowerLimit()
283 283
                 ) {
284 284
                     $this->operands = [];
285 285
                     return $this;
286 286
                 }
287 287
 
288
-                if (   ! empty($operandsByOperator[ NotEqualRule::operator ])
289
-                    && $equalRule->getValue() == reset($operandsByOperator[ NotEqualRule::operator ])->getValue()
288
+                if (!empty($operandsByOperator[NotEqualRule::operator])
289
+                    && $equalRule->getValue() == reset($operandsByOperator[NotEqualRule::operator])->getValue()
290 290
                 ) {
291 291
                     $this->operands = [];
292 292
                     return $this;
293 293
                 }
294 294
 
295
-                if (   ! empty($operandsByOperator[ NotEqualRule::operator ])
295
+                if (!empty($operandsByOperator[NotEqualRule::operator])
296 296
                     && null === $equalRule->getValue()
297
-                    && null === reset($operandsByOperator[ NotEqualRule::operator ])->getValue()
297
+                    && null === reset($operandsByOperator[NotEqualRule::operator])->getValue()
298 298
                 ) {
299 299
                     $this->operands = [];
300 300
                     return $this;
301 301
                 }
302 302
             }
303
-            elseif (   ! empty($operandsByOperator[ BelowRule::operator ])
304
-                    && ! empty($operandsByOperator[ AboveRule::operator ])) {
305
-                $aboveRule = reset($operandsByOperator[ AboveRule::operator ]);
306
-                $belowRule = reset($operandsByOperator[ BelowRule::operator ]);
303
+            elseif (!empty($operandsByOperator[BelowRule::operator])
304
+                    && !empty($operandsByOperator[AboveRule::operator])) {
305
+                $aboveRule = reset($operandsByOperator[AboveRule::operator]);
306
+                $belowRule = reset($operandsByOperator[BelowRule::operator]);
307 307
 
308 308
                 if ($belowRule->getUpperLimit() <= $aboveRule->getLowerLimit()) {
309 309
                     $this->operands = [];
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
      *
324 324
      * @return bool If the AndRule can have a solution or not
325 325
      */
326
-    public function hasSolution(array $contextual_options=[])
326
+    public function hasSolution(array $contextual_options = [])
327 327
     {
328
-        if ( ! $this->simplicationStepReached(self::simplified)) {
328
+        if (!$this->simplicationStepReached(self::simplified)) {
329 329
             throw new \LogicException(
330 330
                 "hasSolution has no sens if the rule is not simplified instead of being at: "
331 331
                 .var_export($this->current_simplification_step, true)
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 
335 335
         // atomic rules
336 336
         foreach ($this->getOperands() as $operand) {
337
-            if (method_exists($operand, 'hasSolution') && ! $operand->hasSolution()) {
337
+            if (method_exists($operand, 'hasSolution') && !$operand->hasSolution()) {
338 338
                 return false;
339 339
             }
340 340
         }
341 341
 
342
-        return ! empty($this->getOperands());
342
+        return !empty($this->getOperands());
343 343
     }
344 344
 
345 345
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
                 try {
358 358
                     if (AboveRule::operator == $operator) {
359
-                        usort($operands, function( AboveRule $a, AboveRule $b ) {
359
+                        usort($operands, function(AboveRule $a, AboveRule $b) {
360 360
                             if (null === $a->getLowerLimit()) {
361 361
                                 return 1;
362 362
                             }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                         $operands = [reset($operands)];
375 375
                     }
376 376
                     elseif (BelowRule::operator == $operator) {
377
-                        usort($operands, function( BelowRule $a, BelowRule $b ) {
377
+                        usort($operands, function(BelowRule $a, BelowRule $b) {
378 378
                             if (null === $a->getUpperLimit()) {
379 379
                                 return 1;
380 380
                             }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                     elseif (EqualRule::operator == $operator) {
395 395
                         // TODO add an option for the support strict comparison
396 396
                         foreach ($operands as $i => $operand) {
397
-                            if ( ! isset($previous_operand)) {
397
+                            if (!isset($previous_operand)) {
398 398
                                 $previous_operand = $operand;
399 399
                                 continue;
400 400
                             }
@@ -420,16 +420,16 @@  discard block
 block discarded – undo
420 420
                                 continue;
421 421
                             }
422 422
 
423
-                            $first_in->setPossibilities( array_intersect(
423
+                            $first_in->setPossibilities(array_intersect(
424 424
                                 $first_in->getPossibilities(),
425 425
                                 $next_in->getPossibilities()
426
-                            ) );
426
+                            ));
427 427
 
428 428
                             unset($operands[$i]);
429 429
                         }
430 430
 
431 431
                         // [field in []] <=> false
432
-                        if ( ! $first_in->getPossibilities()) {
432
+                        if (!$first_in->getPossibilities()) {
433 433
                             return [];
434 434
                         }
435 435
                     }
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
                                 continue;
442 442
                             }
443 443
 
444
-                            $first_not_in->setPossibilities( array_merge(
444
+                            $first_not_in->setPossibilities(array_merge(
445 445
                                 $first_not_in->getPossibilities(),
446 446
                                 $next_not_in->getPossibilities()
447
-                            ) );
447
+                            ));
448 448
 
449 449
                             unset($operands[$i]);
450 450
                         }
451 451
                     }
452 452
                 }
453 453
                 catch (\Exception $e) {
454
-                    VisibilityViolator::setHiddenProperty($e, 'message', $e->getMessage() . "\n" . var_export([
454
+                    VisibilityViolator::setHiddenProperty($e, 'message', $e->getMessage()."\n".var_export([
455 455
                             'operands' => $operands,
456 456
                             // 'this'     => $this,
457 457
                         ], true)
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                     throw $e;
462 462
                 }
463 463
 
464
-                $operandsByFields[ $field ][ $operator ] = $operands;
464
+                $operandsByFields[$field][$operator] = $operands;
465 465
             }
466 466
         }
467 467
 
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
                 ]
485 485
                 as $unifyable_operator
486 486
             ) {
487
-                if ( ! empty($operandsByOperator[ $unifyable_operator ])) {
488
-                    if (1 != count($operandsByOperator[ $unifyable_operator ])) {
487
+                if (!empty($operandsByOperator[$unifyable_operator])) {
488
+                    if (1 != count($operandsByOperator[$unifyable_operator])) {
489 489
                         throw new \LogicException(
490
-                            __METHOD__ . " MUST be called after unifyAtomicOperands() "
490
+                            __METHOD__." MUST be called after unifyAtomicOperands() "
491 491
                             ."to have only one '$unifyable_operator' predicate istead of:\n"
492
-                            ."[\n".implode( ",\n", array_map(function ($rule) {
492
+                            ."[\n".implode(",\n", array_map(function($rule) {
493 493
                                 return $rule->toString();
494
-                            }, $operandsByOperator[ $unifyable_operator ])
494
+                            }, $operandsByOperator[$unifyable_operator])
495 495
                             )."\n]"
496 496
                         );
497 497
                     }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             // If tyhere is no more operands for a given field it means there
503 503
             // is no possible solutions for it so all the current and_case
504 504
             // is invalidated.
505
-            if ( ! $operandsByOperator) {
505
+            if (!$operandsByOperator) {
506 506
                 return [];
507 507
             }
508 508
         }
@@ -517,73 +517,73 @@  discard block
 block discarded – undo
517 517
     protected static function simplifyDifferentOperandsForField($field, array $operandsByOperator)
518 518
     {
519 519
         // EqualRule comparisons
520
-        if ( ! empty($operandsByOperator[ EqualRule::operator ])) {
521
-            $equalRule = reset( $operandsByOperator[ EqualRule::operator ] );
520
+        if (!empty($operandsByOperator[EqualRule::operator])) {
521
+            $equalRule = reset($operandsByOperator[EqualRule::operator]);
522 522
 
523
-            if ( ! empty($operandsByOperator[ NotEqualRule::operator ])) {
524
-                foreach ($operandsByOperator[ NotEqualRule::operator ] as $i => $not_equal_rule) {
523
+            if (!empty($operandsByOperator[NotEqualRule::operator])) {
524
+                foreach ($operandsByOperator[NotEqualRule::operator] as $i => $not_equal_rule) {
525 525
                     if (null !== $equalRule->getValue()) {
526 526
                         if (null === $not_equal_rule->getValue()) { // means if exists <=> equals something
527
-                            unset($operandsByOperator[ NotEqualRule::operator ][$i]);
527
+                            unset($operandsByOperator[NotEqualRule::operator][$i]);
528 528
                         }
529 529
                         elseif ($not_equal_rule->getValue() != $equalRule->getValue()) {
530
-                            unset($operandsByOperator[ NotEqualRule::operator ][$i]);
530
+                            unset($operandsByOperator[NotEqualRule::operator][$i]);
531 531
                         }
532 532
                     }
533
-                    elseif (null === $equalRule->getValue() ) {
533
+                    elseif (null === $equalRule->getValue()) {
534 534
                         if (null !== $not_equal_rule->getValue()) {
535
-                            unset($operandsByOperator[ NotEqualRule::operator ][$i]);
535
+                            unset($operandsByOperator[NotEqualRule::operator][$i]);
536 536
                         }
537 537
                         // else we let the "equal null" and the "not equal null" for the romeInvalidBranches step
538 538
                     }
539 539
                 }
540 540
             }
541 541
 
542
-            if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
543
-                $aboveRule = reset($operandsByOperator[ AboveRule::operator ]);
542
+            if (!empty($operandsByOperator[AboveRule::operator])) {
543
+                $aboveRule = reset($operandsByOperator[AboveRule::operator]);
544 544
                 if (null !== $equalRule->getValue() && $aboveRule->getLowerLimit() < $equalRule->getValue()) {
545
-                    unset($operandsByOperator[ AboveRule::operator ]);
545
+                    unset($operandsByOperator[AboveRule::operator]);
546 546
                 }
547 547
             }
548 548
 
549
-            if ( ! empty($operandsByOperator[ BelowRule::operator ])) {
550
-                $belowRule = reset($operandsByOperator[ BelowRule::operator ]);
549
+            if (!empty($operandsByOperator[BelowRule::operator])) {
550
+                $belowRule = reset($operandsByOperator[BelowRule::operator]);
551 551
                 if (null !== $equalRule->getValue() && $belowRule->getUpperLimit() > $equalRule->getValue()) {
552
-                    unset($operandsByOperator[ BelowRule::operator ]);
552
+                    unset($operandsByOperator[BelowRule::operator]);
553 553
                 }
554 554
             }
555 555
 
556
-            if ( ! empty($operandsByOperator[ InRule::operator ])) {
557
-                $possibilities = reset($operandsByOperator[ InRule::operator ])->getPossibilities();
556
+            if (!empty($operandsByOperator[InRule::operator])) {
557
+                $possibilities = reset($operandsByOperator[InRule::operator])->getPossibilities();
558 558
 
559 559
                 if (in_array($equalRule->getValue(), $possibilities)) {
560
-                    unset($operandsByOperator[ InRule::operator ]);
560
+                    unset($operandsByOperator[InRule::operator]);
561 561
                 }
562 562
                 else {
563 563
                     // We flush possibilities of the InRule
564 564
                     // TODO Replace it by a FalseRule
565
-                    $operandsByOperator[ InRule::operator ][0]->setPossibilities([]);
565
+                    $operandsByOperator[InRule::operator][0]->setPossibilities([]);
566 566
                     // and also remove the equal rule to shorten the reste of the simplification process
567
-                    unset($operandsByOperator[ EqualRule::operator ]);
567
+                    unset($operandsByOperator[EqualRule::operator]);
568 568
                 }
569 569
             }
570 570
 
571
-            if ( ! empty($operandsByOperator[ NotInRule::operator ])) {
572
-                $notInRule = reset($operandsByOperator[ NotInRule::operator ]);
571
+            if (!empty($operandsByOperator[NotInRule::operator])) {
572
+                $notInRule = reset($operandsByOperator[NotInRule::operator]);
573 573
                 if (in_array($equalRule->getValue(), $notInRule->getPossibilities())) {
574 574
                     // ['field', '=', 4] && ['field', '!in', [4]...] <=> false
575 575
                     return [];
576 576
                 }
577 577
                 else {
578
-                    unset($operandsByOperator[ NotInRule::operator ]);
578
+                    unset($operandsByOperator[NotInRule::operator]);
579 579
                 }
580 580
                 // $notInRule->dump(true);
581 581
             }
582 582
 
583
-            if ( ! empty($operandsByOperator[ BelowOrEqualRule::operator ])) {
584
-                $belowOrEqualRule = reset($operandsByOperator[ BelowOrEqualRule::operator ]);
583
+            if (!empty($operandsByOperator[BelowOrEqualRule::operator])) {
584
+                $belowOrEqualRule = reset($operandsByOperator[BelowOrEqualRule::operator]);
585 585
                 if ($equalRule->getValue() <= $belowOrEqualRule->getMaximum()) {
586
-                    unset($operandsByOperator[ BelowOrEqualRule::operator ]);
586
+                    unset($operandsByOperator[BelowOrEqualRule::operator]);
587 587
                 }
588 588
                 else {
589 589
                     // ['field', '=', 4] && ['field', '<=', [3]...] <=> false
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
                 }
592 592
             }
593 593
 
594
-            if ( ! empty($operandsByOperator[ AboveOrEqualRule::operator ])) {
595
-                $aboveOrEqualRule = reset($operandsByOperator[ AboveOrEqualRule::operator ]);
594
+            if (!empty($operandsByOperator[AboveOrEqualRule::operator])) {
595
+                $aboveOrEqualRule = reset($operandsByOperator[AboveOrEqualRule::operator]);
596 596
                 if ($equalRule->getValue() >= $aboveOrEqualRule->getMinimum()) {
597
-                    unset($operandsByOperator[ AboveOrEqualRule::operator ]);
597
+                    unset($operandsByOperator[AboveOrEqualRule::operator]);
598 598
                 }
599 599
                 else {
600 600
                     // ['field', '=', 4] && ['field', '<=', [3]...] <=> false
@@ -604,54 +604,54 @@  discard block
 block discarded – undo
604 604
         }
605 605
 
606 606
         // NotEqualRule null comparisons
607
-        if ( ! empty($operandsByOperator[ NotEqualRule::operator ])) {
608
-            if ( ! empty($operandsByOperator[ NotEqualRule::operator ])) {
609
-                foreach ($operandsByOperator[ NotEqualRule::operator ] as $i => $notEqualRule) {
607
+        if (!empty($operandsByOperator[NotEqualRule::operator])) {
608
+            if (!empty($operandsByOperator[NotEqualRule::operator])) {
609
+                foreach ($operandsByOperator[NotEqualRule::operator] as $i => $notEqualRule) {
610 610
                     if (null === $notEqualRule->getValue()) {
611
-                        if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
612
-                            unset($operandsByOperator[ NotEqualRule::operator ][$i]);
611
+                        if (!empty($operandsByOperator[AboveRule::operator])) {
612
+                            unset($operandsByOperator[NotEqualRule::operator][$i]);
613 613
                         }
614 614
 
615
-                        if ( ! empty($operandsByOperator[ BelowRule::operator ])) {
616
-                            unset($operandsByOperator[ NotEqualRule::operator ][$i]);
615
+                        if (!empty($operandsByOperator[BelowRule::operator])) {
616
+                            unset($operandsByOperator[NotEqualRule::operator][$i]);
617 617
                         }
618 618
 
619
-                        if ( ! empty($operandsByOperator[ EqualRule::operator ])) {
620
-                            if (null !== reset($operandsByOperator[ EqualRule::operator ])->getValue()) {
621
-                                unset($operandsByOperator[ NotEqualRule::operator ][$i]);
619
+                        if (!empty($operandsByOperator[EqualRule::operator])) {
620
+                            if (null !== reset($operandsByOperator[EqualRule::operator])->getValue()) {
621
+                                unset($operandsByOperator[NotEqualRule::operator][$i]);
622 622
                             }
623 623
                         }
624 624
                     }
625 625
                     else {
626
-                        if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
627
-                            if ($operandsByOperator[ AboveRule::operator ][0]->getLowerLimit() >= $notEqualRule->getValue()) {
628
-                                unset($operandsByOperator[ NotEqualRule::operator ][$i]);
626
+                        if (!empty($operandsByOperator[AboveRule::operator])) {
627
+                            if ($operandsByOperator[AboveRule::operator][0]->getLowerLimit() >= $notEqualRule->getValue()) {
628
+                                unset($operandsByOperator[NotEqualRule::operator][$i]);
629 629
                             }
630 630
                         }
631 631
 
632
-                        if ( ! empty($operandsByOperator[ BelowRule::operator ])) {
633
-                            if ($operandsByOperator[ BelowRule::operator ][0]->getUpperLimit() <= $notEqualRule->getValue()) {
634
-                                unset($operandsByOperator[ NotEqualRule::operator ][$i]);
632
+                        if (!empty($operandsByOperator[BelowRule::operator])) {
633
+                            if ($operandsByOperator[BelowRule::operator][0]->getUpperLimit() <= $notEqualRule->getValue()) {
634
+                                unset($operandsByOperator[NotEqualRule::operator][$i]);
635 635
                             }
636 636
                         }
637 637
                     }
638 638
 
639
-                    if ( ! empty($operandsByOperator[ NotInRule::operator ])) {
640
-                        $notInRule = reset($operandsByOperator[ NotInRule::operator ]);
641
-                        if ( ! in_array($notEqualRule->getValue(), $notInRule->getPossibilities())) {
639
+                    if (!empty($operandsByOperator[NotInRule::operator])) {
640
+                        $notInRule = reset($operandsByOperator[NotInRule::operator]);
641
+                        if (!in_array($notEqualRule->getValue(), $notInRule->getPossibilities())) {
642 642
                             // TODO Replace it by a FalseRule
643
-                            $operandsByOperator[ NotInRule::operator ][0]->setPossibilities(
643
+                            $operandsByOperator[NotInRule::operator][0]->setPossibilities(
644 644
                                 array_merge($notInRule->getPossibilities(), [$notEqualRule->getValue()])
645 645
                             );
646 646
                         }
647 647
 
648
-                        unset($operandsByOperator[ NotEqualRule::operator ][$i]);
648
+                        unset($operandsByOperator[NotEqualRule::operator][$i]);
649 649
                     }
650 650
 
651
-                    if ( ! empty($operandsByOperator[ InRule::operator ])) {
652
-                        $inRule = reset($operandsByOperator[ InRule::operator ]);
651
+                    if (!empty($operandsByOperator[InRule::operator])) {
652
+                        $inRule = reset($operandsByOperator[InRule::operator]);
653 653
 
654
-                        $operandsByOperator[ InRule::operator ][0]->setPossibilities(
654
+                        $operandsByOperator[InRule::operator][0]->setPossibilities(
655 655
                             array_diff($inRule->getPossibilities(), [$notEqualRule->getValue()])
656 656
                         );
657 657
                     }
@@ -661,61 +661,61 @@  discard block
 block discarded – undo
661 661
 
662 662
         // Comparison between InRules and NotInRules
663 663
         // This is an optimization to avoid NotIn explosion
664
-        if ( ! empty($operandsByOperator[ InRule::operator ])) {
665
-            $inRule = $operandsByOperator[ InRule::operator ][0];
664
+        if (!empty($operandsByOperator[InRule::operator])) {
665
+            $inRule = $operandsByOperator[InRule::operator][0];
666 666
 
667
-            if ( ! empty($operandsByOperator[ NotInRule::operator ])) {
668
-                $notInRule = reset($operandsByOperator[ NotInRule::operator ]);
669
-                $operandsByOperator[ InRule::operator ][0]->setPossibilities(
670
-                    array_diff( $inRule->getPossibilities(), $notInRule->getPossibilities())
667
+            if (!empty($operandsByOperator[NotInRule::operator])) {
668
+                $notInRule = reset($operandsByOperator[NotInRule::operator]);
669
+                $operandsByOperator[InRule::operator][0]->setPossibilities(
670
+                    array_diff($inRule->getPossibilities(), $notInRule->getPossibilities())
671 671
                 );
672
-                unset($operandsByOperator[ NotInRule::operator ]);
672
+                unset($operandsByOperator[NotInRule::operator]);
673 673
             }
674 674
 
675
-            if ( ! empty($operandsByOperator[ BelowRule::operator ])) {
676
-                $upper_limit = reset($operandsByOperator[ BelowRule::operator ])->getUpperLimit();
675
+            if (!empty($operandsByOperator[BelowRule::operator])) {
676
+                $upper_limit = reset($operandsByOperator[BelowRule::operator])->getUpperLimit();
677 677
 
678
-                $operandsByOperator[ InRule::operator ][0]->setPossibilities(
679
-                    array_filter( $inRule->getPossibilities(), function ($possibility) use ($upper_limit) {
678
+                $operandsByOperator[InRule::operator][0]->setPossibilities(
679
+                    array_filter($inRule->getPossibilities(), function($possibility) use ($upper_limit) {
680 680
                         return $possibility < $upper_limit;
681 681
                     } )
682 682
                 );
683 683
 
684
-                unset($operandsByOperator[ BelowRule::operator ]);
684
+                unset($operandsByOperator[BelowRule::operator]);
685 685
             }
686 686
 
687
-            if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
688
-                $lower_limit = reset($operandsByOperator[ AboveRule::operator ])->getLowerLimit();
687
+            if (!empty($operandsByOperator[AboveRule::operator])) {
688
+                $lower_limit = reset($operandsByOperator[AboveRule::operator])->getLowerLimit();
689 689
 
690
-                $operandsByOperator[ InRule::operator ][0]->setPossibilities(
691
-                    array_filter( $inRule->getPossibilities(), function ($possibility) use ($lower_limit) {
690
+                $operandsByOperator[InRule::operator][0]->setPossibilities(
691
+                    array_filter($inRule->getPossibilities(), function($possibility) use ($lower_limit) {
692 692
                         return $possibility > $lower_limit;
693 693
                     } )
694 694
                 );
695 695
 
696
-                unset($operandsByOperator[ AboveRule::operator ]);
696
+                unset($operandsByOperator[AboveRule::operator]);
697 697
             }
698 698
         }
699 699
 
700 700
         // Comparison between NotInRules and > or <
701
-        if ( ! empty($operandsByOperator[ NotInRule::operator ])) {
702
-            $notInRule = $operandsByOperator[ NotInRule::operator ][0];
701
+        if (!empty($operandsByOperator[NotInRule::operator])) {
702
+            $notInRule = $operandsByOperator[NotInRule::operator][0];
703 703
 
704
-            if ( ! empty($operandsByOperator[ BelowRule::operator ])) {
705
-                $upper_limit = reset($operandsByOperator[ BelowRule::operator ])->getUpperLimit();
704
+            if (!empty($operandsByOperator[BelowRule::operator])) {
705
+                $upper_limit = reset($operandsByOperator[BelowRule::operator])->getUpperLimit();
706 706
 
707
-                $operandsByOperator[ NotInRule::operator ][0]->setPossibilities(
708
-                    array_filter( $notInRule->getPossibilities(), function ($possibility) use ($upper_limit) {
707
+                $operandsByOperator[NotInRule::operator][0]->setPossibilities(
708
+                    array_filter($notInRule->getPossibilities(), function($possibility) use ($upper_limit) {
709 709
                         return $possibility < $upper_limit;
710 710
                     } )
711 711
                 );
712 712
             }
713 713
 
714
-            if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
715
-                $lower_limit = reset($operandsByOperator[ AboveRule::operator ])->getLowerLimit();
714
+            if (!empty($operandsByOperator[AboveRule::operator])) {
715
+                $lower_limit = reset($operandsByOperator[AboveRule::operator])->getLowerLimit();
716 716
 
717
-                $operandsByOperator[ NotInRule::operator ][0]->setPossibilities(
718
-                    array_filter( $notInRule->getPossibilities(), function ($possibility) use ($lower_limit) {
717
+                $operandsByOperator[NotInRule::operator][0]->setPossibilities(
718
+                    array_filter($notInRule->getPossibilities(), function($possibility) use ($lower_limit) {
719 719
                         return $possibility > $lower_limit;
720 720
                     } )
721 721
                 );
@@ -723,25 +723,25 @@  discard block
 block discarded – undo
723 723
         }
724 724
 
725 725
         // Comparison between <= and > or <
726
-        if ( ! empty($operandsByOperator[ BelowOrEqualRule::operator ])) {
727
-            $belowOrEqualRule = $operandsByOperator[ BelowOrEqualRule::operator ][0];
726
+        if (!empty($operandsByOperator[BelowOrEqualRule::operator])) {
727
+            $belowOrEqualRule = $operandsByOperator[BelowOrEqualRule::operator][0];
728 728
 
729
-            if ( ! empty($operandsByOperator[ BelowRule::operator ])) {
730
-                $upper_limit = reset($operandsByOperator[ BelowRule::operator ])->getUpperLimit();
729
+            if (!empty($operandsByOperator[BelowRule::operator])) {
730
+                $upper_limit = reset($operandsByOperator[BelowRule::operator])->getUpperLimit();
731 731
 
732 732
                 if ($belowOrEqualRule->getMaximum() >= $upper_limit) {
733 733
                     // [field < 3] && [field <= 3]
734 734
                     // [field < 3] && [field <= 4]
735
-                    unset($operandsByOperator[ BelowOrEqualRule::operator ][0]);
735
+                    unset($operandsByOperator[BelowOrEqualRule::operator][0]);
736 736
                 }
737 737
                 else {
738 738
                     // [field < 3] && [field <= 2]
739
-                    unset($operandsByOperator[ BelowRule::operator ][0]);
739
+                    unset($operandsByOperator[BelowRule::operator][0]);
740 740
                 }
741 741
             }
742 742
 
743
-            if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
744
-                $lower_limit = reset($operandsByOperator[ AboveRule::operator ])->getLowerLimit();
743
+            if (!empty($operandsByOperator[AboveRule::operator])) {
744
+                $lower_limit = reset($operandsByOperator[AboveRule::operator])->getLowerLimit();
745 745
 
746 746
                 if ($belowOrEqualRule->getMaximum() <= $lower_limit) {
747 747
                     // [field > 3] && [field <= 2] <=> false
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
                 }
750 750
             }
751 751
 
752
-            if ( ! empty($operandsByOperator[ AboveOrEqualRule::operator ])) {
753
-                $minimum = reset($operandsByOperator[ AboveOrEqualRule::operator ])->getMinimum();
752
+            if (!empty($operandsByOperator[AboveOrEqualRule::operator])) {
753
+                $minimum = reset($operandsByOperator[AboveOrEqualRule::operator])->getMinimum();
754 754
 
755 755
                 if ($belowOrEqualRule->getMaximum() < $minimum) {
756 756
                     // [field <= 3] && [field >= 4] <=> false
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
                 }
759 759
                 elseif ($belowOrEqualRule->getMaximum() == $minimum) {
760 760
                     // [field <= 3] && [field >= 3] <=> [field = 3]
761
-                    unset($operandsByOperator[ BelowOrEqualRule::operator ]);
762
-                    unset($operandsByOperator[ AboveOrEqualRule::operator ]);
763
-                    $operandsByOperator[ EqualRule::operator ][] = new EqualRule($field, $minimum);
761
+                    unset($operandsByOperator[BelowOrEqualRule::operator]);
762
+                    unset($operandsByOperator[AboveOrEqualRule::operator]);
763
+                    $operandsByOperator[EqualRule::operator][] = new EqualRule($field, $minimum);
764 764
 
765
-                    if (count($operandsByOperator[ EqualRule::operator ]) > 1) {
765
+                    if (count($operandsByOperator[EqualRule::operator]) > 1) {
766 766
                         $operandsByOperator = self::simplifyDifferentOperandsForField($field, $operandsByOperator);
767 767
                     }
768 768
                 }
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
     public function setOperandsOrReplaceByOperation($new_operands)
782 782
     {
783 783
         try {
784
-            return $this->setOperands( $new_operands );
784
+            return $this->setOperands($new_operands);
785 785
         }
786 786
         catch (\LogicException $e) {
787
-            return new AndRule( $new_operands );
787
+            return new AndRule($new_operands);
788 788
         }
789 789
     }
790 790
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -44 removed lines patch added patch discarded remove patch
@@ -62,15 +62,13 @@  discard block
 block discarded – undo
62 62
                     foreach ($upLiftedOr->getOperands() as $upLifdtedOperand) {
63 63
                         $upLifdtedOperand->addOperand( $operand->copy() );
64 64
                     }
65
-                }
66
-                else {
65
+                } else {
67 66
                     throw new \LogicException(
68 67
                         "Rootifying disjunctions MUST be done after negations removal instead of '".$operand."' \n"
69 68
                         .$operand
70 69
                     );
71 70
                 }
72
-            }
73
-            elseif ($operand instanceof OrRule && $operand->isNormalizationAllowed($simplification_options)) {
71
+            } elseif ($operand instanceof OrRule && $operand->isNormalizationAllowed($simplification_options)) {
74 72
 
75 73
                 // If an operand is an Or, me transform the current
76 74
                 // (A' || A") && (B')       <=> (A' && B') || (A" && B');
@@ -90,8 +88,7 @@  discard block
 block discarded – undo
90 88
                 }
91 89
 
92 90
                 $upLiftedOr = $newUpLiftedOr;
93
-            }
94
-            else {
91
+            } else {
95 92
                 // append the operand to all the operands of the $upLiftedOr
96 93
                 foreach ($upLiftedOr->getOperands() as $upLifdtedOperand) {
97 94
                     if ( ! $upLifdtedOperand instanceof AndRule) {
@@ -147,16 +144,14 @@  discard block
 block discarded – undo
147 144
                 [self::operator],
148 145
                 $operands_semantic_ids
149 146
             );
150
-        }
151
-        else {
147
+        } else {
152 148
             foreach ($operands as $operand) {
153 149
                 $operands_as_array[] = $operand->toArray($options);
154 150
             }
155 151
 
156 152
             if ( ! $options['show_instance']) {
157 153
                 return $this->cache['array'] = $operands_as_array;
158
-            }
159
-            else {
154
+            } else {
160 155
                 return $operands_as_array;
161 156
             }
162 157
         }
@@ -299,8 +294,7 @@  discard block
 block discarded – undo
299 294
                     $this->operands = [];
300 295
                     return $this;
301 296
                 }
302
-            }
303
-            elseif (   ! empty($operandsByOperator[ BelowRule::operator ])
297
+            } elseif (   ! empty($operandsByOperator[ BelowRule::operator ])
304 298
                     && ! empty($operandsByOperator[ AboveRule::operator ])) {
305 299
                 $aboveRule = reset($operandsByOperator[ AboveRule::operator ]);
306 300
                 $belowRule = reset($operandsByOperator[ BelowRule::operator ]);
@@ -372,8 +366,7 @@  discard block
 block discarded – undo
372 366
                             return 1;
373 367
                         });
374 368
                         $operands = [reset($operands)];
375
-                    }
376
-                    elseif (BelowRule::operator == $operator) {
369
+                    } elseif (BelowRule::operator == $operator) {
377 370
                         usort($operands, function( BelowRule $a, BelowRule $b ) {
378 371
                             if (null === $a->getUpperLimit()) {
379 372
                                 return 1;
@@ -390,8 +383,7 @@  discard block
 block discarded – undo
390 383
                             return 1;
391 384
                         });
392 385
                         $operands = [reset($operands)];
393
-                    }
394
-                    elseif (EqualRule::operator == $operator) {
386
+                    } elseif (EqualRule::operator == $operator) {
395 387
                         // TODO add an option for the support strict comparison
396 388
                         foreach ($operands as $i => $operand) {
397 389
                             if ( ! isset($previous_operand)) {
@@ -402,8 +394,7 @@  discard block
 block discarded – undo
402 394
                             if ($previous_operand == $operand) {
403 395
                                 unset($operands[$i]);
404 396
                                 continue;
405
-                            }
406
-                            else {
397
+                            } else {
407 398
                                 // Same field expected to be two differents
408 399
                                 // values at the same time has no sens so
409 400
                                 // we remove all the operands of the current
@@ -411,8 +402,7 @@  discard block
 block discarded – undo
411 402
                                 return [];
412 403
                             }
413 404
                         }
414
-                    }
415
-                    elseif (InRule::operator == $operator) {
405
+                    } elseif (InRule::operator == $operator) {
416 406
                         $first_in = reset($operands);
417 407
 
418 408
                         foreach ($operands as $i => $next_in) {
@@ -432,8 +422,7 @@  discard block
 block discarded – undo
432 422
                         if ( ! $first_in->getPossibilities()) {
433 423
                             return [];
434 424
                         }
435
-                    }
436
-                    elseif (NotInRule::operator == $operator) {
425
+                    } elseif (NotInRule::operator == $operator) {
437 426
                         $first_not_in = reset($operands);
438 427
 
439 428
                         foreach ($operands as $i => $next_not_in) {
@@ -449,8 +438,7 @@  discard block
 block discarded – undo
449 438
                             unset($operands[$i]);
450 439
                         }
451 440
                     }
452
-                }
453
-                catch (\Exception $e) {
441
+                } catch (\Exception $e) {
454 442
                     VisibilityViolator::setHiddenProperty($e, 'message', $e->getMessage() . "\n" . var_export([
455 443
                             'operands' => $operands,
456 444
                             // 'this'     => $this,
@@ -525,12 +513,10 @@  discard block
 block discarded – undo
525 513
                     if (null !== $equalRule->getValue()) {
526 514
                         if (null === $not_equal_rule->getValue()) { // means if exists <=> equals something
527 515
                             unset($operandsByOperator[ NotEqualRule::operator ][$i]);
528
-                        }
529
-                        elseif ($not_equal_rule->getValue() != $equalRule->getValue()) {
516
+                        } elseif ($not_equal_rule->getValue() != $equalRule->getValue()) {
530 517
                             unset($operandsByOperator[ NotEqualRule::operator ][$i]);
531 518
                         }
532
-                    }
533
-                    elseif (null === $equalRule->getValue() ) {
519
+                    } elseif (null === $equalRule->getValue() ) {
534 520
                         if (null !== $not_equal_rule->getValue()) {
535 521
                             unset($operandsByOperator[ NotEqualRule::operator ][$i]);
536 522
                         }
@@ -558,8 +544,7 @@  discard block
 block discarded – undo
558 544
 
559 545
                 if (in_array($equalRule->getValue(), $possibilities)) {
560 546
                     unset($operandsByOperator[ InRule::operator ]);
561
-                }
562
-                else {
547
+                } else {
563 548
                     // We flush possibilities of the InRule
564 549
                     // TODO Replace it by a FalseRule
565 550
                     $operandsByOperator[ InRule::operator ][0]->setPossibilities([]);
@@ -573,8 +558,7 @@  discard block
 block discarded – undo
573 558
                 if (in_array($equalRule->getValue(), $notInRule->getPossibilities())) {
574 559
                     // ['field', '=', 4] && ['field', '!in', [4]...] <=> false
575 560
                     return [];
576
-                }
577
-                else {
561
+                } else {
578 562
                     unset($operandsByOperator[ NotInRule::operator ]);
579 563
                 }
580 564
                 // $notInRule->dump(true);
@@ -584,8 +568,7 @@  discard block
 block discarded – undo
584 568
                 $belowOrEqualRule = reset($operandsByOperator[ BelowOrEqualRule::operator ]);
585 569
                 if ($equalRule->getValue() <= $belowOrEqualRule->getMaximum()) {
586 570
                     unset($operandsByOperator[ BelowOrEqualRule::operator ]);
587
-                }
588
-                else {
571
+                } else {
589 572
                     // ['field', '=', 4] && ['field', '<=', [3]...] <=> false
590 573
                     return [];
591 574
                 }
@@ -595,8 +578,7 @@  discard block
 block discarded – undo
595 578
                 $aboveOrEqualRule = reset($operandsByOperator[ AboveOrEqualRule::operator ]);
596 579
                 if ($equalRule->getValue() >= $aboveOrEqualRule->getMinimum()) {
597 580
                     unset($operandsByOperator[ AboveOrEqualRule::operator ]);
598
-                }
599
-                else {
581
+                } else {
600 582
                     // ['field', '=', 4] && ['field', '<=', [3]...] <=> false
601 583
                     return [];
602 584
                 }
@@ -621,8 +603,7 @@  discard block
 block discarded – undo
621 603
                                 unset($operandsByOperator[ NotEqualRule::operator ][$i]);
622 604
                             }
623 605
                         }
624
-                    }
625
-                    else {
606
+                    } else {
626 607
                         if ( ! empty($operandsByOperator[ AboveRule::operator ])) {
627 608
                             if ($operandsByOperator[ AboveRule::operator ][0]->getLowerLimit() >= $notEqualRule->getValue()) {
628 609
                                 unset($operandsByOperator[ NotEqualRule::operator ][$i]);
@@ -733,8 +714,7 @@  discard block
 block discarded – undo
733 714
                     // [field < 3] && [field <= 3]
734 715
                     // [field < 3] && [field <= 4]
735 716
                     unset($operandsByOperator[ BelowOrEqualRule::operator ][0]);
736
-                }
737
-                else {
717
+                } else {
738 718
                     // [field < 3] && [field <= 2]
739 719
                     unset($operandsByOperator[ BelowRule::operator ][0]);
740 720
                 }
@@ -755,8 +735,7 @@  discard block
 block discarded – undo
755 735
                 if ($belowOrEqualRule->getMaximum() < $minimum) {
756 736
                     // [field <= 3] && [field >= 4] <=> false
757 737
                     return [];
758
-                }
759
-                elseif ($belowOrEqualRule->getMaximum() == $minimum) {
738
+                } elseif ($belowOrEqualRule->getMaximum() == $minimum) {
760 739
                     // [field <= 3] && [field >= 3] <=> [field = 3]
761 740
                     unset($operandsByOperator[ BelowOrEqualRule::operator ]);
762 741
                     unset($operandsByOperator[ AboveOrEqualRule::operator ]);
@@ -782,8 +761,7 @@  discard block
 block discarded – undo
782 761
     {
783 762
         try {
784 763
             return $this->setOperands( $new_operands );
785
-        }
786
-        catch (\LogicException $e) {
764
+        } catch (\LogicException $e) {
787 765
             return new AndRule( $new_operands );
788 766
         }
789 767
     }
Please login to merge, or discard this patch.