diff --git a/src/pocketmine/scheduler/AsyncTask.php b/src/pocketmine/scheduler/AsyncTask.php index cf35248692..410c7a3734 100644 --- a/src/pocketmine/scheduler/AsyncTask.php +++ b/src/pocketmine/scheduler/AsyncTask.php @@ -71,6 +71,9 @@ abstract class AsyncTask extends Collectable{ /** @var bool */ private $crashed = false; + /** + * @return void + */ public function run(){ $this->result = null; @@ -97,6 +100,9 @@ abstract class AsyncTask extends Collectable{ return $this->serialized ? unserialize($this->result) : $this->result; } + /** + * @return void + */ public function cancelRun(){ $this->cancelRun = true; } @@ -114,11 +120,18 @@ abstract class AsyncTask extends Collectable{ /** * @param mixed $result + * + * @return void */ public function setResult($result){ $this->result = ($this->serialized = !is_scalar($result)) ? serialize($result) : $result; } + /** + * @param int $taskId + * + * @return void + */ public function setTaskId(int $taskId){ $this->taskId = $taskId; } @@ -149,6 +162,8 @@ abstract class AsyncTask extends Collectable{ * * @param string $identifier * @param mixed $value + * + * @return void */ public function saveToThreadStore(string $identifier, $value){ if($this->worker === null or $this->isGarbage()){ @@ -161,6 +176,8 @@ abstract class AsyncTask extends Collectable{ * @see AsyncWorker::removeFromThreadStore() * * @param string $identifier + * + * @return void */ public function removeFromThreadStore(string $identifier) : void{ if($this->worker === null or $this->isGarbage()){ @@ -193,6 +210,8 @@ abstract class AsyncTask extends Collectable{ * {@link AsyncTask::onProgressUpdate} from the main thread with the given progress parameter. * * @param mixed $progress A value that can be safely serialize()'ed. + * + * @return void */ public function publishProgress($progress){ $this->progressUpdates[] = serialize($progress); @@ -202,6 +221,8 @@ abstract class AsyncTask extends Collectable{ * @internal Only call from AsyncPool.php on the main thread * * @param Server $server + * + * @return void */ public function checkProgressUpdates(Server $server){ while($this->progressUpdates->count() !== 0){ @@ -218,6 +239,8 @@ abstract class AsyncTask extends Collectable{ * @param Server $server * @param mixed $progress The parameter passed to {@link AsyncTask::publishProgress}. It is serialize()'ed * and then unserialize()'ed, as if it has been cloned. + * + * @return void */ public function onProgressUpdate(Server $server, $progress){ @@ -237,6 +260,7 @@ abstract class AsyncTask extends Collectable{ * * @param mixed $complexData the data to store * + * @return void * @throws \BadMethodCallException if called from any thread except the main thread */ protected function storeLocal($complexData){ diff --git a/src/pocketmine/scheduler/AsyncWorker.php b/src/pocketmine/scheduler/AsyncWorker.php index 69400a379d..d859634112 100644 --- a/src/pocketmine/scheduler/AsyncWorker.php +++ b/src/pocketmine/scheduler/AsyncWorker.php @@ -49,6 +49,9 @@ class AsyncWorker extends Worker{ $this->memoryLimit = $memoryLimit; } + /** + * @return void + */ public function run(){ error_reporting(-1); @@ -76,6 +79,9 @@ class AsyncWorker extends Worker{ return $this->logger; } + /** + * @return void + */ public function handleException(\Throwable $e){ $this->logger->logException($e); } diff --git a/src/pocketmine/scheduler/Task.php b/src/pocketmine/scheduler/Task.php index f2ad1d862d..560a72f604 100644 --- a/src/pocketmine/scheduler/Task.php +++ b/src/pocketmine/scheduler/Task.php @@ -54,6 +54,8 @@ abstract class Task{ /** * @param TaskHandler|null $taskHandler + * + * @return void */ final public function setHandler(TaskHandler $taskHandler = null){ if($this->taskHandler === null or $taskHandler === null){ @@ -72,6 +74,8 @@ abstract class Task{ /** * Actions to execute if the Task is cancelled + * + * @return void */ public function onCancel(){ diff --git a/src/pocketmine/scheduler/TaskHandler.php b/src/pocketmine/scheduler/TaskHandler.php index e2188af1e5..8e8305d191 100644 --- a/src/pocketmine/scheduler/TaskHandler.php +++ b/src/pocketmine/scheduler/TaskHandler.php @@ -88,6 +88,8 @@ class TaskHandler{ /** * @param int $ticks + * + * @return void */ public function setNextRun(int $ticks){ $this->nextRun = $ticks; @@ -135,6 +137,9 @@ class TaskHandler{ return $this->period; } + /** + * @return void + */ public function cancel(){ try{ if(!$this->isCancelled()){ @@ -145,6 +150,9 @@ class TaskHandler{ } } + /** + * @return void + */ public function remove(){ $this->cancelled = true; $this->task->setHandler(null); @@ -152,6 +160,8 @@ class TaskHandler{ /** * @param int $currentTick + * + * @return void */ public function run(int $currentTick){ $this->timings->startTiming(); diff --git a/src/pocketmine/scheduler/TaskScheduler.php b/src/pocketmine/scheduler/TaskScheduler.php index c8581d6788..cea28c0251 100644 --- a/src/pocketmine/scheduler/TaskScheduler.php +++ b/src/pocketmine/scheduler/TaskScheduler.php @@ -103,6 +103,8 @@ class TaskScheduler{ /** * @param int $taskId + * + * @return void */ public function cancelTask(int $taskId){ if(isset($this->tasks[$taskId])){ @@ -114,6 +116,9 @@ class TaskScheduler{ } } + /** + * @return void + */ public function cancelAllTasks(){ foreach($this->tasks as $id => $task){ $this->cancelTask($id); @@ -186,6 +191,8 @@ class TaskScheduler{ /** * @param int $currentTick + * + * @return void */ public function mainThreadHeartbeat(int $currentTick){ $this->currentTick = $currentTick;