Skip to content

Commit

Permalink
reduce the complexity of SemVerVersion::compare
Browse files Browse the repository at this point in the history
  • Loading branch information
bendavies committed Feb 25, 2021
1 parent 4601b01 commit 1f0e9fb
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Git/Value/SemVerVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ public function lessThanEqual(self $other): bool

private function compare(self $other): int
{
$comparison = $this->major <=> $other->major;

if ($comparison !== 0) {
return $comparison;
}

$comparison = $this->minor <=> $other->minor;

return $comparison !== 0 ? $comparison : $this->patch <=> $other->patch;
return [$this->major, $this->minor, $this->patch] <=> [$other->major, $other->minor, $other->patch];
}
}

0 comments on commit 1f0e9fb

Please sign in to comment.