Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typehints for ALPHA7 #83

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/HereAuth/Command/HereAuthCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public function getMessage(string $key, string $default) : string{
/**
* @return HereAuth
*/
public function getPlugin(){
public function getPlugin() : \pocketmine\plugin\Plugin {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why FQN?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it

return $this->main;
}

public final function execute(CommandSender $sender, $commandLabel, array $args){
public final function execute(CommandSender $sender, string $commandLabel, array $args) : bool{
try{
if(!$this->testPermission($sender)){
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/HereAuth/Command/HereAuthUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use pocketmine\Player;

abstract class HereAuthUserCommand extends HereAuthCommand{
public function testPermissionSilent(CommandSender $target){
public function testPermissionSilent(CommandSender $target) : bool{
if(!parent::testPermissionSilent($target)){
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/HereAuth/Task/CheckImportThreadTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(HereAuth $main){
parent::__construct($this->main = $main);
}

public function onRun($currentTick){
public function onRun(int $currentTick){
$this->main->checkThread();
}
}
2 changes: 1 addition & 1 deletion src/HereAuth/Task/CheckUserTimeoutTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(HereAuth $main){
$this->main->getServer()->getScheduler()->scheduleRepeatingTask($this, 20);
}

public function onRun($currentTick){
public function onRun(int $currentTick){
foreach($this->main->getUsers() as $user){
if(!$user->isPlaying() and microtime(true) - $user->getLoadTime() >= ($timeout = $this->main->getConfig()->getNested("Login.Timeout", 120))){
$this->main->getAuditLogger()->logTimeout(strtolower($user->getPlayer()->getName()), $user->getPlayer()->getAddress());
Expand Down
2 changes: 1 addition & 1 deletion src/HereAuth/Task/KickPlayerTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(HereAuth $main, $identifier, $reason){
$this->reason = $reason;
}

public function onRun($currentTick){
public function onRun(int $currentTick){
$player = $this->main->getPlayerById($this->identifier);
if($player !== null){
$player->kick($this->reason, false);
Expand Down
2 changes: 1 addition & 1 deletion src/HereAuth/Task/RemindLoginTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(HereAuth $main){
$main->getServer()->getScheduler()->scheduleDelayedRepeatingTask($this, $period, $period);
}

public function onRun($currentTick){
public function onRun(int $currentTick){
$reg = $this->main->getConfig()->getNested("RemindLogin.Message.Register", "Register please");
$log = $this->main->getConfig()->getNested("RemindLogin.Message.Login", "Login please");
if($this->type === "chat"){
Expand Down