More nullable and void typehints

This commit is contained in:
Dylan K. Taylor
2019-03-02 10:29:11 +00:00
parent 1f5c901f29
commit 6c8fa8ae28
108 changed files with 392 additions and 384 deletions

View File

@ -39,7 +39,7 @@ abstract class Thread extends \Thread{
return $this->classLoader;
}
public function setClassLoader(?\ClassLoader $loader = null){
public function setClassLoader(?\ClassLoader $loader = null) : void{
$this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH;
if($loader === null){
@ -55,7 +55,7 @@ abstract class Thread extends \Thread{
* 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).
*/
public function registerClassLoader(){
public function registerClassLoader() : void{
if($this->composerAutoloaderPath !== null){
require $this->composerAutoloaderPath;
}
@ -64,7 +64,7 @@ abstract class Thread extends \Thread{
}
}
public function start(?int $options = \PTHREADS_INHERIT_ALL){
public function start(?int $options = \PTHREADS_INHERIT_ALL) : bool{
ThreadManager::getInstance()->add($this);
if($this->getClassLoader() === null){
@ -76,7 +76,7 @@ abstract class Thread extends \Thread{
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit(){
public function quit() : void{
$this->isKilled = true;
if(!$this->isJoined()){