Skip to content

Commit

Permalink
Add PHPStan types to more entities, mostly service files.
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj authored and Nicky Gerritsen committed Jan 12, 2024
1 parent aed804f commit f03b0d1
Show file tree
Hide file tree
Showing 17 changed files with 162 additions and 292 deletions.
270 changes: 0 additions & 270 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ parameters:
count: 1
path: webapp/src/Controller/API/JudgehostController.php

-
message: "#^PHPDoc tag @var for variable \\$judgings has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Controller/API/JudgehostController.php

-
message: "#^Method App\\\\Controller\\\\API\\\\JudgementTypeController\\:\\:getJudgementTypes\\(\\) has parameter \\$filteredOn with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -285,11 +280,6 @@ parameters:
count: 1
path: webapp/src/Controller/Jury/RejudgingController.php

-
message: "#^PHPDoc tag @var for variable \\$judgings has no value type specified in iterable type array\\.$#"
count: 2
path: webapp/src/Controller/Jury/RejudgingController.php

-
message: "#^Method App\\\\Controller\\\\Jury\\\\SubmissionController\\:\\:determineFileChanged\\(\\) has parameter \\$files with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -405,161 +395,11 @@ parameters:
count: 1
path: webapp/src/Service/BalloonService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkAdminPass\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkAffiliations\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkAllExternalIdentifiers\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkContestActive\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkContestBanners\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkContestsValidate\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkDebugDisabled\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkDefaultCompareRunExist\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkExternalIdentifiers\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkHashTime\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkLanguagesValidate\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkMysqlSettings\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkPhpExtensions\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkPhpSettings\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkPhpVersion\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkProblemsValidate\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkScriptFilesizevsMemoryLimit\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkSelfRegistration\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkTeamDuplicateNames\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkTeamPhotos\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:checkTmpdirWritable\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\CheckConfigService\\:\\:runAll\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^PHPDoc tag @var for variable \\$tcs_size has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/CheckConfigService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:addOptions\\(\\) has parameter \\$item with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:addOptions\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:all\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:findExecutableOptions\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:getConfigSpecification\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:getDbValues\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\ConfigurationService\\:\\:saveChanges\\(\\) has parameter \\$dataToSet with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Property App\\\\Service\\\\ConfigurationService\\:\\:\\$dbConfigCache type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ConfigurationService.php

-
message: "#^Method App\\\\Service\\\\DOMJudgeService\\:\\:apiRelativeUrl\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -595,11 +435,6 @@ parameters:
count: 1
path: webapp/src/Service/DOMJudgeService.php

-
message: "#^Method App\\\\Service\\\\DOMJudgeService\\:\\:getVerdicts\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/DOMJudgeService.php

-
message: "#^Method App\\\\Service\\\\DOMJudgeService\\:\\:internalApiRequest\\(\\) has parameter \\$queryOrPostData with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -620,16 +455,6 @@ parameters:
count: 1
path: webapp/src/Service/DOMJudgeService.php

-
message: "#^Method App\\\\Service\\\\EventLogService\\:\\:getExternalIds\\(\\) has parameter \\$ids with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/EventLogService.php

-
message: "#^Method App\\\\Service\\\\EventLogService\\:\\:getExternalIds\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/EventLogService.php

-
message: "#^Method App\\\\Service\\\\EventLogService\\:\\:hasAllDependentObjectEvents\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -760,11 +585,6 @@ parameters:
count: 1
path: webapp/src/Service/ExternalContestSourceService.php

-
message: "#^Method App\\\\Service\\\\ExternalContestSourceService\\:\\:warningIfUnsupported\\(\\) has parameter \\$supportedActions with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ExternalContestSourceService.php

-
message: "#^Property App\\\\Service\\\\ExternalContestSourceService\\:\\:\\$cachedApiInfoData type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -780,21 +600,6 @@ parameters:
count: 1
path: webapp/src/Service/ExternalContestSourceService.php

-
message: "#^Property App\\\\Service\\\\ExternalContestSourceService\\:\\:\\$verdicts type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ExternalContestSourceService.php

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:convertImportedTime\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportExportService.php

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:convertImportedTime\\(\\) has parameter \\$fields with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportExportService.php

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:getContestYamlData\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -885,46 +690,6 @@ parameters:
count: 1
path: webapp/src/Service/ImportExportService.php

