command: populate missing return type info

This commit is contained in:
Dylan K. Taylor 2020-01-19 17:02:55 +00:00
parent ccbcc14600
commit e328d00cca
10 changed files with 37 additions and 4 deletions

View File

@ -114,6 +114,8 @@ abstract class Command{
/** /**
* @param string|null $permission * @param string|null $permission
*
* @return void
*/ */
public function setPermission(string $permission = null){ public function setPermission(string $permission = null){
$this->permission = $permission; $this->permission = $permission;
@ -259,6 +261,8 @@ abstract class Command{
/** /**
* @param string[] $aliases * @param string[] $aliases
*
* @return void
*/ */
public function setAliases(array $aliases){ public function setAliases(array $aliases){
$this->aliases = $aliases; $this->aliases = $aliases;
@ -269,6 +273,8 @@ abstract class Command{
/** /**
* @param string $description * @param string $description
*
* @return void
*/ */
public function setDescription(string $description){ public function setDescription(string $description){
$this->description = $description; $this->description = $description;
@ -276,6 +282,8 @@ abstract class Command{
/** /**
* @param string $permissionMessage * @param string $permissionMessage
*
* @return void
*/ */
public function setPermissionMessage(string $permissionMessage){ public function setPermissionMessage(string $permissionMessage){
$this->permissionMessage = $permissionMessage; $this->permissionMessage = $permissionMessage;
@ -283,6 +291,8 @@ abstract class Command{
/** /**
* @param string $usage * @param string $usage
*
* @return void
*/ */
public function setUsage(string $usage){ public function setUsage(string $usage){
$this->usageMessage = $usage; $this->usageMessage = $usage;
@ -292,6 +302,8 @@ abstract class Command{
* @param CommandSender $source * @param CommandSender $source
* @param TextContainer|string $message * @param TextContainer|string $message
* @param bool $sendToSource * @param bool $sendToSource
*
* @return void
*/ */
public static function broadcastCommandMessage(CommandSender $source, $message, bool $sendToSource = true){ public static function broadcastCommandMessage(CommandSender $source, $message, bool $sendToSource = true){
if($message instanceof TextContainer){ if($message instanceof TextContainer){

View File

@ -29,6 +29,8 @@ interface CommandMap{
/** /**
* @param string $fallbackPrefix * @param string $fallbackPrefix
* @param Command[] $commands * @param Command[] $commands
*
* @return void
*/ */
public function registerAll(string $fallbackPrefix, array $commands); public function registerAll(string $fallbackPrefix, array $commands);

View File

@ -73,6 +73,9 @@ class CommandReader extends Thread{
} }
} }
/**
* @return void
*/
public function shutdown(){ public function shutdown(){
$this->shutdown = true; $this->shutdown = true;
} }
@ -96,7 +99,7 @@ class CommandReader extends Thread{
throw new \ThreadException($message); throw new \ThreadException($message);
} }
private function initStdin(){ private function initStdin() : void{
if(is_resource(self::$stdin)){ if(is_resource(self::$stdin)){
fclose(self::$stdin); fclose(self::$stdin);
} }
@ -187,6 +190,9 @@ class CommandReader extends Thread{
return null; return null;
} }
/**
* @return void
*/
public function run(){ public function run(){
$this->registerClassLoader(); $this->registerClassLoader();

View File

@ -31,6 +31,8 @@ interface CommandSender extends Permissible{
/** /**
* @param TextContainer|string $message * @param TextContainer|string $message
*
* @return void
*/ */
public function sendMessage($message); public function sendMessage($message);
@ -56,6 +58,8 @@ interface CommandSender extends Permissible{
* Sets the line height used for command output pagination for this command sender. `null` will reset it to default. * Sets the line height used for command output pagination for this command sender. `null` will reset it to default.
* *
* @param int|null $height * @param int|null $height
*
* @return void
*/ */
public function setScreenLineHeight(int $height = null); public function setScreenLineHeight(int $height = null);
} }

View File

@ -105,6 +105,8 @@ class ConsoleCommandSender implements CommandSender{
/** /**
* @param TextContainer|string $message * @param TextContainer|string $message
*
* @return void
*/ */
public function sendMessage($message){ public function sendMessage($message){
if($message instanceof TextContainer){ if($message instanceof TextContainer){
@ -134,6 +136,8 @@ class ConsoleCommandSender implements CommandSender{
/** /**
* @param bool $value * @param bool $value
*
* @return void
*/ */
public function setOp(bool $value){ public function setOp(bool $value){

View File

@ -70,6 +70,8 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
/** /**
* @param CommandExecutor $executor * @param CommandExecutor $executor
*
* @return void
*/ */
public function setExecutor(CommandExecutor $executor){ public function setExecutor(CommandExecutor $executor){
$this->executor = $executor; $this->executor = $executor;

View File

@ -41,6 +41,9 @@ class RemoteConsoleCommandSender extends ConsoleCommandSender{
$this->messages .= trim($message, "\r\n") . "\n"; $this->messages .= trim($message, "\r\n") . "\n";
} }
/**
* @return string
*/
public function getMessage(){ public function getMessage(){
return $this->messages; return $this->messages;
} }

View File

@ -92,7 +92,7 @@ class SimpleCommandMap implements CommandMap{
$this->setDefaultCommands(); $this->setDefaultCommands();
} }
private function setDefaultCommands(){ private function setDefaultCommands() : void{
$this->registerAll("pocketmine", [ $this->registerAll("pocketmine", [
new BanCommand("ban"), new BanCommand("ban"),
new BanIpCommand("ban-ip"), new BanIpCommand("ban-ip"),

View File

@ -75,7 +75,7 @@ class BanIpCommand extends VanillaCommand{
return true; return true;
} }
private function processIPBan(string $ip, CommandSender $sender, string $reason){ private function processIPBan(string $ip, CommandSender $sender, string $reason) : void{
$sender->getServer()->getIPBans()->addBan($ip, $reason, null, $sender->getName()); $sender->getServer()->getIPBans()->addBan($ip, $reason, null, $sender->getName());
foreach($sender->getServer()->getOnlinePlayers() as $player){ foreach($sender->getServer()->getOnlinePlayers() as $player){

View File

@ -84,7 +84,7 @@ class VersionCommand extends VanillaCommand{
return true; return true;
} }
private function describeToSender(Plugin $plugin, CommandSender $sender){ private function describeToSender(Plugin $plugin, CommandSender $sender) : void{
$desc = $plugin->getDescription(); $desc = $plugin->getDescription();
$sender->sendMessage(TextFormat::DARK_GREEN . $desc->getName() . TextFormat::WHITE . " version " . TextFormat::DARK_GREEN . $desc->getVersion()); $sender->sendMessage(TextFormat::DARK_GREEN . $desc->getName() . TextFormat::WHITE . " version " . TextFormat::DARK_GREEN . $desc->getVersion());