Skip to content

Commit b7ba747

Browse files
Don't duplicate update strategy class name in enum values
1 parent ee30c30 commit b7ba747

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

webapp/src/Service/DOMJudgeService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ public function cacherCheckNewVersion(ItemInterface $item): array|false {
17491749
* Returns either the next strictly higher version or false when nothing is found/requested.
17501750
*/
17511751
public function checkNewVersion(): string|false {
1752-
if ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_none) {
1752+
if ($this->config->get('check_new_version', false) === UpdateStrategy::NONE) {
17531753
return false;
17541754
}
17551755
// The local version is something like "x.y.z / commit hash", e.g. "8.4.0DEV/4e25adb13" for development
@@ -1775,7 +1775,7 @@ public function checkNewVersion(): string|false {
17751775

17761776
preg_match("/\d.\d.\d/", $this->domjudgeVersion, $matches);
17771777
$extractedLocalVersionString = $matches[0];
1778-
if ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_incremental) {
1778+
if ($this->config->get('check_new_version', false) === UpdateStrategy::INCREMENTAL) {
17791779
/* Steer towards the nearest highest patch release first
17801780
* So the expected path would be:
17811781
* DJ6.0.0 -> DJ6.0.6 -> DJ6.6.0 -> DJ9.1.2 instead of
@@ -1801,7 +1801,7 @@ public function checkNewVersion(): string|false {
18011801
}
18021802
}
18031803
}
1804-
} elseif ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_major_release) {
1804+
} elseif ($this->config->get('check_new_version', false) === UpdateStrategy::MAJOR_RELEASE) {
18051805
/* Steer towards the latest version directly
18061806
* So the expected path would be:
18071807
* DJ6.0.0 -> DJ9.1.2

webapp/src/Utils/UpdateStrategy.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
enum UpdateStrategy: string
66
{
7-
case Strategy_incremental = 'incremental';
8-
case Strategy_major_release = 'major';
9-
case Strategy_none = 'none';
7+
case INCREMENTAL = 'incremental';
8+
case MAJOR_RELEASE = 'major';
9+
case NONE = 'none';
1010

1111
public function getConfigDescription(): string
1212
{
1313
return match ($this) {
14-
self::Strategy_incremental => 'Report on next patch releases, favoring reliability over features',
15-
self::Strategy_major_release => 'Report on newest Major/minor releases, favoring being close to the version maintainers run',
16-
self::Strategy_none => 'Do not report on any new versions',
14+
self::INCREMENTAL => 'Report on next patch releases, favoring reliability over features',
15+
self::MAJOR_RELEASE => 'Report on newest Major/minor releases, favoring being close to the version maintainers run',
16+
self::NONE => 'Do not report on any new versions',
1717
};
1818
}
1919
}

0 commit comments

Comments
 (0)