1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-03-28 06:50:08 +01:00

♻️ WIP: When comparing versions, checks are strict by default

This commit is contained in:
2025-08-27 11:32:23 +02:00
parent 4e7c8ac624
commit 616a717d02
2 changed files with 7 additions and 7 deletions

View File

@@ -92,7 +92,7 @@ public struct PhpVersionNumberCollection: Equatable {
// If a patch is provided then the minor version cannot be bumped.
? $0.hasSameMajorAndMinorButNewerOrSamePatch(version, strict)
// If a patch is not provided then the major version cannot be bumped.
: $0.hasSameMajorButNewerOrSameMinor(version, strict)
: $0.hasSameMajorButNewerOrSameMinor(version)
}
}

View File

@@ -93,7 +93,7 @@ public struct VersionNumber: Equatable, Hashable {
return self.major == version.major
}
internal func isSameAs(_ version: VersionNumber, _ strict: Bool) -> Bool {
internal func isSameAs(_ version: VersionNumber, _ strict: Bool = true) -> Bool {
return self.major == version.major
&& self.minor == version.minor
&& (strict ? self.patch(strict, version) == version.patch(strict) : true)
@@ -103,7 +103,7 @@ public struct VersionNumber: Equatable, Hashable {
return self.major == version.major && self.minor == version.minor
}
internal func isNewerThan(_ version: VersionNumber, _ strict: Bool) -> Bool {
internal func isNewerThan(_ version: VersionNumber, _ strict: Bool = true) -> Bool {
return (
self.major > version.major ||
self.major == version.major && self.minor > version.minor ||
@@ -112,7 +112,7 @@ public struct VersionNumber: Equatable, Hashable {
)
}
internal func isOlderThan(_ version: VersionNumber, _ strict: Bool) -> Bool {
internal func isOlderThan(_ version: VersionNumber, _ strict: Bool = true) -> Bool {
return (
self.major < version.major ||
self.major == version.major && self.minor < version.minor ||
@@ -121,7 +121,7 @@ public struct VersionNumber: Equatable, Hashable {
)
}
internal func hasNewerMinorVersionOrPatch(_ version: VersionNumber, _ strict: Bool) -> Bool {
internal func hasNewerMinorVersionOrPatch(_ version: VersionNumber, _ strict: Bool = true) -> Bool {
return self.major == version.major &&
(
(self.minor == version.minor && self.patch(strict) >= version.patch(strict, self))
@@ -129,12 +129,12 @@ public struct VersionNumber: Equatable, Hashable {
)
}
internal func hasSameMajorAndMinorButNewerOrSamePatch(_ version: VersionNumber, _ strict: Bool) -> Bool {
internal func hasSameMajorAndMinorButNewerOrSamePatch(_ version: VersionNumber, _ strict: Bool = true) -> Bool {
return self.major == version.major && self.minor == version.minor
&& self.patch(strict, version) >= version.patch(strict)
}
internal func hasSameMajorButNewerOrSameMinor(_ version: VersionNumber, _ strict: Bool) -> Bool {
internal func hasSameMajorButNewerOrSameMinor(_ version: VersionNumber) -> Bool {
return self.major == version.major
&& self.minor >= version.minor
}