summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorwn_ <[email protected]>2022-08-12 15:31:19 +0000
committerwn_ <[email protected]>2022-08-12 17:58:38 +0000
commit3487c922b3f34449fecdddebe1fd2ee3b8c42e65 (patch)
tree57b18bf1a6ec210aa26a80cf1f2d2fdf0888f5da /classes/pluginhost.php
parenta63c949a5522a8fdeae2dfa77bb39565727f7a0a (diff)
Replace use of 'array_merge' with the spread operator and 'array_push' in various places.
This isn't supported for arrays with string keys until PHP 8.1. https://wiki.php.net/rfc/spread_operator_for_array
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-xclasses/pluginhost.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 4c71d0cef..acc784902 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -405,7 +405,7 @@ class PluginHost {
$tmp = [];
foreach (array_keys($this->hooks[$type]) as $prio) {
- $tmp = array_merge($tmp, $this->hooks[$type][$prio]);
+ array_push($tmp, ...$this->hooks[$type][$prio]);
}
return $tmp;
@@ -418,7 +418,7 @@ class PluginHost {
*/
function load_all(int $kind, int $owner_uid = null, bool $skip_init = false): void {
- $plugins = array_merge(glob("plugins/*"), glob("plugins.local/*"));
+ $plugins = [...(glob("plugins/*") ?: []), ...(glob("plugins.local/*") ?: [])];
$plugins = array_filter($plugins, "is_dir");
$plugins = array_map("basename", $plugins);