1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-15 07:25:55 +00:00

rework previous Plugin changes as phpdoc annotations

This commit is contained in:
Andrew Dolgov
2021-11-13 19:41:50 +03:00
parent 9845d5fd15
commit 37827427a2

View File

@@ -5,6 +5,11 @@ abstract class Plugin {
/** @var PDO $pdo */ /** @var PDO $pdo */
protected $pdo; protected $pdo;
/**
* @param PluginHost $host
*
* @return void
* */
abstract function init($host); abstract function init($host);
/** @return array<float|string|bool> */ /** @return array<float|string|bool> */
@@ -23,38 +28,60 @@ abstract class Plugin {
return array(); return array();
} }
/**
* @param string $method
*
* @return bool */
function is_public_method($method) { function is_public_method($method) {
return false; return false;
} }
/**
* @param string $method
*
* @return bool */
function csrf_ignore($method) { function csrf_ignore($method) {
return false; return false;
} }
/** @return string */
function get_js() { function get_js() {
return ""; return "";
} }
/** @return string */
function get_prefs_js() { function get_prefs_js() {
return ""; return "";
} }
/** @return int */
function api_version() { function api_version() {
return Plugin::API_VERSION_COMPAT; return Plugin::API_VERSION_COMPAT;
} }
/* gettext-related helpers */ /* gettext-related helpers */
/**
* @param string $msgid
*
* @return string */
function __($msgid) { function __($msgid) {
/** @var Plugin $this -- this is a strictly template-related hack */ /** @var Plugin $this -- this is a strictly template-related hack */
return _dgettext(PluginHost::object_to_domain($this), $msgid); return _dgettext(PluginHost::object_to_domain($this), $msgid);
} }
/**
* @param string $singular
* @param string $plural
* @param int $number
*
* @return string */
function _ngettext($singular, $plural, $number) { function _ngettext($singular, $plural, $number) {
/** @var Plugin $this -- this is a strictly template-related hack */ /** @var Plugin $this -- this is a strictly template-related hack */
return _dngettext(PluginHost::object_to_domain($this), $singular, $plural, $number); return _dngettext(PluginHost::object_to_domain($this), $singular, $plural, $number);
} }
/** @return string */
function T_sprintf() { function T_sprintf() {
$args = func_get_args(); $args = func_get_args();
$msgid = array_shift($args); $msgid = array_shift($args);