and more typehints

This commit is contained in:
Dylan K. Taylor
2017-07-14 10:56:51 +01:00
parent b9355387da
commit c3b8be3f60
119 changed files with 598 additions and 541 deletions

View File

@ -100,7 +100,7 @@ abstract class Command{
*
* @return array
*/
public function generateCustomCommandData(Player $player){
public function generateCustomCommandData(Player $player) : array{
//TODO: fix command permission filtering on join
/*if(!$this->testPermissionSilent($player)){
return null;
@ -202,7 +202,7 @@ abstract class Command{
return $this->label;
}
public function setLabel(string $name){
public function setLabel(string $name) : bool{
$this->nextLabel = $name;
if(!$this->isRegistered()){
if($this->timings instanceof TimingsHandler){

View File

@ -47,7 +47,7 @@ interface CommandMap{
*
* @return bool
*/
public function dispatch(CommandSender $sender, $cmdLine);
public function dispatch(CommandSender $sender, string $cmdLine) : bool;
/**
* @return void

View File

@ -31,7 +31,6 @@ use pocketmine\permission\PermissionAttachmentInfo;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
use pocketmine\utils\MainLogger;
use pocketmine\utils\Terminal;
class ConsoleCommandSender implements CommandSender{
@ -49,7 +48,7 @@ class ConsoleCommandSender implements CommandSender{
*
* @return bool
*/
public function isPermissionSet($name){
public function isPermissionSet($name) : bool{
return $this->perm->isPermissionSet($name);
}
@ -58,7 +57,7 @@ class ConsoleCommandSender implements CommandSender{
*
* @return bool
*/
public function hasPermission($name){
public function hasPermission($name) : bool{
return $this->perm->hasPermission($name);
}
@ -89,14 +88,14 @@ class ConsoleCommandSender implements CommandSender{
/**
* @return PermissionAttachmentInfo[]
*/
public function getEffectivePermissions(){
public function getEffectivePermissions() : array{
return $this->perm->getEffectivePermissions();
}
/**
* @return bool
*/
public function isPlayer(){
public function isPlayer() : bool{
return false;
}
@ -132,14 +131,14 @@ class ConsoleCommandSender implements CommandSender{
/**
* @return bool
*/
public function isOp(){
public function isOp() : bool{
return true;
}
/**
* @param bool $value
*/
public function setOp($value){
public function setOp(bool $value){
}

View File

@ -207,7 +207,7 @@ class SimpleCommandMap implements CommandMap{
return null;
}
public function dispatch(CommandSender $sender, $commandLine){
public function dispatch(CommandSender $sender, string $commandLine) : bool{
$args = explode(" ", $commandLine);
$sentCommandLabel = "";
$target = $this->matchCommand($sentCommandLabel, $args);
@ -248,7 +248,7 @@ class SimpleCommandMap implements CommandMap{
/**
* @return Command[]
*/
public function getCommands(){
public function getCommands() : array{
return $this->knownCommands;
}

View File

@ -25,7 +25,6 @@ namespace pocketmine\command\defaults;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\event\TranslationContainer;
use pocketmine\utils\TextFormat;