From: Hypolite Petovan Date: Sat, 16 Oct 2021 23:06:43 +0000 (-0400) Subject: Improve argument handling in Core\Worker::add X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f80478f2627f8459cdf64d8bb15272a44fff3758;p=friendica.git Improve argument handling in Core\Worker::add - The argument name made it unclear the first argument is supposed to be a priority number --- diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 3519ce3e51..0431c79521 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -1199,10 +1199,8 @@ class Worker * array $arr * */ - public static function add($cmd) + public static function add(...$args) { - $args = func_get_args(); - if (!count($args)) { return 0; } @@ -1241,6 +1239,8 @@ class Worker if (isset($run_parameter['force_priority'])) { $force_priority = $run_parameter['force_priority']; } + } else { + throw new \InvalidArgumentException('Priority number or task parameter array expected as first argument'); } $command = array_shift($args);