Run Rector on your code to see what it can do for you:

 <?php
 
 final class Repro
 
       public ?string $transaction = null;
 
-      public function hasStale(): bool
-      {
-          return $this->donation === null
-              || ($this->commission > 0 && $this->transaction === null)
-              || $this->somethingElse()
-              || $this->anotherThing();
+      public function hasStale(): bool
+      {
+          if ($this->somethingElse()) {
+              return true;
+          }
+          return $this->anotherThing();
       }
 
       private function somethingElse(): bool
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 919fc0 - released at 2026-07-23 08:59