From 1742fb65c53a2a6cd6a310d225add25ee20c14b6 Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 10 Dec 2024 18:58:17 +0000 Subject: Use the spread operator instead of 'array_merge' in more places. PHP 8.1 introduced support for merging string-key arrays (last array with a wins). --- classes/PluginHost.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'classes/PluginHost.php') diff --git a/classes/PluginHost.php b/classes/PluginHost.php index cc81bc9c0..9a8fa32c2 100644 --- a/classes/PluginHost.php +++ b/classes/PluginHost.php @@ -851,14 +851,12 @@ class PluginHost { */ function get_method_url(Plugin $sender, string $method, array $params = []): string { return Config::get_self_url() . "/backend.php?" . - http_build_query( - array_merge( - [ - "op" => "pluginhandler", - "plugin" => strtolower(get_class($sender)), - "method" => $method - ], - $params)); + http_build_query([ + 'op' => 'pluginhandler', + 'plugin' => strtolower(get_class($sender)), + 'method' => $method, + ...$params, + ]); } // shortcut syntax (disabled for now) @@ -880,12 +878,10 @@ class PluginHost { function get_public_method_url(Plugin $sender, string $method, array $params = []): ?string { if ($sender->is_public_method($method)) { return Config::get_self_url() . "/public.php?" . - http_build_query( - array_merge( - [ - "op" => strtolower(get_class($sender) . self::PUBLIC_METHOD_DELIMITER . $method), - ], - $params)); + http_build_query([ + 'op' => strtolower(get_class($sender) . self::PUBLIC_METHOD_DELIMITER . $method), + ...$params, + ]); } user_error("get_public_method_url: requested method '$method' of '" . get_class($sender) . "' is private."); return null; -- cgit v1.2.3-54-g00ecf