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:
parent
45fc6759b8
commit
f80478f262
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue