Skip to content

Commit 3821281

Browse files
committed
More phpstan fixes
1 parent 4bd8a61 commit 3821281

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

webapp/src/Controller/Jury/ImportExportController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public function indexAction(Request $request): Response
157157
try {
158158
$zip = $this->dj->openZipFile($archive->getRealPath());
159159
$clientName = $archive->getClientOriginalName();
160+
/** @var array<string, string[]> $messages */
160161
$messages = [];
161162
if ($contestId === null) {
162163
$contest = null;

webapp/src/Controller/Jury/ProblemController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ public function editAction(Request $request, int $probId): Response
956956
$data = $uploadForm->getData();
957957
/** @var UploadedFile $archive */
958958
$archive = $data['archive'];
959+
/** @var array<string, string[]> $messages */
959960
$messages = [];
960961

961962
/** @var Contest|null $contest */

webapp/src/Service/ImportProblemService.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public function __construct(
6060
public function importZippedProblem(
6161
ZipArchive $zip,
6262
string $clientName,
63-
?Problem $problem = null,
64-
?Contest $contest = null,
65-
?array &$messages = []
63+
?Problem $problem,
64+
?Contest $contest,
65+
array &$messages
6666
): ?Problem {
6767
// This might take a while.
6868
Utils::extendMaxExecutionTime(300);
@@ -923,6 +923,7 @@ public function importProblemFromRequest(Request $request, ?int $contestId = nul
923923
try {
924924
$zip = $this->dj->openZipFile($file->getRealPath());
925925
$clientName = $file->getClientOriginalName();
926+
/** @var array<string, string[]> $messages */
926927
$messages = [];
927928
$newProblem = $this->importZippedProblem(
928929
$zip, $clientName, $problem, $contest, $messages
@@ -949,7 +950,7 @@ public function importProblemFromRequest(Request $request, ?int $contestId = nul
949950
}
950951

951952
/**
952-
* @param array{danger?: string[], info?: string[]} $messages
953+
* @param array<string, string[]> $messages
953954
*/
954955
private function searchAndAddValidator(ZipArchive $zip, ?array &$messages, string $externalId, string $validationMode, ?Problem $problem): bool
955956
{
@@ -1055,6 +1056,9 @@ private function searchAndAddValidator(ZipArchive $zip, ?array &$messages, strin
10551056
return true;
10561057
}
10571058

1059+
/**
1060+
* @param array<string, string[]> $messages
1061+
*/
10581062
public function parseTestCaseGroupMeta(string $fileContent, string $name, array &$messages): ?TestcaseGroup
10591063
{
10601064
$yamlData = Yaml::parse($fileContent);

0 commit comments

Comments
 (0)