Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ignored PHPstan found issues #2320

Merged
merged 5 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 0 additions & 156 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ parameters:
count: 1
path: webapp/src/FosRestBundle/FlattenExceptionHandler.php

-

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

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

-
message: "#^Method App\\\\Service\\\\ExternalContestSourceService\\:\\:compareOrCreateValues\\(\\) has parameter \\$extraDiff with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -90,36 +79,11 @@ parameters:
count: 1
path: webapp/src/Service/ExternalContestSourceService.php

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

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

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

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

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

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

-
message: "#^Method App\\\\Service\\\\ExternalContestSourceService\\:\\:importFromContestArchive\\(\\) has parameter \\$eventsToSkip with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -190,127 +154,7 @@ parameters:
count: 1
path: webapp/src/Service/ExternalContestSourceService.php

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

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

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

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

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

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

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:importAccountsJson\\(\\) 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\\:\\:importAccountsTsv\\(\\) has parameter \\$content with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportExportService.php

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

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:importGroupsJson\\(\\) 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\\:\\:importGroupsTsv\\(\\) has parameter \\$content with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportExportService.php

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

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:importOrganizationsJson\\(\\) 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\\:\\:importProblemsData\\(\\) has parameter \\$ids with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportExportService.php

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

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

-
message: "#^Method App\\\\Service\\\\ImportExportService\\:\\:importTeamsJson\\(\\) 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\\:\\:importTeamsTsv\\(\\) has parameter \\$content with no value type specified in iterable type array\\.$#"
count: 1
path: webapp/src/Service/ImportExportService.php

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

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

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

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

-
message: "#^Method App\\\\Service\\\\StatisticsService\\:\\:getProblemStats\\(\\) 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
path: webapp/src/Service/StatisticsService.php

-
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
44 changes: 42 additions & 2 deletions webapp/src/Service/ExternalContestSourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ public function getLastReadEventId(): ?string
->getSingleScalarResult();
}

/**
* @param string[] $eventsToSkip
*/
public function import(bool $fromStart, array $eventsToSkip, ?callable $progressReporter = null): bool
{
// We need the verdicts to validate judgement-types.
Expand Down Expand Up @@ -290,6 +293,9 @@ protected function setLastEvent(?string $eventId): void
->execute();
}

/**
* @param string[] $eventsToSkip
*/
protected function importFromCcsApi(array $eventsToSkip, ?callable $progressReporter = null): bool
{
while (true) {
Expand Down Expand Up @@ -568,11 +574,22 @@ protected function loadContest(): void

/**
* Import the given event.
*
* @param array{token?: string, id: string, type: string, time: string, op?: string, end_of_updates?: bool,
* data?: array{run_time?: float, time?: string, contest_time?: string, ordinal?: int,
* id: string, judgement_id?: string, judgement_type_id: string|null,
* max_run_time?: float|null, start_time: string, start_contest_time?: string,
* end_time?: string|null, end_contest_time?: string|null, submission_id: string,
* output_compile_as_string: null, language_id?: string, externalid?: null,
* team_id: string, problem_id?: string, entry_point?: string|null, old_result?: null,
* files?: array{href: string}}|mixed[]
* } $event
* @param string[] $eventsToSkip
* @throws DBALException
* @throws NonUniqueResultException
* @throws TransportExceptionInterface
*/
public function importEvent(array $event, array $eventsToSKip): void
public function importEvent(array $event, array $eventsToSkip): void
{
// Check whether we have received an exit signal.
if (function_exists('pcntl_signal_dispatch')) {
Expand Down Expand Up @@ -604,7 +621,7 @@ public function importEvent(array $event, array $eventsToSKip): void
$entityType = 'contests';
}

if ($eventId !== null && in_array($eventId, $eventsToSKip)) {
if ($eventId !== null && in_array($eventId, $eventsToSkip)) {
$this->logger->info("Skipping event with ID %s and type %s as requested",
[$eventId, $event['type']]);
return;
Expand Down Expand Up @@ -1776,6 +1793,15 @@ protected function processPendingEvents(string $type, string|int $id): void
}
}

/**
* @param array{run_time?: float, time?: string, contest_time?: string, ordinal?: int,
* id: string, judgement_id?: string, judgement_type_id: string|null,
* max_run_time?: float|null, start_time: string, start_contest_time?: string,
* end_time?: string|null, end_contest_time?: string|null, submission_id: string,
* output_compile_as_string: null, language_id?: string, externalid?: null,
* team_id: string, problem_id?: string, entry_point?: string|null, old_result?: null,
* files?: array{href: string}} $data
*/
protected function addPendingEvent(string $type, string|int $id, string $operation, string $entityType, ?string $eventId, array $data): void
{
// First, check if we already have pending events for this event.
Expand Down Expand Up @@ -1948,6 +1974,9 @@ protected function warningIfUnsupported(string $operation, ?string $eventId, str
return true;
}

/**
* @param array<string, mixed> $content
*/
protected function addOrUpdateWarning(
?string $eventId,
string $entityType,
Expand Down Expand Up @@ -1993,6 +2022,17 @@ protected function removeWarning(string $entityType, ?string $entityId, string $
}
}

/**
* @param array{token?: string, id: string, type: string, time: string, op?: string, end_of_updates?: bool,
* data?: array{run_time?: float, time?: string, contest_time?: string, ordinal?: int,
* id: string, judgement_id?: string, judgement_type_id: string|null,
* max_run_time?: float|null, start_time: string, start_contest_time?: string,
* end_time?: string|null, end_contest_time?: string|null, submission_id: string,
* output_compile_as_string: null, language_id?: string, externalid?: null,
* team_id: string, problem_id?: string, entry_point?: string|null, old_result?: null,
* files?: array{href: string}}|mixed[]
* } $event
*/
protected function getEventFeedFormat(array $event): EventFeedFormat
{
return match ($this->getApiVersion()) {
Expand Down
Loading
Loading