diff --git a/webapp/src/Command/CheckDatabaseConfigurationDefaultValuesCommand.php b/webapp/src/Command/CheckDatabaseConfigurationDefaultValuesCommand.php index 5fe5e243bc..f213fdaede 100644 --- a/webapp/src/Command/CheckDatabaseConfigurationDefaultValuesCommand.php +++ b/webapp/src/Command/CheckDatabaseConfigurationDefaultValuesCommand.php @@ -15,7 +15,7 @@ )] class CheckDatabaseConfigurationDefaultValuesCommand extends Command { - public function __construct(protected readonly ConfigurationService $config, string $name = null) + public function __construct(protected readonly ConfigurationService $config, ?string $name = null) { parent::__construct($name); } diff --git a/webapp/src/Command/ImportEventFeedCommand.php b/webapp/src/Command/ImportEventFeedCommand.php index f8060805c4..eee70cc16e 100644 --- a/webapp/src/Command/ImportEventFeedCommand.php +++ b/webapp/src/Command/ImportEventFeedCommand.php @@ -43,7 +43,7 @@ public function __construct( protected readonly TokenStorageInterface $tokenStorage, protected readonly ?Profiler $profiler, protected readonly ExternalContestSourceService $sourceService, - string $name = null + ?string $name = null ) { parent::__construct($name); } diff --git a/webapp/src/Command/ScoreboardMergeCommand.php b/webapp/src/Command/ScoreboardMergeCommand.php index 0533212c04..c75cd5f8bb 100644 --- a/webapp/src/Command/ScoreboardMergeCommand.php +++ b/webapp/src/Command/ScoreboardMergeCommand.php @@ -52,7 +52,7 @@ public function __construct( protected readonly RouterInterface $router, #[Autowire('%kernel.project_dir%')] protected readonly string $projectDir, - string $name = null + ?string $name = null ) { parent::__construct($name); } diff --git a/webapp/src/Config/Loader/YamlConfigLoader.php b/webapp/src/Config/Loader/YamlConfigLoader.php index af65092ab0..e7bd28c6ce 100644 --- a/webapp/src/Config/Loader/YamlConfigLoader.php +++ b/webapp/src/Config/Loader/YamlConfigLoader.php @@ -15,12 +15,12 @@ class YamlConfigLoader extends FileLoader /** * @return mixed */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, ?string $type = null) { return Yaml::parse(file_get_contents($resource)); } - public function supports($resource, string $type = null): bool + public function supports($resource, ?string $type = null): bool { return is_string($resource) && pathinfo($resource, PATHINFO_EXTENSION) === 'yaml'; diff --git a/webapp/src/Controller/API/JudgementTypeController.php b/webapp/src/Controller/API/JudgementTypeController.php index a20a3fd350..fe4bb3ae81 100644 --- a/webapp/src/Controller/API/JudgementTypeController.php +++ b/webapp/src/Controller/API/JudgementTypeController.php @@ -83,7 +83,7 @@ public function singleAction(Request $request, string $id): JudgementType * * @return JudgementType[] */ - protected function getJudgementTypes(array $filteredOn = null): array + protected function getJudgementTypes(?array $filteredOn = null): array { $verdicts = $this->dj->getVerdicts(mergeExternal: true); diff --git a/webapp/src/Controller/API/ProblemController.php b/webapp/src/Controller/API/ProblemController.php index ecfab13749..a281237137 100644 --- a/webapp/src/Controller/API/ProblemController.php +++ b/webapp/src/Controller/API/ProblemController.php @@ -102,6 +102,7 @@ public function addProblemsAction(Request $request): array // Note: we read the JSON as YAML, since any JSON is also YAML and this allows us // to import files with YAML inside them that match the JSON format $data = Yaml::parseFile($file->getRealPath(), Yaml::PARSE_DATETIME); + $messages = []; if ($this->importExportService->importProblemsData($contest, $data, $ids, $messages)) { return $ids; } diff --git a/webapp/src/Controller/Jury/ImportExportController.php b/webapp/src/Controller/Jury/ImportExportController.php index 1effc3b10c..c489a9da2a 100644 --- a/webapp/src/Controller/Jury/ImportExportController.php +++ b/webapp/src/Controller/Jury/ImportExportController.php @@ -245,6 +245,7 @@ public function indexAction(Request $request): Response $this->addFlash('danger', "Parse error in YAML/JSON file (" . $file->getClientOriginalName() . "): " . $e->getMessage()); return $this->redirectToRoute('jury_import_export'); } + $messages = []; if ($this->importExportService->importProblemsData($problemsImportForm->get('contest')->getData(), $data, $ids, $messages)) { $this->addFlash('success', sprintf('The file %s is successfully imported.', $file->getClientOriginalName())); diff --git a/webapp/src/Entity/Balloon.php b/webapp/src/Entity/Balloon.php index bb4960f83f..70a8bef73e 100644 --- a/webapp/src/Entity/Balloon.php +++ b/webapp/src/Entity/Balloon.php @@ -60,7 +60,7 @@ public function getDone(): bool return $this->done; } - public function setSubmission(Submission $submission = null): Balloon + public function setSubmission(?Submission $submission = null): Balloon { $this->submission = $submission; return $this; diff --git a/webapp/src/Entity/ExecutableFile.php b/webapp/src/Entity/ExecutableFile.php index 28202fdf42..0fa7233b6f 100644 --- a/webapp/src/Entity/ExecutableFile.php +++ b/webapp/src/Entity/ExecutableFile.php @@ -89,7 +89,7 @@ public function getRank(): int return $this->rank; } - public function setImmutableExecutable(ImmutableExecutable $immutableExecutable = null): ExecutableFile + public function setImmutableExecutable(?ImmutableExecutable $immutableExecutable = null): ExecutableFile { $this->immutableExecutable = $immutableExecutable; return $this; diff --git a/webapp/src/Entity/Team.php b/webapp/src/Entity/Team.php index d485103d6e..b08b485446 100644 --- a/webapp/src/Entity/Team.php +++ b/webapp/src/Entity/Team.php @@ -417,7 +417,7 @@ public function setClearPhoto(bool $clearPhoto): Team return $this; } - public function setAffiliation(TeamAffiliation $affiliation = null): Team + public function setAffiliation(?TeamAffiliation $affiliation = null): Team { $this->affiliation = $affiliation; return $this; diff --git a/webapp/src/Security/DOMJudgeIPAuthenticator.php b/webapp/src/Security/DOMJudgeIPAuthenticator.php index 62ebb65e59..507d481142 100644 --- a/webapp/src/Security/DOMJudgeIPAuthenticator.php +++ b/webapp/src/Security/DOMJudgeIPAuthenticator.php @@ -139,7 +139,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio return null; } - public function start(Request $request, AuthenticationException $authException = null): Response + public function start(Request $request, ?AuthenticationException $authException = null): Response { // If this is the guard that fails/is configured to allow access as the entry_point // send the user a basic auth dialog, as that's probably what they're expecting. diff --git a/webapp/src/Service/ImportExportService.php b/webapp/src/Service/ImportExportService.php index be947c60a0..6e175668f3 100644 --- a/webapp/src/Service/ImportExportService.php +++ b/webapp/src/Service/ImportExportService.php @@ -151,7 +151,7 @@ protected function convertImportedTime(array $fields, array $data, ?string &$err return $time instanceof DateTime ? DateTimeImmutable::createFromMutable($time) : $time; } - public function importContestData(mixed $data, ?string &$errorMessage = null, string &$cid = null): bool + public function importContestData(mixed $data, ?string &$errorMessage = null, ?string &$cid = null): bool { if (empty($data) || !is_array($data)) { $errorMessage = 'Error parsing YAML file.'; @@ -327,7 +327,7 @@ public function importContestData(mixed $data, ?string &$errorMessage = null, st * @param string[]|null $ids * @param array $messages */ - public function importProblemsData(Contest $contest, array $problems, array &$ids = null, ?array &$messages = []): bool + public function importProblemsData(Contest $contest, array $problems, ?array &$ids = null, array &$messages = []): bool { // For problemset.yaml the root key is called `problems`, so handle that case // TODO: Move this check away to make the $problems array shape easier diff --git a/webapp/src/Service/ScoreboardService.php b/webapp/src/Service/ScoreboardService.php index e6f2ea208b..35ab9f15cc 100644 --- a/webapp/src/Service/ScoreboardService.php +++ b/webapp/src/Service/ScoreboardService.php @@ -950,7 +950,7 @@ public function getScoreboardTwigData( * Get the teams to display on the scoreboard. * @return Team[] */ - protected function getTeams(Contest $contest, bool $jury = false, Filter $filter = null): array + protected function getTeams(Contest $contest, bool $jury = false, ?Filter $filter = null): array { $queryBuilder = $this->em->createQueryBuilder() ->from(Team::class, 't', 't.teamid')