diff options
| author | 2023-03-26 21:42:56 +0200 | |
|---|---|---|
| committer | 2023-03-26 21:42:56 +0200 | |
| commit | 1ee2a3d72d97df34b5531ae6787f996ac8d62a2b (patch) | |
| tree | d018dba8b53d76a9b8c7ab1b2b743edfd9ba2401 /app/Models/StatsDAOPGSQL.php | |
| parent | 59c1405c7d4d014ff693ef6f44400ea06318dc69 (diff) | |
Fix repartitionAction (#5228)
* Fix repartitionAction
Fix https://github.com/FreshRSS/FreshRSS/issues/5227
* Better types
* PHPStan level 6
Diffstat (limited to 'app/Models/StatsDAOPGSQL.php')
| -rw-r--r-- | app/Models/StatsDAOPGSQL.php | 20 |
1 files changed, 7 insertions, 13 deletions
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<int,int> */ - 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<int,int> */ - 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<int,int> */ - 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<int,int> */ - protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + protected function calculateEntryRepartitionPerFeedPerPeriod(string $period, ?int $feed = null): array { $restrict = ''; if ($feed) { $restrict = "WHERE e.id_feed = {$feed}"; |
