Skip to content

Commit 790dc1b

Browse files
committed
Fix PHPStan issues
1 parent ad2db16 commit 790dc1b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

judge/judgedaemon.main.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ public function __construct(
158158
* team_message?: string, score?: string
159159
* }
160160
* @phpstan-type RunConfig array{time_limit: float, memory_limit: int, output_limit: int,
161-
* process_limit: int, entry_point: ?string, pass_limit: int, hash: string, overshoot: int
161+
* process_limit: int, entry_point: ?string, pass_limit: int, hash: string, overshoot: int, chroot?: string
162162
* }
163163
* @phpstan-type CompareConfig array{script_timelimit: int, script_memory_limit: int,
164164
* script_filesize_limit: int, compare_args: string, combined_run_compare: bool,
165-
* hash: string, is_scoring_problem: bool
165+
* hash: string, is_scoring_problem: bool, chroot?: string
166166
* }
167167
* @phpstan-import-type MetaData_Compare from CompareMetaData
168168
* @phpstan-import-type MetaData_Program from ProgramMetaData
@@ -218,7 +218,6 @@ class JudgeDaemon
218218
/** @var string[] */
219219
private array $chroots_checked = [];
220220

221-
private string $chroot_old = 'default';
222221
private string $chroot_current = 'default';
223222

224223
/** @var ?resource */
@@ -1529,7 +1528,7 @@ private function cleanupJudging(string $workdir): void
15291528

15301529
/**
15311530
* @param JudgeTask $judgeTask
1532-
* @param array{script_timelimit: int, script_memory_limit: int, language_extensions: array<string>, filter_compiler_files: bool, hash: string} $compile_config
1531+
* @param array{script_timelimit: int, script_memory_limit: int, language_extensions: array<string>, filter_compiler_files: bool, hash: string, chroot?: string} $compile_config
15331532
*/
15341533
private function compile(
15351534
array $judgeTask,
@@ -1962,7 +1961,7 @@ private function testcaseRunInternal(
19621961
if (!$this->runCommandSafe([LIBJUDGEDIR . '/' . self::CHROOT_SCRIPT, 'stop'], $retval)) {
19631962
logmsg(LOG_ERR, "chroot script exited with exitcode $retval");
19641963
$this->disable('judgehost', 'hostname', $this->myhost, "chroot script exited with exitcode $retval on $this->myhost");
1965-
return false;
1964+
return Verdict::INTERNAL_ERROR;
19661965
// Leaving this here for the review, I think we can decide to leave here as we know we didn´t compile yet and we failed.
19671966
// rm: Just continue here: even though we might continue a current
19681967
// rm: compile/test-run cycle, we don't know whether we're in one here,
@@ -1983,7 +1982,7 @@ private function testcaseRunInternal(
19831982
if (!$this->runCommandSafe([LIBJUDGEDIR . '/' . self::CHROOT_SCRIPT, '-c', $chroot_run, 'start'], $retval)) {
19841983
logmsg(LOG_ERR, "chroot script exited with exitcode $retval");
19851984
$this->disable('judgehost', 'hostname', $this->myhost, "chroot script exited with exitcode $retval on $this->myhost");
1986-
return false;
1985+
return Verdict::INTERNAL_ERROR;
19871986
}
19881987
sleep(1);
19891988
}
@@ -2212,7 +2211,7 @@ private function testcaseRunInternal(
22122211
if (!$this->runCommandSafe([LIBJUDGEDIR . '/' . self::CHROOT_SCRIPT, 'stop'], $retval)) {
22132212
logmsg(LOG_ERR, "chroot script exited with exitcode $retval");
22142213
$this->disable('judgehost', 'hostname', $this->myhost, "chroot script exited with exitcode $retval on $this->myhost");
2215-
return false;
2214+
return Verdict::INTERNAL_ERROR;
22162215
// Leaving this here for the review, I think we can decide to leave here as we know we didn´t compile yet and we failed.
22172216
// rm: Just continue here: even though we might continue a current
22182217
// rm: compile/test-run cycle, we don't know whether we're in one here,
@@ -2233,7 +2232,7 @@ private function testcaseRunInternal(
22332232
if (!$this->runCommandSafe([LIBJUDGEDIR . '/' . self::CHROOT_SCRIPT, '-c', $chroot_compare, 'start'], $retval)) {
22342233
logmsg(LOG_ERR, "chroot script exited with exitcode $retval");
22352234
$this->disable('judgehost', 'hostname', $this->myhost, "chroot script exited with exitcode $retval on $this->myhost");
2236-
return false;
2235+
return Verdict::INTERNAL_ERROR;
22372236
}
22382237
sleep(1);
22392238
}

0 commit comments

Comments
 (0)