summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-11-16 18:35:13 +0300
committerAndrew Dolgov <[email protected]>2021-11-16 18:35:13 +0300
commit5980b3d2cb5ad8b0689ae731f405fa0b2c9d6586 (patch)
treebd17a5240d4bfb1cd4e527be1af0e2d7c34883a4 /classes
parent10d1a8c05aba9f6c66021e3708ac6aa2ba714a2e (diff)
pluginhost: set stricter @params
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/pluginhost.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 83868514c..f89cc5c32 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -263,6 +263,7 @@ class PluginHost {
}
/**
+ * @param PluginHost::HOOK_* $hook
* @param mixed $args
*/
function run_hooks(string $hook, ...$args): void {
@@ -282,6 +283,7 @@ class PluginHost {
}
/**
+ * @param PluginHost::HOOK_* $hook
* @param mixed $args
* @param mixed $check
*/
@@ -306,6 +308,7 @@ class PluginHost {
}
/**
+ * @param PluginHost::HOOK_* $hook
* @param mixed $args
*/
function run_hooks_callback(string $hook, Closure $callback, ...$args): void {
@@ -326,6 +329,7 @@ class PluginHost {
}
/**
+ * @param PluginHost::HOOK_* $hook
* @param mixed $args
*/
function chain_hooks_callback(string $hook, Closure $callback, &...$args): void {
@@ -345,6 +349,9 @@ class PluginHost {
}
}
+ /**
+ * @param PluginHost::HOOK_* $type
+ */
function add_hook(string $type, Plugin $sender, int $priority = 50): void {
$priority = (int) $priority;
@@ -369,6 +376,9 @@ class PluginHost {
ksort($this->hooks[$type]);
}
+ /**
+ * @param PluginHost::HOOK_* $type
+ */
function del_hook(string $type, Plugin $sender): void {
if (is_array($this->hooks[$type])) {
foreach (array_keys($this->hooks[$type]) as $prio) {
@@ -382,6 +392,7 @@ class PluginHost {
}
/**
+ * @param PluginHost::HOOK_* $type
* @return array<int, Plugin>
*/
function get_hooks(string $type) {
@@ -396,6 +407,10 @@ class PluginHost {
}
return [];
}
+
+ /**
+ * @param PluginHost::KIND_* $kind
+ */
function load_all(int $kind, int $owner_uid = null, bool $skip_init = false): void {
$plugins = array_merge(glob("plugins/*"), glob("plugins.local/*"));
@@ -407,6 +422,9 @@ class PluginHost {
$this->load(join(",", $plugins), $kind, $owner_uid, $skip_init);
}
+ /**
+ * @param PluginHost::KIND_* $kind
+ */
function load(string $classlist, int $kind, int $owner_uid = null, bool $skip_init = false): void {
$plugins = explode(",", $classlist);