From 1ee2a3d72d97df34b5531ae6787f996ac8d62a2b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 26 Mar 2023 21:42:56 +0200 Subject: Fix repartitionAction (#5228) * Fix repartitionAction Fix https://github.com/FreshRSS/FreshRSS/issues/5227 * Better types * PHPStan level 6 --- app/Models/StatsDAOPGSQL.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'app/Models/StatsDAOPGSQL.php') diff --git a/app/Models/StatsDAOPGSQL.php b/app/Models/StatsDAOPGSQL.php index 85f9d63f3..9548027ce 100644 --- a/app/Models/StatsDAOPGSQL.php +++ b/app/Models/StatsDAOPGSQL.php @@ -6,40 +6,34 @@ class FreshRSS_StatsDAOPGSQL extends FreshRSS_StatsDAO { * Calculates the number of article per hour of the day per feed * * @param integer $feed id - * @return array + * @return array */ - public function calculateEntryRepartitionPerFeedPerHour($feed = null) { + public function calculateEntryRepartitionPerFeedPerHour(?int $feed = null): array { return $this->calculateEntryRepartitionPerFeedPerPeriod('hour', $feed); } /** * Calculates the number of article per day of week per feed - * - * @param integer $feed id - * @return array + * @return array */ - public function calculateEntryRepartitionPerFeedPerDayOfWeek($feed = null) { + public function calculateEntryRepartitionPerFeedPerDayOfWeek(?int $feed = null): array { return $this->calculateEntryRepartitionPerFeedPerPeriod('day', $feed); } /** * Calculates the number of article per month per feed - * - * @param integer $feed - * @return array + * @return array */ - public function calculateEntryRepartitionPerFeedPerMonth($feed = null) { + public function calculateEntryRepartitionPerFeedPerMonth(?int $feed = null): array { return $this->calculateEntryRepartitionPerFeedPerPeriod('month', $feed); } /** * Calculates the number of article per period per feed - * * @param string $period format string to use for grouping - * @param integer $feed id * @return array */ - protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + protected function calculateEntryRepartitionPerFeedPerPeriod(string $period, ?int $feed = null): array { $restrict = ''; if ($feed) { $restrict = "WHERE e.id_feed = {$feed}"; -- cgit v1.2.3