mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 12:55:21 +00:00
pocketmine root: sweep missing return type information
This commit is contained in:
parent
e8a5fa8a37
commit
ea935a1af5
@ -32,6 +32,9 @@ abstract class Collectable extends \Threaded{
|
|||||||
return $this->isGarbage;
|
return $this->isGarbage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function setGarbage(){
|
public function setGarbage(){
|
||||||
$this->isGarbage = true;
|
$this->isGarbage = true;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,9 @@ class CrashDump{
|
|||||||
return $this->path;
|
return $this->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getEncodedData(){
|
public function getEncodedData(){
|
||||||
return $this->encodedData;
|
return $this->encodedData;
|
||||||
}
|
}
|
||||||
@ -345,6 +348,8 @@ class CrashDump{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $line
|
* @param string $line
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addLine($line = ""){
|
public function addLine($line = ""){
|
||||||
fwrite($this->fp, $line . PHP_EOL);
|
fwrite($this->fp, $line . PHP_EOL);
|
||||||
@ -352,6 +357,8 @@ class CrashDump{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $str
|
* @param string $str
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function add($str){
|
public function add($str){
|
||||||
fwrite($this->fp, $str);
|
fwrite($this->fp, $str);
|
||||||
|
@ -44,6 +44,8 @@ interface IPlayer extends ServerOperator{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $banned
|
* @param bool $banned
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setBanned(bool $banned);
|
public function setBanned(bool $banned);
|
||||||
|
|
||||||
@ -54,6 +56,8 @@ interface IPlayer extends ServerOperator{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $value
|
* @param bool $value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setWhitelisted(bool $value);
|
public function setWhitelisted(bool $value);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class MemoryManager{
|
|||||||
$this->init();
|
$this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function init(){
|
private function init() : void{
|
||||||
$this->memoryLimit = ((int) $this->server->getProperty("memory.main-limit", 0)) * 1024 * 1024;
|
$this->memoryLimit = ((int) $this->server->getProperty("memory.main-limit", 0)) * 1024 * 1024;
|
||||||
|
|
||||||
$defaultMemory = 1024;
|
$defaultMemory = 1024;
|
||||||
@ -201,6 +201,8 @@ class MemoryManager{
|
|||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @param bool $global
|
* @param bool $global
|
||||||
* @param int $triggerCount
|
* @param int $triggerCount
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0){
|
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",
|
$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.
|
* Called every tick to update the memory manager state.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function check(){
|
public function check(){
|
||||||
Timings::$memoryManagerTimer->startTiming();
|
Timings::$memoryManagerTimer->startTiming();
|
||||||
@ -297,6 +301,8 @@ class MemoryManager{
|
|||||||
* @param string $outputFolder
|
* @param string $outputFolder
|
||||||
* @param int $maxNesting
|
* @param int $maxNesting
|
||||||
* @param int $maxStringSize
|
* @param int $maxStringSize
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize){
|
public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize){
|
||||||
$this->server->getLogger()->notice("[Dump] After the memory dump is done, the server might crash");
|
$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 int $maxStringSize
|
||||||
* @param \Logger $logger
|
* @param \Logger $logger
|
||||||
*
|
*
|
||||||
|
* @return void
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function dumpMemory($startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger){
|
public static function dumpMemory($startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger){
|
||||||
@ -479,7 +486,7 @@ class MemoryManager{
|
|||||||
* @param int $maxNesting
|
* @param int $maxNesting
|
||||||
* @param int $maxStringSize
|
* @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){
|
if($maxNesting <= 0){
|
||||||
$data = "(error) NESTING LIMIT REACHED";
|
$data = "(error) NESTING LIMIT REACHED";
|
||||||
return;
|
return;
|
||||||
|
@ -57,6 +57,9 @@ class OfflinePlayer implements IPlayer, Metadatable{
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Server
|
||||||
|
*/
|
||||||
public function getServer(){
|
public function getServer(){
|
||||||
return $this->server;
|
return $this->server;
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,18 @@ abstract class Thread extends \Thread{
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $isKilled = false;
|
protected $isKilled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \ClassLoader|null
|
||||||
|
*/
|
||||||
public function getClassLoader(){
|
public function getClassLoader(){
|
||||||
return $this->classLoader;
|
return $this->classLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \ClassLoader|null $loader
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function setClassLoader(\ClassLoader $loader = null){
|
public function setClassLoader(\ClassLoader $loader = null){
|
||||||
$this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH;
|
$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.
|
* 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
|
* 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).
|
* (unless you are using a custom autoloader).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function registerClassLoader(){
|
public function registerClassLoader(){
|
||||||
if($this->composerAutoloaderPath !== null){
|
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){
|
public function start(?int $options = \PTHREADS_INHERIT_ALL){
|
||||||
ThreadManager::getInstance()->add($this);
|
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.
|
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function quit(){
|
public function quit(){
|
||||||
$this->isKilled = true;
|
$this->isKilled = true;
|
||||||
|
@ -31,6 +31,9 @@ class ThreadManager extends \Volatile{
|
|||||||
/** @var ThreadManager */
|
/** @var ThreadManager */
|
||||||
private static $instance = null;
|
private static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public static function init(){
|
public static function init(){
|
||||||
self::$instance = new ThreadManager();
|
self::$instance = new ThreadManager();
|
||||||
}
|
}
|
||||||
@ -44,6 +47,8 @@ class ThreadManager extends \Volatile{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Worker|Thread $thread
|
* @param Worker|Thread $thread
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function add($thread){
|
public function add($thread){
|
||||||
if($thread instanceof Thread or $thread instanceof Worker){
|
if($thread instanceof Thread or $thread instanceof Worker){
|
||||||
@ -53,6 +58,8 @@ class ThreadManager extends \Volatile{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Worker|Thread $thread
|
* @param Worker|Thread $thread
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function remove($thread){
|
public function remove($thread){
|
||||||
if($thread instanceof Thread or $thread instanceof Worker){
|
if($thread instanceof Thread or $thread instanceof Worker){
|
||||||
|
@ -36,10 +36,18 @@ abstract class Worker extends \Worker{
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $isKilled = false;
|
protected $isKilled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \ClassLoader|null
|
||||||
|
*/
|
||||||
public function getClassLoader(){
|
public function getClassLoader(){
|
||||||
return $this->classLoader;
|
return $this->classLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \ClassLoader|null $loader
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function setClassLoader(\ClassLoader $loader = null){
|
public function setClassLoader(\ClassLoader $loader = null){
|
||||||
$this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH;
|
$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.
|
* 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
|
* 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).
|
* (unless you are using a custom autoloader).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function registerClassLoader(){
|
public function registerClassLoader(){
|
||||||
if($this->composerAutoloaderPath !== null){
|
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){
|
public function start(?int $options = \PTHREADS_INHERIT_ALL){
|
||||||
ThreadManager::getInstance()->add($this);
|
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.
|
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function quit(){
|
public function quit(){
|
||||||
$this->isKilled = true;
|
$this->isKilled = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user