summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2024-11-24 06:36:58 +0000
committerAndrew Dolgov <fox@fakecake.org>2024-11-24 06:36:58 +0000
commit7892b412348c03f2b6733a326776a47d980fd7f6 (patch)
tree8635fcd5b239f18db5ff831c7ef21a290a8ac6d8 /classes
parentd4636716fb6e1879098823c2f037db5d8d3f24a0 (diff)
parentabcd0e8ba205aac8bd9006e99d783afc999af0af (diff)
Merge branch 'feature/php8-union-types' into 'master'
Use native union types in most places. See merge request tt-rss/tt-rss!80
Diffstat (limited to 'classes')
-rw-r--r--classes/API.php3
-rw-r--r--classes/Article.php2
-rw-r--r--classes/Auth_Base.php7
-rw-r--r--classes/Config.php19
-rw-r--r--classes/Db_Prefs.php10
-rw-r--r--classes/FeedItem.php2
-rw-r--r--classes/FeedItem_Atom.php2
-rw-r--r--classes/FeedItem_Common.php2
-rw-r--r--classes/FeedItem_RSS.php2
-rw-r--r--classes/Feeds.php20
-rw-r--r--classes/Labels.php2
-rw-r--r--classes/Mailer.php2
-rw-r--r--classes/OPML.php16
-rw-r--r--classes/PluginHost.php6
-rw-r--r--classes/Prefs.php39
-rw-r--r--classes/RSSUtils.php7
-rw-r--r--classes/Sanitizer.php2
-rw-r--r--classes/Sessions.php9
-rw-r--r--classes/UrlHelper.php15
-rw-r--r--classes/UserHelper.php4
20 files changed, 55 insertions, 116 deletions
diff --git a/classes/API.php b/classes/API.php
index ad16f82fe..290c813ed 100644
--- a/classes/API.php
+++ b/classes/API.php
@@ -655,10 +655,9 @@ class API extends Handler {
}
/**
- * @param string|int $feed_id
* @return array{0: array<int, array<string, mixed>>, 1: array<string, mixed>} $headlines, $headlines_header
*/
- private static function _api_get_headlines($feed_id, int $limit, int $offset,
+ private static function _api_get_headlines(int|string $feed_id, int $limit, int $offset,
string $filter, bool $is_cat, bool $show_excerpt, bool $show_content, ?string $view_mode, string $order,
bool $include_attachments, int $since_id, string $search = "", bool $include_nested = false,
bool $sanitize_content = true, bool $force_update = false, int $excerpt_length = 100, ?int $check_first_id = null,
diff --git a/classes/Article.php b/classes/Article.php
index 2bc647e48..c668bfa74 100644
--- a/classes/Article.php
+++ b/classes/Article.php
@@ -569,7 +569,7 @@ class Article extends Handler_Protected {
*
* @return array<int, Article::ARTICLE_KIND_*|string>
*/
- static function _get_image(array $enclosures, string $content, string $site_url, array $headline) {
+ static function _get_image(array $enclosures, string $content, string $site_url, array $headline): array {
$article_image = "";
$article_stream = "";
$article_kind = 0;
diff --git a/classes/Auth_Base.php b/classes/Auth_Base.php
index d8128400d..35ff6be49 100644
--- a/classes/Auth_Base.php
+++ b/classes/Auth_Base.php
@@ -16,11 +16,10 @@ abstract class Auth_Base extends Plugin implements IAuthModule {
* Can be used instead of find_user_by_login() by external auth modules
* @param string $login
* @param string|false $password
- * @return null|int
* @throws Exception
* @throws PDOException
*/
- function auto_create_user(string $login, $password = false) {
+ function auto_create_user(string $login, false|string $password = false): ?int {
if ($login && Config::get(Config::AUTH_AUTO_CREATE)) {
$user_id = UserHelper::find_user_by_login($login);
@@ -49,11 +48,9 @@ abstract class Auth_Base extends Plugin implements IAuthModule {
/** replaced with UserHelper::find_user_by_login()
- * @param string $login
- * @return null|int
* @deprecated
*/
- function find_user_by_login(string $login) {
+ function find_user_by_login(string $login): ?int {
return UserHelper::find_user_by_login($login);
}
}
diff --git a/classes/Config.php b/classes/Config.php
index ba6689214..e269fde30 100644
--- a/classes/Config.php
+++ b/classes/Config.php
@@ -296,7 +296,7 @@ class Config {
* based on source git tree commit used when creating the package
* @return array<string, mixed>|string
*/
- static function get_version(bool $as_string = true) {
+ static function get_version(bool $as_string = true): array|string {
return self::get_instance()->_get_version($as_string);
}
@@ -314,7 +314,7 @@ class Config {
/**
* @return array<string, mixed>|string
*/
- private function _get_version(bool $as_string = true) {
+ private function _get_version(bool $as_string = true): array|string {
$root_dir = self::get_self_dir();
if (empty($this->version)) {
@@ -423,10 +423,7 @@ class Config {
return self::get_migrations()->get_version();
}
- /**
- * @return bool|int|string
- */
- static function cast_to(string $value, int $type_hint) {
+ static function cast_to(string $value, int $type_hint): bool|int|string {
switch ($type_hint) {
case self::T_BOOL:
return sql_bool_to_bool($value);
@@ -437,10 +434,7 @@ class Config {
}
}
- /**
- * @return bool|int|string
- */
- private function _get(string $param) {
+ private function _get(string $param): bool|int|string {
list ($value, $type_hint) = $this->params[$param];
return $this->cast_to($value, $type_hint);
@@ -458,10 +452,7 @@ class Config {
$instance->_add($param, $default, $type_hint);
}
- /**
- * @return bool|int|string
- */
- static function get(string $param) {
+ static function get(string $param): bool|int|string {
$instance = self::get_instance();
return $instance->_get($param);
diff --git a/classes/Db_Prefs.php b/classes/Db_Prefs.php
index 55be4f6f6..a7ca1bf62 100644
--- a/classes/Db_Prefs.php
+++ b/classes/Db_Prefs.php
@@ -2,17 +2,11 @@
class Db_Prefs {
// this class is a stub for the time being (to be removed)
- /**
- * @return bool|int|null|string
- */
- function read(string $pref_name, ?int $user_id = null, bool $die_on_error = false) {
+ function read(string $pref_name, ?int $user_id = null, bool $die_on_error = false): bool|int|null|string {
return Prefs::get($pref_name, $user_id ?: $_SESSION['uid'], $_SESSION['profile'] ?? null);
}
- /**
- * @param mixed $value
- */
- function write(string $pref_name, $value, ?int $user_id = null, bool $strip_tags = true): bool {
+ function write(string $pref_name, mixed $value, ?int $user_id = null, bool $strip_tags = true): bool {
return Prefs::set($pref_name, $value, $user_id ?: $_SESSION['uid'], $_SESSION['profile'] ?? null, $strip_tags);
}
}
diff --git a/classes/FeedItem.php b/classes/FeedItem.php
index fd7c54883..ac88ba0bc 100644
--- a/classes/FeedItem.php
+++ b/classes/FeedItem.php
@@ -3,7 +3,7 @@ abstract class FeedItem {
abstract function get_id(): string;
/** @return int|false a timestamp on success, false otherwise */
- abstract function get_date();
+ abstract function get_date(): false|int;
abstract function get_link(): string;
abstract function get_title(): string;
diff --git a/classes/FeedItem_Atom.php b/classes/FeedItem_Atom.php
index b5eaca181..234b96341 100644
--- a/classes/FeedItem_Atom.php
+++ b/classes/FeedItem_Atom.php
@@ -15,7 +15,7 @@ class FeedItem_Atom extends FeedItem_Common {
/**
* @return int|false a timestamp on success, false otherwise
*/
- function get_date() {
+ function get_date(): false|int {
$updated = $this->elem->getElementsByTagName("updated")->item(0);
if ($updated) {
diff --git a/classes/FeedItem_Common.php b/classes/FeedItem_Common.php
index fde481179..1471dc3e3 100644
--- a/classes/FeedItem_Common.php
+++ b/classes/FeedItem_Common.php
@@ -171,7 +171,7 @@ abstract class FeedItem_Common extends FeedItem {
/**
* @return false|string false on failure, otherwise string contents
*/
- function subtree_or_text(DOMElement $node) {
+ function subtree_or_text(DOMElement $node): false|string {
if ($this->count_children($node) == 0) {
return $node->nodeValue;
} else {
diff --git a/classes/FeedItem_RSS.php b/classes/FeedItem_RSS.php
index 207d54dfb..ab1764577 100644
--- a/classes/FeedItem_RSS.php
+++ b/classes/FeedItem_RSS.php
@@ -13,7 +13,7 @@ class FeedItem_RSS extends FeedItem_Common {
/**
* @return int|false a timestamp on success, false otherwise
*/
- function get_date() {
+ function get_date(): false|int {
$pubDate = $this->elem->getElementsByTagName("pubDate")->item(0);
if ($pubDate) {
diff --git a/classes/Feeds.php b/classes/Feeds.php
index 5bfad59bb..504b96db3 100644
--- a/classes/Feeds.php
+++ b/classes/Feeds.php
@@ -53,10 +53,9 @@ class Feeds extends Handler_Protected {
}
/**
- * @param string|int $feed
* @return array{0: array<int, int>, 1: int, 2: int, 3: bool, 4: array<string, mixed>} $topmost_article_ids, $headlines_count, $feed, $disable_cache, $reply
*/
- private function _format_headlines_list($feed, string $method, string $view_mode, int $limit, bool $cat_view,
+ private function _format_headlines_list(int|string $feed, string $method, string $view_mode, int $limit, bool $cat_view,
int $offset, string $override_order, bool $include_children, ?int $check_first_id = null,
?bool $skip_first_id_check = false, ? string $order_by = ''): array {
@@ -914,13 +913,9 @@ class Feeds extends Handler_Protected {
/**
* @param int|string $feed feed id or tag name
- * @param bool $is_cat
- * @param bool $unread_only
- * @param null|int $owner_uid
- * @return int
* @throws PDOException
*/
- static function _get_counters($feed, bool $is_cat = false, bool $unread_only = false, ?int $owner_uid = null): int {
+ static function _get_counters(int|string $feed, bool $is_cat = false, bool $unread_only = false, ?int $owner_uid = null): int {
$n_feed = (int) $feed;
$need_entries = false;
@@ -1157,7 +1152,7 @@ class Feeds extends Handler_Protected {
/**
* @return false|string false if the icon ID was unrecognized, otherwise, the icon identifier string
*/
- static function _get_icon(int $id) {
+ static function _get_icon(int $id): false|string {
switch ($id) {
case Feeds::FEED_ARCHIVED:
return "archive";
@@ -1183,7 +1178,7 @@ class Feeds extends Handler_Protected {
/**
* @return false|int false if the feed couldn't be found by URL+owner, otherwise the feed ID
*/
- static function _find_by_url(string $feed_url, int $owner_uid) {
+ static function _find_by_url(string $feed_url, int $owner_uid): false|int {
$feed = ORM::for_table('ttrss_feeds')
->where('owner_uid', $owner_uid)
->where('feed_url', $feed_url)
@@ -1201,7 +1196,7 @@ class Feeds extends Handler_Protected {
*
* @return false|int false if the category/feed couldn't be found by title, otherwise its ID
*/
- static function _find_by_title(string $title, bool $cat = false, int $owner_uid = 0) {
+ static function _find_by_title(string $title, bool $cat = false, int $owner_uid = 0): false|int {
if ($cat) {
$res = ORM::for_table('ttrss_feed_categories')
@@ -1222,10 +1217,7 @@ class Feeds extends Handler_Protected {
}
}
- /**
- * @param string|int $id
- */
- static function _get_title($id, bool $cat = false): string {
+ static function _get_title(int|string $id, bool $cat = false): string {
$pdo = Db::pdo();
if ($cat) {
diff --git a/classes/Labels.php b/classes/Labels.php
index 026e6621f..01b5d86a9 100644
--- a/classes/Labels.php
+++ b/classes/Labels.php
@@ -197,7 +197,7 @@ class Labels
/**
* @return false|int false if the check for an existing label failed, otherwise the number of rows inserted (1 on success)
*/
- static function create(string $caption, ?string $fg_color = '', ?string $bg_color = '', ?int $owner_uid = null) {
+ static function create(string $caption, ?string $fg_color = '', ?string $bg_color = '', ?int $owner_uid = null): false|int {
if (!$owner_uid) $owner_uid = $_SESSION['uid'];
diff --git a/classes/Mailer.php b/classes/Mailer.php
index 569b6cee2..b9bc40a07 100644
--- a/classes/Mailer.php
+++ b/classes/Mailer.php
@@ -6,7 +6,7 @@ class Mailer {
* @param array<string, mixed> $params
* @return bool|int bool if the default mail function handled the request, otherwise an int as described in Mailer#mail()
*/
- function mail(array $params) {
+ function mail(array $params): bool|int {
$to_name = $params["to_name"] ?? "";
$to_address = $params["to_address"];
diff --git a/classes/OPML.php b/classes/OPML.php
index 722312be6..fcc858de6 100644
--- a/classes/OPML.php
+++ b/classes/OPML.php
@@ -8,9 +8,9 @@ class OPML extends Handler_Protected {
}
/**
- * @return bool|int|void false if writing the file failed, true if printing succeeded, int if bytes were written to a file, or void if $owner_uid is missing
+ * @return bool|int|null false if writing the file failed, true if printing succeeded, int if bytes were written to a file, or null if $owner_uid is missing
*/
- function export() {
+ function export(): bool|int|null {
$output_name = sprintf("tt-rss_%s_%s.opml", $_SESSION["name"], date("Y-m-d"));
$include_settings = $_REQUEST["include_settings"] == "1";
$owner_uid = $_SESSION["uid"];
@@ -126,10 +126,10 @@ class OPML extends Handler_Protected {
}
/**
- * @return bool|int|void false if writing the file failed, true if printing succeeded, int if bytes were written to a file, or void if $owner_uid is missing
+ * @return bool|int|null false if writing the file failed, true if printing succeeded, int if bytes were written to a file, or null if $owner_uid is missing
*/
- function opml_export(string $filename, int $owner_uid, bool $hide_private_feeds = false, bool $include_settings = true, bool $file_output = false) {
- if (!$owner_uid) return;
+ function opml_export(string $filename, int $owner_uid, bool $hide_private_feeds = false, bool $include_settings = true, bool $file_output = false): bool|int|null {
+ if (!$owner_uid) return null;
if (!$file_output)
if (!isset($_REQUEST["debug"])) {
@@ -610,10 +610,10 @@ class OPML extends Handler_Protected {
/** $filename is optional; assumes HTTP upload with $_FILES otherwise */
/**
- * @return bool|void false on failure, true if successful, void if $owner_uid is missing
+ * @return bool|null false on failure, true if successful, null if $owner_uid is missing
*/
- function opml_import(int $owner_uid, string $filename = "") {
- if (!$owner_uid) return;
+ function opml_import(int $owner_uid, string $filename = ""): ?bool {
+ if (!$owner_uid) return null;
if (!$filename) {
if ($_FILES['opml_file']['error'] != 0) {
diff --git a/classes/PluginHost.php b/classes/PluginHost.php
index 608355158..cc81bc9c0 100644
--- a/classes/PluginHost.php
+++ b/classes/PluginHost.php
@@ -550,7 +550,7 @@ class PluginHost {
/**
* @return false|Plugin false if the handler couldn't be found, otherwise the Plugin/handler
*/
- function lookup_handler(string $handler, string $method) {
+ function lookup_handler(string $handler, string $method): false|Plugin {
$handler = str_replace("-", "_", strtolower($handler));
$method = strtolower($method);
@@ -579,7 +579,7 @@ class PluginHost {
/**
* @return false|Plugin false if the command couldn't be found, otherwise the registered Plugin
*/
- function lookup_command(string $command) {
+ function lookup_command(string $command): false|Plugin {
$command = "-" . strtolower($command);
if (array_key_exists($command, $this->commands)) {
@@ -730,7 +730,7 @@ class PluginHost {
* @param array<int|string, mixed> $default_value
* @return array<int|string, mixed>
*/
- function get_array(Plugin $sender, string $name, array $default_value = []) {
+ function get_array(Plugin $sender, string $name, array $default_value = []): array {
$tmp = $this->get($sender, $name);
if (!is_array($tmp)) $tmp = $default_value;
diff --git a/classes/Prefs.php b/classes/Prefs.php
index 8d84d5ec2..f7e6e39c0 100644
--- a/classes/Prefs.php
+++ b/classes/Prefs.php
@@ -164,10 +164,7 @@ class Prefs {
return isset(self::_DEFAULTS[$pref_name]);
}
- /**
- * @return bool|int|null|string
- */
- static function get_default(string $pref_name) {
+ static function get_default(string $pref_name): bool|int|null|string {
if (self::is_valid($pref_name))
return self::_DEFAULTS[$pref_name][0];
else
@@ -193,14 +190,14 @@ class Prefs {
/**
* @return array<int, array<string, bool|int|null|string>>
*/
- static function get_all(int $owner_uid, ?int $profile_id = null) {
+ static function get_all(int $owner_uid, ?int $profile_id = null): array {
return self::get_instance()->_get_all($owner_uid, $profile_id);
}
/**
* @return array<int, array<string, bool|int|null|string>>
*/
- private function _get_all(int $owner_uid, ?int $profile_id = null) {
+ private function _get_all(int $owner_uid, ?int $profile_id = null): array {
$rv = [];
$ref = new ReflectionClass(get_class($this));
@@ -247,17 +244,11 @@ class Prefs {
}
}
- /**
- * @return bool|int|null|string
- */
- static function get(string $pref_name, int $owner_uid, ?int $profile_id = null) {
+ static function get(string $pref_name, int $owner_uid, ?int $profile_id = null): bool|int|null|string {
return self::get_instance()->_get($pref_name, $owner_uid, $profile_id);
}
- /**
- * @return bool|int|null|string
- */
- private function _get(string $pref_name, int $owner_uid, ?int $profile_id) {
+ private function _get(string $pref_name, int $owner_uid, ?int $profile_id): bool|int|null|string {
if (isset(self::_DEFAULTS[$pref_name])) {
if (!$profile_id || in_array($pref_name, self::_PROFILE_BLACKLIST)) $profile_id = null;
@@ -298,34 +289,22 @@ class Prefs {
return isset($this->cache[$cache_key]);
}
- /**
- * @return bool|int|null|string
- */
- private function _get_cache(string $pref_name, int $owner_uid, ?int $profile_id) {
+ private function _get_cache(string $pref_name, int $owner_uid, ?int $profile_id): bool|int|null|string {
$cache_key = sprintf("%d/%d/%s", $owner_uid, $profile_id, $pref_name);
return $this->cache[$cache_key] ?? null;
}
- /**
- * @param bool|int|string $value
- */
- private function _set_cache(string $pref_name, $value, int $owner_uid, ?int $profile_id): void {
+ private function _set_cache(string $pref_name, bool|int|string $value, int $owner_uid, ?int $profile_id): void {
$cache_key = sprintf("%d/%d/%s", $owner_uid, $profile_id, $pref_name);
$this->cache[$cache_key] = $value;
}
- /**
- * @param bool|int|string $value
- */
- static function set(string $pref_name, $value, int $owner_uid, ?int $profile_id, bool $strip_tags = true): bool {
+ static function set(string $pref_name, bool|int|string $value, int $owner_uid, ?int $profile_id, bool $strip_tags = true): bool {
return self::get_instance()->_set($pref_name, $value, $owner_uid, $profile_id);
}
- /**
- * @param bool|int|string $value
- */
- private function _set(string $pref_name, $value, int $owner_uid, ?int $profile_id, bool $strip_tags = true): bool {
+ private function _set(string $pref_name, bool|int|string $value, int $owner_uid, ?int $profile_id, bool $strip_tags = true): bool {
if (!$profile_id) $profile_id = null;
if ($profile_id && in_array($pref_name, self::_PROFILE_BLACKLIST))
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index 281e85bff..97b52c9aa 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -1785,10 +1785,7 @@ class RSSUtils {
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING);
}
- /**
- * @return false|string
- */
- static function update_favicon(string $site_url, int $feed) {
+ static function update_favicon(string $site_url, int $feed): false|string {
$favicon_urls = self::get_favicon_urls($site_url);
if (count($favicon_urls) == 0) {
@@ -1983,7 +1980,7 @@ class RSSUtils {
* @access public
* @return false|string The favicon URL string, or false if none was found.
*/
- static function get_favicon_url(string $url) {
+ static function get_favicon_url(string $url): false|string {
$favicon_urls = self::get_favicon_urls($url);
diff --git a/classes/Sanitizer.php b/classes/Sanitizer.php
index efed9d418..20ca72dc8 100644
--- a/classes/Sanitizer.php
+++ b/classes/Sanitizer.php
@@ -64,7 +64,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): false|string {
if (!$owner && isset($_SESSION["uid"]))
$owner = $_SESSION["uid"];
diff --git a/classes/Sessions.php b/classes/Sessions.php
index 08c6b5855..c54815b0f 100644
--- a/classes/Sessions.php
+++ b/classes/Sessions.php
@@ -53,12 +53,8 @@ class Sessions implements \SessionHandlerInterface {
return true;
}
- /**
- * @todo set return type to string|false, and remove ReturnTypeWillChange, when min supported is PHP 8
- * @return string|false
- */
#[\ReturnTypeWillChange]
- public function read(string $id) {
+ public function read(string $id): false|string {
$sth = Db::pdo()->prepare('SELECT data FROM ttrss_sessions WHERE id=?');
$sth->execute([$id]);
@@ -95,11 +91,10 @@ class Sessions implements \SessionHandlerInterface {
}
/**
- * @todo set return type to int|false, and remove ReturnTypeWillChange, when min supported is PHP 8
* @return int|false the number of deleted sessions on success, or false on failure
*/
#[\ReturnTypeWillChange]
- public function gc(int $max_lifetime) {
+ public function gc(int $max_lifetime): false|int {
$result = Db::pdo()->query('DELETE FROM ttrss_sessions WHERE expire < ' . time());
return $result === false ? false : $result->rowCount();
}
diff --git a/classes/UrlHelper.php b/classes/UrlHelper.php
index bd9eff71d..add3d7d6b 100644
--- a/classes/UrlHelper.php
+++ b/classes/UrlHelper.php
@@ -65,7 +65,7 @@ class UrlHelper {
$rel_url,
string $owner_element = "",
string $owner_attribute = "",
- string $content_type = "") {
+ string $content_type = ""): false|string {
$rel_parts = parse_url($rel_url);
@@ -136,7 +136,7 @@ class UrlHelper {
/** extended filtering involves validation for safe ports and loopback
* @return false|string false if something went wrong, otherwise the URL string
*/
- static function validate(string $url, bool $extended_filtering = false) {
+ static function validate(string $url, bool $extended_filtering = false): false|string {
$url = clean($url);
@@ -198,10 +198,7 @@ class UrlHelper {
return $url;
}
- /**
- * @return false|string
- */
- static function resolve_redirects(string $url, int $timeout) {
+ static function resolve_redirects(string $url, int $timeout): false|string {
$client = self::get_client();
try {
@@ -230,9 +227,9 @@ class UrlHelper {
*/
// TODO: max_size currently only works for CURL transfers
// TODO: multiple-argument way is deprecated, first parameter is a hash now
- public static function fetch($options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false,
+ public static function fetch(array|string $options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false,
4: $post_query = false, 5: $timeout = false, 6: $timestamp = 0, 7: $useragent = false, 8: $encoding = false,
- 9: $auth_type = "basic" */) {
+ 9: $auth_type = "basic" */): false|string {
self::$fetch_last_error = "";
self::$fetch_last_error_code = -1;
@@ -455,7 +452,7 @@ class UrlHelper {
/**
* @return false|string false if the provided URL didn't match expected patterns, otherwise the video ID string
*/
- public static function url_to_youtube_vid(string $url) {
+ public static function url_to_youtube_vid(string $url): false|string {
$url = str_replace("youtube.com", "youtube-nocookie.com", $url);
$regexps = [
diff --git a/classes/UserHelper.php b/classes/UserHelper.php
index aa2d4ce19..21c2ab4d5 100644
--- a/classes/UserHelper.php
+++ b/classes/UserHelper.php
@@ -370,7 +370,6 @@ class UserHelper {
/**
* @param null|int $owner_uid if null, checks current user via session-specific auth module, if set works on internal database only
- * @return bool
* @throws PDOException
* @throws Exception
*/
@@ -383,7 +382,7 @@ class UserHelper {
*
* @return false|string False if the password couldn't be hashed, otherwise the hash string.
*/
- static function hash_password(string $pass, string $salt, string $algo = self::HASH_ALGOS[0]) {
+ static function hash_password(string $pass, string $salt, string $algo = self::HASH_ALGOS[0]): false|string {
$pass_hash = "";
switch ($algo) {
@@ -498,7 +497,6 @@ class UserHelper {
/**
* @param null|int $owner_uid if null, checks current user via session-specific auth module, if set works on internal database only
* @param string $password password to compare hash against
- * @return bool
*/
static function user_has_password(?int $owner_uid, string $password) : bool {
if ($owner_uid) {