From 62f32ccadff77594f5b8e3ad24c4c2541ff35885 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 7 Aug 2025 22:19:45 +0200 Subject: PHPStan: finalise strictArrayFilter (#7794) As well as reportPossiblyNonexistentConstantArrayOffset. And disable PHPStan-next from GitHub Action, since the work is completed for now. --- app/Controllers/configureController.php | 2 +- app/Controllers/feedController.php | 2 +- app/Controllers/subscriptionController.php | 4 ++-- app/Models/Entry.php | 2 +- app/Models/UserQuery.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index dc5407e99..6c1561d7c 100644 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -386,7 +386,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { $this->view->tags = FreshRSS_Context::labels(); if (Minz_Request::isPost()) { - $params = array_filter(Minz_Request::paramArray('query')); + $params = Minz_Request::paramArray('query'); $queryParams = []; $name = Minz_Request::paramString('name') ?: _t('conf.query.number', $id + 1); if ('' === $name) { diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 977143882..97d68883c 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -221,7 +221,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } } - $headers = array_filter(array_map('trim', $headers)); + $headers = array_filter($headers, fn(string $header): bool => trim($header) !== ''); if (!empty($headers)) { $opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []); $opts[CURLOPT_HTTPHEADER] = array_unique($opts[CURLOPT_HTTPHEADER]); diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 70065fc26..424b9a776 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -207,7 +207,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { } } - $headers = array_filter(array_map('trim', $headers)); + $headers = array_filter($headers, fn(string $header): bool => trim($header) !== ''); if (!empty($headers)) { $opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []); $opts[CURLOPT_HTTPHEADER] = array_unique($opts[CURLOPT_HTTPHEADER]); @@ -318,7 +318,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { } $conditions = Minz_Request::paramTextToArray('path_entries_conditions', plaintext: true); - $conditions = array_filter(array_map('trim', $conditions)); + $conditions = array_filter($conditions, fn(string $condition): bool => trim($condition) !== ''); $feed->_attribute('path_entries_conditions', empty($conditions) ? null : $conditions); $feed->_attribute('path_entries_filter', Minz_Request::paramString('path_entries_filter', true)); diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 7ba0d3793..7254dd513 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -860,7 +860,7 @@ HTML; } $conditions = $feed->attributeArray('path_entries_conditions') ?? []; - $conditions = array_filter(array_map(fn($v) => is_string($v) ? trim($v) : '', $conditions)); + $conditions = array_filter($conditions, fn($v): bool => (is_string($v) ? trim($v) : '') !== ''); if (count($conditions) > 0) { $found = false; foreach ($conditions as $condition) { diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 196d0126e..c78eeccd3 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -124,7 +124,7 @@ class FreshRSS_UserQuery { 'shareOpml' => $this->shareOpml, 'description' => $this->description, 'imageUrl' => $this->imageUrl, - ]); + ], fn($v): bool => $v !== '' && $v !== 0 && $v !== false); } /** -- cgit v1.2.3