Skip to content

Commit

Permalink
return this from set default init task
Browse files Browse the repository at this point in the history
  • Loading branch information
matthi4s committed Dec 12, 2023
1 parent 2875a4f commit d3a854b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Taskmaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,15 +592,17 @@ public function setDefaultInitTaskFactory(?TaskFactoryInterface $initTaskFactory
* a class name, a new instance of the class will be created for each worker instance.
*
* @param TaskInterface|class-string<TaskInterface> $task
* @return void
* @return $this
*/
public function setDefaultInitTask(TaskInterface|string $task): void
public function setDefaultInitTask(TaskInterface|string $task): static
{
if (is_string($task)) {
$this->initTaskFactory = new InstanceTaskFactory($task);
} else {
$this->initTaskFactory = new CloneTaskFactory($task);
}

return $this;
}

/**
Expand Down

0 comments on commit d3a854b

Please sign in to comment.