1
0
Fork 0

Improve argument handling in Core\Worker::add

- The argument name made it unclear the first argument is supposed to be a priority number
This commit is contained in:
Hypolite Petovan 2021-10-16 19:06:43 -04:00
parent 45fc6759b8
commit f80478f262

View file

@ -1199,10 +1199,8 @@ class Worker
* array $arr * array $arr
* *
*/ */
public static function add($cmd) public static function add(...$args)
{ {
$args = func_get_args();
if (!count($args)) { if (!count($args)) {
return 0; return 0;
} }
@ -1241,6 +1239,8 @@ class Worker
if (isset($run_parameter['force_priority'])) { if (isset($run_parameter['force_priority'])) {
$force_priority = $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); $command = array_shift($args);