Merge branch 'moar-typehints'

This commit is contained in:
Dylan K. Taylor
2017-07-15 09:43:43 +01:00
176 changed files with 879 additions and 741 deletions

View File

@ -42,7 +42,7 @@ interface SourceInterface{
* @param bool $needACK
* @param bool $immediate
*
* @return int
* @return int|null
*/
public function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = true);

View File

@ -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;