diff --git a/src/pocketmine/Collectable.php b/src/pocketmine/Collectable.php index ece56bb0b..238cfcfe6 100644 --- a/src/pocketmine/Collectable.php +++ b/src/pocketmine/Collectable.php @@ -32,6 +32,9 @@ abstract class Collectable extends \Threaded{ return $this->isGarbage; } + /** + * @return void + */ public function setGarbage(){ $this->isGarbage = true; } diff --git a/src/pocketmine/CrashDump.php b/src/pocketmine/CrashDump.php index 86e335ed4..530a8d7a8 100644 --- a/src/pocketmine/CrashDump.php +++ b/src/pocketmine/CrashDump.php @@ -137,6 +137,9 @@ class CrashDump{ return $this->path; } + /** + * @return string + */ public function getEncodedData(){ return $this->encodedData; } @@ -345,6 +348,8 @@ class CrashDump{ /** * @param string $line + * + * @return void */ public function addLine($line = ""){ fwrite($this->fp, $line . PHP_EOL); @@ -352,6 +357,8 @@ class CrashDump{ /** * @param string $str + * + * @return void */ public function add($str){ fwrite($this->fp, $str); diff --git a/src/pocketmine/IPlayer.php b/src/pocketmine/IPlayer.php index bc0e8bc9d..8ea9ba59b 100644 --- a/src/pocketmine/IPlayer.php +++ b/src/pocketmine/IPlayer.php @@ -44,6 +44,8 @@ interface IPlayer extends ServerOperator{ /** * @param bool $banned + * + * @return void */ public function setBanned(bool $banned); @@ -54,6 +56,8 @@ interface IPlayer extends ServerOperator{ /** * @param bool $value + * + * @return void */ public function setWhitelisted(bool $value); diff --git a/src/pocketmine/MemoryManager.php b/src/pocketmine/MemoryManager.php index 52e650a35..7ae331184 100644 --- a/src/pocketmine/MemoryManager.php +++ b/src/pocketmine/MemoryManager.php @@ -115,7 +115,7 @@ class MemoryManager{ $this->init(); } - private function init(){ + private function init() : void{ $this->memoryLimit = ((int) $this->server->getProperty("memory.main-limit", 0)) * 1024 * 1024; $defaultMemory = 1024; @@ -201,6 +201,8 @@ class MemoryManager{ * @param int $limit * @param bool $global * @param int $triggerCount + * + * @return void */ public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0){ $this->server->getLogger()->debug(sprintf("[Memory Manager] %sLow memory triggered, limit %gMB, using %gMB", @@ -230,6 +232,8 @@ class MemoryManager{ /** * Called every tick to update the memory manager state. + * + * @return void */ public function check(){ Timings::$memoryManagerTimer->startTiming(); @@ -297,6 +301,8 @@ class MemoryManager{ * @param string $outputFolder * @param int $maxNesting * @param int $maxStringSize + * + * @return void */ public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize){ $this->server->getLogger()->notice("[Dump] After the memory dump is done, the server might crash"); @@ -319,6 +325,7 @@ class MemoryManager{ * @param int $maxStringSize * @param \Logger $logger * + * @return void * @throws \ReflectionException */ public static function dumpMemory($startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger){ @@ -479,7 +486,7 @@ class MemoryManager{ * @param int $maxNesting * @param int $maxStringSize */ - private static function continueDump($from, &$data, array &$objects, array &$refCounts, int $recursion, int $maxNesting, int $maxStringSize){ + private static function continueDump($from, &$data, array &$objects, array &$refCounts, int $recursion, int $maxNesting, int $maxStringSize) : void{ if($maxNesting <= 0){ $data = "(error) NESTING LIMIT REACHED"; return; diff --git a/src/pocketmine/OfflinePlayer.php b/src/pocketmine/OfflinePlayer.php index 0e631ee62..18702bc92 100644 --- a/src/pocketmine/OfflinePlayer.php +++ b/src/pocketmine/OfflinePlayer.php @@ -57,6 +57,9 @@ class OfflinePlayer implements IPlayer, Metadatable{ return $this->name; } + /** + * @return Server + */ public function getServer(){ return $this->server; } diff --git a/src/pocketmine/Thread.php b/src/pocketmine/Thread.php index 00b76b125..c6a335a2e 100644 --- a/src/pocketmine/Thread.php +++ b/src/pocketmine/Thread.php @@ -36,10 +36,18 @@ abstract class Thread extends \Thread{ /** @var bool */ protected $isKilled = false; + /** + * @return \ClassLoader|null + */ public function getClassLoader(){ return $this->classLoader; } + /** + * @param \ClassLoader|null $loader + * + * @return void + */ public function setClassLoader(\ClassLoader $loader = null){ $this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH; @@ -55,6 +63,8 @@ abstract class Thread extends \Thread{ * WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable. * If you do not do this, you will not be able to use new classes that were not loaded when the thread was started * (unless you are using a custom autoloader). + * + * @return void */ public function registerClassLoader(){ if($this->composerAutoloaderPath !== null){ @@ -65,6 +75,11 @@ abstract class Thread extends \Thread{ } } + /** + * @param int|null $options TODO: pthreads bug + * + * @return bool + */ public function start(?int $options = \PTHREADS_INHERIT_ALL){ ThreadManager::getInstance()->add($this); @@ -76,6 +91,8 @@ abstract class Thread extends \Thread{ /** * Stops the thread using the best way possible. Try to stop it yourself before calling this. + * + * @return void */ public function quit(){ $this->isKilled = true; diff --git a/src/pocketmine/ThreadManager.php b/src/pocketmine/ThreadManager.php index e90d598d6..b84f6509a 100644 --- a/src/pocketmine/ThreadManager.php +++ b/src/pocketmine/ThreadManager.php @@ -31,6 +31,9 @@ class ThreadManager extends \Volatile{ /** @var ThreadManager */ private static $instance = null; + /** + * @return void + */ public static function init(){ self::$instance = new ThreadManager(); } @@ -44,6 +47,8 @@ class ThreadManager extends \Volatile{ /** * @param Worker|Thread $thread + * + * @return void */ public function add($thread){ if($thread instanceof Thread or $thread instanceof Worker){ @@ -53,6 +58,8 @@ class ThreadManager extends \Volatile{ /** * @param Worker|Thread $thread + * + * @return void */ public function remove($thread){ if($thread instanceof Thread or $thread instanceof Worker){ diff --git a/src/pocketmine/Worker.php b/src/pocketmine/Worker.php index a8b843dba..ab5c81b50 100644 --- a/src/pocketmine/Worker.php +++ b/src/pocketmine/Worker.php @@ -36,10 +36,18 @@ abstract class Worker extends \Worker{ /** @var bool */ protected $isKilled = false; + /** + * @return \ClassLoader|null + */ public function getClassLoader(){ return $this->classLoader; } + /** + * @param \ClassLoader|null $loader + * + * @return void + */ public function setClassLoader(\ClassLoader $loader = null){ $this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH; @@ -55,6 +63,8 @@ abstract class Worker extends \Worker{ * WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable. * If you do not do this, you will not be able to use new classes that were not loaded when the thread was started * (unless you are using a custom autoloader). + * + * @return void */ public function registerClassLoader(){ if($this->composerAutoloaderPath !== null){ @@ -65,6 +75,11 @@ abstract class Worker extends \Worker{ } } + /** + * @param int|null $options TODO: pthreads bug + * + * @return bool + */ public function start(?int $options = \PTHREADS_INHERIT_ALL){ ThreadManager::getInstance()->add($this); @@ -76,6 +91,8 @@ abstract class Worker extends \Worker{ /** * Stops the thread using the best way possible. Try to stop it yourself before calling this. + * + * @return void */ public function quit(){ $this->isKilled = true;