Fixing bug related to possible re-define of tasks
Publish PHP Package / docker (push) Successful in 9s Details

This commit is contained in:
Pavel Shevaev 2025-03-03 15:39:36 +03:00
parent 37c915e72e
commit 4cf34b0dba
1 changed files with 4 additions and 4 deletions

View File

@ -293,11 +293,7 @@ function _get_task_candidates()
//get tasks defined as closures
foreach($TASKMAN_CLOSURES as $name => $args)
{
if(isset($cands[$name]))
throw new Exception("Task '$name' is already defined");
$cands[$name] = $args;
}
ksort($cands);
@ -385,6 +381,10 @@ function task($name)
{
global $TASKMAN_CLOSURES;
//TODO: can it be a feature?
if(isset($TASKMAN_CLOSURES[$name]))
throw new TaskmanException("Task '$name' is already defined");
$args = func_get_args();
$TASKMAN_CLOSURES[$name] = $args;
}