Skip to content

Commit 1f0e9fb

Browse files
committed
reduce the complexity of SemVerVersion::compare
1 parent 4601b01 commit 1f0e9fb

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/Git/Value/SemVerVersion.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ public function lessThanEqual(self $other): bool
9191

9292
private function compare(self $other): int
9393
{
94-
$comparison = $this->major <=> $other->major;
95-
96-
if ($comparison !== 0) {
97-
return $comparison;
98-
}
99-
100-
$comparison = $this->minor <=> $other->minor;
101-
102-
return $comparison !== 0 ? $comparison : $this->patch <=> $other->patch;
94+
return [$this->major, $this->minor, $this->patch] <=> [$other->major, $other->minor, $other->patch];
10395
}
10496
}

0 commit comments

Comments
 (0)