mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
and more typehints
This commit is contained in:
@ -29,14 +29,15 @@ namespace pocketmine\network\upnp;
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
abstract class UPnP{
|
||||
public static function PortForward($port){
|
||||
|
||||
public static function PortForward(int $port) : bool{
|
||||
if(Utils::$online === false){
|
||||
return false;
|
||||
}
|
||||
if(Utils::getOS() != "win" or !class_exists("COM")){
|
||||
return false;
|
||||
}
|
||||
$port = (int) $port;
|
||||
|
||||
$myLocalIP = gethostbyname(trim(`hostname`));
|
||||
try{
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
@ -54,14 +55,14 @@ abstract class UPnP{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function RemovePortForward($port){
|
||||
public static function RemovePortForward(int $port) : bool{
|
||||
if(Utils::$online === false){
|
||||
return false;
|
||||
}
|
||||
if(Utils::getOS() != "win" or !class_exists("COM")){
|
||||
return false;
|
||||
}
|
||||
$port = (int) $port;
|
||||
|
||||
try{
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
$com = new \COM("HNetCfg.NATUPnP") or false;
|
||||
|
Reference in New Issue
Block a user