-
message: "#^Method App\\\\Service\\\\ImportProblemService\\:\\:importProblemFromRequest\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportProblemService.php

-
message: "#^Method App\\\\Service\\\\ImportProblemService\\:\\:importZippedProblem\\(\\) has parameter \\$messages with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportProblemService.php

-
message: "#^Method App\\\\Service\\\\ImportProblemService\\:\\:searchAndAddValidator\\(\\) has parameter \\$messages with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportProblemService.php

-
message: "#^Method App\\\\Service\\\\RejudgingService\\:\\:calculateTodo\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/RejudgingService.php

-
message: "#^Method App\\\\Service\\\\RejudgingService\\:\\:createRejudging\\(\\) has parameter \\$judgings with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/RejudgingService.php

-
message: "#^Method App\\\\Service\\\\RejudgingService\\:\\:createRejudging\\(\\) has parameter \\$skipped with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/RejudgingService.php

-
message: "#^PHPDoc tag @var for variable \\$submissions has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/RejudgingService.php

-
message: "#^Method App\\\\Service\\\\ScoreboardService\\:\\:getFilterValues\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ScoreboardService.php

-
message: "#^Method App\\\\Service\\\\ScoreboardService\\:\\:getGroupedAffiliations\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -950,11 +715,6 @@ parameters:
count: 1
path: webapp/src/Service/StatisticsService.php

-
message: "#^Method App\\\\Service\\\\StatisticsService\\:\\:getTeamNumSubmissions\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/StatisticsService.php

-
message: "#^Method App\\\\Service\\\\StatisticsService\\:\\:getTeamStats\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -964,33 +724,3 @@ parameters:
message: "#^Method App\\\\Service\\\\StatisticsService\\:\\:setOrIncrement\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/StatisticsService.php

-
message: "#^Method App\\\\Service\\\\SubmissionService\\:\\:getExpectedResults\\(\\) has parameter \\$resultsRemap with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/SubmissionService.php

-
message: "#^Method App\\\\Service\\\\SubmissionService\\:\\:getFinalResult\\(\\) has parameter \\$resultsPrio with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/SubmissionService.php

-
message: "#^Method App\\\\Service\\\\SubmissionService\\:\\:getSourceFilename\\(\\) has parameter \\$fileData with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/SubmissionService.php

-
message: "#^Method App\\\\Service\\\\SubmissionService\\:\\:getSubmissionList\\(\\) has parameter \\$contests with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/SubmissionService.php

-
message: "#^Method App\\\\Service\\\\SubmissionService\\:\\:getSubmissionList\\(\\) has parameter \\$restrictions with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/SubmissionService.php

-
message: "#^Method App\\\\Service\\\\SubmissionService\\:\\:getSubmissionList\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/SubmissionService.php
2 changes: 1 addition & 1 deletion webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ private function maybeUpdateActiveJudging(Judging $judging): void
$this->em->flush();

$skipped = [];
/** @var array[] $judgings */
/** @var Judging[] $judgings */
$judgings = $this->em->createQueryBuilder()
->from(Judging::class, 'j')
->leftJoin('j.submission', 's')
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/Controller/Jury/RejudgingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ public function viewAction(

$restrictions = ['rejudgingid' => $rejudgingId];
if ($viewTypes[$view] == 'unverified') {
$restrictions['verified'] = 0;
$restrictions['verified'] = false;
}
if ($viewTypes[$view] == 'unjudged') {
$restrictions['judged'] = 0;
$restrictions['judged'] = false;
}
if ($viewTypes[$view] == 'diff') {
$restrictions['rejudgingdiff'] = 1;
$restrictions['rejudgingdiff'] = true;
}
if ($oldverdict !== 'all') {
$restrictions['old_result'] = $oldverdict;
Expand Down Expand Up @@ -604,7 +604,7 @@ public function addAction(Request $request, FormFactoryInterface $formFactory):
}
}

/** @var array[] $judgings */
/** @var Judging[] $judgings */
$judgings = $queryBuilder
->getQuery()
->getResult();
Expand Down Expand Up @@ -733,7 +733,7 @@ public function createAction(Request $request): Response
->setParameter('correct', 'correct');
}

/** @var array[] $judgings */
/** @var Judging[] $judgings */
$judgings = $queryBuilder
->getQuery()
->getResult();
Expand Down
Loading

0 comments on commit f03b0d1

Please sign in to comment.