summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorwn_ <[email protected]>2024-03-26 16:38:05 +0000
committerwn_ <[email protected]>2024-03-26 16:43:39 +0000
commitde00a095387499cdb5c8eb9c0ab721d67bd0b3fa (patch)
treed64d45215fa331dca8c489e9b9fbbc9e04cb5eda /classes
parentfea3089bde5b4abfdcc8b5a0314a7f82fcf25bea (diff)
Make implicit nullable parameters explicitly nullable.
This is to address a deprecation planned for PHP 8.4. https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
Diffstat (limited to 'classes')
-rw-r--r--classes/Counters.php18
-rw-r--r--classes/Feeds.php2
-rw-r--r--classes/PluginHost.php4
-rw-r--r--classes/RSSUtils.php2
-rw-r--r--classes/Sanitizer.php2
-rw-r--r--classes/TimeHelper.php4
-rw-r--r--classes/UserHelper.php4
7 files changed, 18 insertions, 18 deletions
diff --git a/classes/Counters.php b/classes/Counters.php
index 948e6ee1d..b3cba162c 100644
--- a/classes/Counters.php
+++ b/classes/Counters.php
@@ -15,11 +15,11 @@ class Counters {
}
/**
- * @param array<int> $feed_ids
- * @param array<int> $label_ids
+ * @param array<int>|null $feed_ids
+ * @param array<int>|null $label_ids
* @return array<int, array<string, int|string>>
*/
- static function get_conditional(array $feed_ids = null, array $label_ids = null): array {
+ static function get_conditional(?array $feed_ids = null, ?array $label_ids = null): array {
return [
...self::get_global(),
...self::get_virt(),
@@ -52,10 +52,10 @@ class Counters {
}
/**
- * @param array<int> $cat_ids
+ * @param array<int>|null $cat_ids
* @return array<int, array<string, int|string>>
*/
- private static function get_cats(array $cat_ids = null): array {
+ private static function get_cats(?array $cat_ids = null): array {
$ret = [];
/* Labels category */
@@ -141,10 +141,10 @@ class Counters {
}
/**
- * @param array<int> $feed_ids
+ * @param array<int>|null $feed_ids
* @return array<int, array<string, int|string>>
*/
- private static function get_feeds(array $feed_ids = null): array {
+ private static function get_feeds(?array $feed_ids = null): array {
$span = Tracer::start(__METHOD__);
$ret = [];
@@ -300,10 +300,10 @@ class Counters {
}
/**
- * @param array<int> $label_ids
+ * @param array<int>|null $label_ids
* @return array<int, array<string, int|string>>
*/
- static function get_labels(array $label_ids = null): array {
+ static function get_labels(?array $label_ids = null): array {
$span = Tracer::start(__METHOD__);
$ret = [];
diff --git a/classes/Feeds.php b/classes/Feeds.php
index 88128cc48..4d4ca3240 100644
--- a/classes/Feeds.php
+++ b/classes/Feeds.php
@@ -2127,7 +2127,7 @@ class Feeds extends Handler_Protected {
$cat->delete();
}
- static function _add_cat(string $title, int $owner_uid, int $parent_cat = null, int $order_id = 0): bool {
+ static function _add_cat(string $title, int $owner_uid, ?int $parent_cat = null, int $order_id = 0): bool {
$cat = ORM::for_table('ttrss_feed_categories')
->where('owner_uid', $owner_uid)
diff --git a/classes/PluginHost.php b/classes/PluginHost.php
index e39273672..2098be4e6 100644
--- a/classes/PluginHost.php
+++ b/classes/PluginHost.php
@@ -429,7 +429,7 @@ class PluginHost {
/**
* @param PluginHost::KIND_* $kind
*/
- function load_all(int $kind, int $owner_uid = null, bool $skip_init = false): void {
+ function load_all(int $kind, ?int $owner_uid = null, bool $skip_init = false): void {
$span = Tracer::start(__METHOD__);
$span->setAttribute('func.args', json_encode(func_get_args()));
@@ -447,7 +447,7 @@ class PluginHost {
/**
* @param PluginHost::KIND_* $kind
*/
- function load(string $classlist, int $kind, int $owner_uid = null, bool $skip_init = false): void {
+ function load(string $classlist, int $kind, ?int $owner_uid = null, bool $skip_init = false): void {
$span = Tracer::start(__METHOD__);
$span->setAttribute('func.args', json_encode(func_get_args()));
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index a2bd36a75..68cbfd26a 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -1511,7 +1511,7 @@ class RSSUtils {
*
* @return array<int, array<string, string>> An array of filter action arrays with keys "type" and "param"
*/
- static function get_article_filters(array $filters, string $title, string $content, string $link, string $author, array $tags, array &$matched_rules = null, array &$matched_filters = null): array {
+ static function get_article_filters(array $filters, string $title, string $content, string $link, string $author, array $tags, ?array &$matched_rules = null, ?array &$matched_filters = null): array {
$span = Tracer::start(__METHOD__);
$matches = array();
diff --git a/classes/Sanitizer.php b/classes/Sanitizer.php
index a7bea9e5f..2a5b031df 100644
--- a/classes/Sanitizer.php
+++ b/classes/Sanitizer.php
@@ -62,7 +62,7 @@ class Sanitizer {
*
* @return false|string The HTML, or false if an error occurred.
*/
- public static function sanitize(string $str, ?bool $force_remove_images = false, int $owner = null, string $site_url = null, array $highlight_words = null, int $article_id = null) {
+ public static function sanitize(string $str, ?bool $force_remove_images = false, ?int $owner = null, ?string $site_url = null, ?array $highlight_words = null, ?int $article_id = null) {
$span = OpenTelemetry\API\Trace\Span::getCurrent();
$span->addEvent("Sanitizer::sanitize");
diff --git a/classes/TimeHelper.php b/classes/TimeHelper.php
index 453ee0cee..f1c437831 100644
--- a/classes/TimeHelper.php
+++ b/classes/TimeHelper.php
@@ -1,7 +1,7 @@
<?php
class TimeHelper {
- static function smart_date_time(int $timestamp, int $tz_offset = 0, int $owner_uid = null, bool $eta_min = false): string {
+ static function smart_date_time(int $timestamp, int $tz_offset = 0, ?int $owner_uid = null, bool $eta_min = false): string {
if (!$owner_uid) $owner_uid = $_SESSION['uid'];
if ($eta_min && time() + $tz_offset - $timestamp < 3600) {
@@ -21,7 +21,7 @@ class TimeHelper {
}
}
- static function make_local_datetime(?string $timestamp, bool $long, int $owner_uid = null,
+ static function make_local_datetime(?string $timestamp, bool $long, ?int $owner_uid = null,
bool $no_smart_dt = false, bool $eta_min = false): string {
if (!$owner_uid) $owner_uid = $_SESSION['uid'];
diff --git a/classes/UserHelper.php b/classes/UserHelper.php
index b47f2853e..7cc7b3150 100644
--- a/classes/UserHelper.php
+++ b/classes/UserHelper.php
@@ -58,7 +58,7 @@ class UserHelper {
}
}
- static function authenticate(string $login = null, string $password = null, bool $check_only = false, string $service = null): bool {
+ static function authenticate(?string $login = null, ?string $password = null, bool $check_only = false, ?string $service = null): bool {
if (!Config::get(Config::SINGLE_USER_MODE)) {
$user_id = false;
$auth_module = false;
@@ -130,7 +130,7 @@ class UserHelper {
}
}
- static function load_user_plugins(int $owner_uid, PluginHost $pluginhost = null): void {
+ static function load_user_plugins(int $owner_uid, ?PluginHost $pluginhost = null): void {
if (!$pluginhost) $pluginhost = PluginHost::getInstance();