diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 4432a58a2d..7906844819 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -609,7 +609,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, * * @return PermissionAttachment */ - public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{ + public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment{ return $this->perm->addAttachment($plugin, $name, $value); } @@ -910,7 +910,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, return false; } - protected function unloadChunk(int $x, int $z, Level $level = null){ + protected function unloadChunk(int $x, int $z, ?Level $level = null){ $level = $level ?? $this->level; $index = Level::chunkHash($x, $z); if(isset($this->usedChunks[$index])){ @@ -3132,7 +3132,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, return $result; } - public function sendPosition(Vector3 $pos, float $yaw = null, float $pitch = null, int $mode = MovePlayerPacket::MODE_NORMAL, array $targets = null){ + public function sendPosition(Vector3 $pos, ?float $yaw = null, ?float $pitch = null, int $mode = MovePlayerPacket::MODE_NORMAL, ?array $targets = null){ $yaw = $yaw ?? $this->yaw; $pitch = $pitch ?? $this->pitch; @@ -3156,7 +3156,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, /** * {@inheritdoc} */ - public function teleport(Vector3 $pos, float $yaw = null, float $pitch = null) : bool{ + public function teleport(Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : bool{ if(parent::teleport($pos, $yaw, $pitch)){ $this->removeAllWindows(); @@ -3298,7 +3298,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, * @throws \InvalidArgumentException if a forceID which is already in use is specified * @throws \InvalidStateException if trying to add a window without forceID when no slots are free */ - public function addWindow(Inventory $inventory, int $forceId = null, bool $isPermanent = false) : int{ + public function addWindow(Inventory $inventory, ?int $forceId = null, bool $isPermanent = false) : int{ if(($id = $this->getWindowId($inventory)) !== ContainerIds::NONE){ return $id; } diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 12bf3f5225..10d8302fc4 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1333,7 +1333,7 @@ class Server{ * * @return int */ - public function broadcastMessage($message, array $recipients = null) : int{ + public function broadcastMessage($message, ?array $recipients = null) : int{ if(!is_array($recipients)){ return $this->broadcast($message, self::BROADCAST_CHANNEL_USERS); } @@ -1363,7 +1363,7 @@ class Server{ * * @return int */ - public function broadcastTip(string $tip, array $recipients = null) : int{ + public function broadcastTip(string $tip, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); /** @var Player[] $recipients */ @@ -1380,7 +1380,7 @@ class Server{ * * @return int */ - public function broadcastPopup(string $popup, array $recipients = null) : int{ + public function broadcastPopup(string $popup, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); /** @var Player[] $recipients */ @@ -1401,7 +1401,7 @@ class Server{ * * @return int */ - public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, array $recipients = null) : int{ + public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); /** @var Player[] $recipients */ @@ -1916,7 +1916,7 @@ class Server{ * @param string $xboxUserId * @param Player[]|null $players */ - public function updatePlayerListData(UUID $uuid, int $entityId, string $name, Skin $skin, string $xboxUserId = "", array $players = null){ + public function updatePlayerListData(UUID $uuid, int $entityId, string $name, Skin $skin, string $xboxUserId = "", ?array $players = null){ $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_ADD; @@ -1929,7 +1929,7 @@ class Server{ * @param UUID $uuid * @param Player[]|null $players */ - public function removePlayerListData(UUID $uuid, array $players = null){ + public function removePlayerListData(UUID $uuid, ?array $players = null){ $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_REMOVE; $pk->entries[] = PlayerListEntry::createRemovalEntry($uuid); diff --git a/src/pocketmine/Thread.php b/src/pocketmine/Thread.php index 347ec62bcd..a51ba123f9 100644 --- a/src/pocketmine/Thread.php +++ b/src/pocketmine/Thread.php @@ -39,7 +39,7 @@ abstract class Thread extends \Thread{ return $this->classLoader; } - public function setClassLoader(\ClassLoader $loader = null){ + public function setClassLoader(?\ClassLoader $loader = null){ $this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH; if($loader === null){ diff --git a/src/pocketmine/Worker.php b/src/pocketmine/Worker.php index f4018ea48f..ee62a05400 100644 --- a/src/pocketmine/Worker.php +++ b/src/pocketmine/Worker.php @@ -39,7 +39,7 @@ abstract class Worker extends \Worker{ return $this->classLoader; } - public function setClassLoader(\ClassLoader $loader = null){ + public function setClassLoader(?\ClassLoader $loader = null){ $this->composerAutoloaderPath = \pocketmine\COMPOSER_AUTOLOADER_PATH; if($loader === null){ diff --git a/src/pocketmine/command/Command.php b/src/pocketmine/command/Command.php index 0cea12cd9b..02ab7989ae 100644 --- a/src/pocketmine/command/Command.php +++ b/src/pocketmine/command/Command.php @@ -79,7 +79,7 @@ abstract class Command{ * @param string $usageMessage * @param string[] $aliases */ - public function __construct(string $name, string $description = "", string $usageMessage = null, array $aliases = []){ + public function __construct(string $name, string $description = "", ?string $usageMessage = null, array $aliases = []){ $this->name = $name; $this->setLabel($name); $this->setDescription($description); diff --git a/src/pocketmine/command/CommandMap.php b/src/pocketmine/command/CommandMap.php index 837d6e2bdb..9583b4e83a 100644 --- a/src/pocketmine/command/CommandMap.php +++ b/src/pocketmine/command/CommandMap.php @@ -39,7 +39,7 @@ interface CommandMap{ * * @return bool */ - public function register(string $fallbackPrefix, Command $command, string $label = null) : bool; + public function register(string $fallbackPrefix, Command $command, ?string $label = null) : bool; /** * @param CommandSender $sender diff --git a/src/pocketmine/command/ConsoleCommandSender.php b/src/pocketmine/command/ConsoleCommandSender.php index 119c55fef2..8db5aa74db 100644 --- a/src/pocketmine/command/ConsoleCommandSender.php +++ b/src/pocketmine/command/ConsoleCommandSender.php @@ -71,7 +71,7 @@ class ConsoleCommandSender implements CommandSender{ * * @return PermissionAttachment */ - public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{ + public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment{ return $this->perm->addAttachment($plugin, $name, $value); } diff --git a/src/pocketmine/command/SimpleCommandMap.php b/src/pocketmine/command/SimpleCommandMap.php index d7296f82f8..523089d658 100644 --- a/src/pocketmine/command/SimpleCommandMap.php +++ b/src/pocketmine/command/SimpleCommandMap.php @@ -151,7 +151,7 @@ class SimpleCommandMap implements CommandMap{ * * @return bool */ - public function register(string $fallbackPrefix, Command $command, string $label = null) : bool{ + public function register(string $fallbackPrefix, Command $command, ?string $label = null) : bool{ if($label === null){ $label = $command->getName(); } diff --git a/src/pocketmine/command/defaults/ParticleCommand.php b/src/pocketmine/command/defaults/ParticleCommand.php index 12b939eb39..c9ea96da11 100644 --- a/src/pocketmine/command/defaults/ParticleCommand.php +++ b/src/pocketmine/command/defaults/ParticleCommand.php @@ -141,7 +141,7 @@ class ParticleCommand extends VanillaCommand{ * * @return Particle|null */ - private function getParticle(string $name, int $data = null){ + private function getParticle(string $name, ?int $data = null){ switch($name){ case "explode": return new ExplodeParticle(); diff --git a/src/pocketmine/event/entity/EntityEffectAddEvent.php b/src/pocketmine/event/entity/EntityEffectAddEvent.php index a42747f75f..d8f5633576 100644 --- a/src/pocketmine/event/entity/EntityEffectAddEvent.php +++ b/src/pocketmine/event/entity/EntityEffectAddEvent.php @@ -38,7 +38,7 @@ class EntityEffectAddEvent extends EntityEffectEvent{ * @param EffectInstance $effect * @param EffectInstance $oldEffect */ - public function __construct(Entity $entity, EffectInstance $effect, EffectInstance $oldEffect = null){ + public function __construct(Entity $entity, EffectInstance $effect, ?EffectInstance $oldEffect = null){ parent::__construct($entity, $effect); $this->oldEffect = $oldEffect; } diff --git a/src/pocketmine/event/player/PlayerChatEvent.php b/src/pocketmine/event/player/PlayerChatEvent.php index b12fa0858a..ca54c1a5d1 100644 --- a/src/pocketmine/event/player/PlayerChatEvent.php +++ b/src/pocketmine/event/player/PlayerChatEvent.php @@ -52,7 +52,7 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{ * @param string $format * @param Player[] $recipients */ - public function __construct(Player $player, string $message, string $format = "chat.type.text", array $recipients = null){ + public function __construct(Player $player, string $message, string $format = "chat.type.text", ?array $recipients = null){ $this->player = $player; $this->message = $message; diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index 974ba3b26d..17fe9e66c8 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -57,7 +57,7 @@ abstract class BaseInventory implements Inventory{ * @param int $size * @param string $title */ - public function __construct(array $items = [], int $size = null, string $title = null){ + public function __construct(array $items = [], ?int $size = null, ?string $title = null){ $this->slots = new \SplFixedArray($size ?? $this->getDefaultSize()); $this->title = $title ?? $this->getName(); diff --git a/src/pocketmine/inventory/ContainerInventory.php b/src/pocketmine/inventory/ContainerInventory.php index 4ede6d8263..b807b0b08f 100644 --- a/src/pocketmine/inventory/ContainerInventory.php +++ b/src/pocketmine/inventory/ContainerInventory.php @@ -33,7 +33,7 @@ abstract class ContainerInventory extends BaseInventory{ /** @var Vector3 */ protected $holder; - public function __construct(Vector3 $holder, array $items = [], int $size = null, string $title = null){ + public function __construct(Vector3 $holder, array $items = [], ?int $size = null, ?string $title = null){ $this->holder = $holder; parent::__construct($items, $size, $title); } diff --git a/src/pocketmine/item/ItemBlock.php b/src/pocketmine/item/ItemBlock.php index a0c4375f58..e88576026b 100644 --- a/src/pocketmine/item/ItemBlock.php +++ b/src/pocketmine/item/ItemBlock.php @@ -38,7 +38,7 @@ class ItemBlock extends Item{ * @param int $meta usually 0-15 (placed blocks may only have meta values 0-15) * @param int|null $itemId */ - public function __construct(int $blockId, int $meta = 0, int $itemId = null){ + public function __construct(int $blockId, int $meta = 0, ?int $itemId = null){ if($blockId < 0){ //extended blocks if($itemId === null){ $itemId = $blockId; diff --git a/src/pocketmine/lang/Language.php b/src/pocketmine/lang/Language.php index 05efd6e5a3..13c1b228f5 100644 --- a/src/pocketmine/lang/Language.php +++ b/src/pocketmine/lang/Language.php @@ -94,7 +94,7 @@ class Language{ * * @throws LanguageNotFoundException */ - public function __construct(string $lang, string $path = null, string $fallback = self::FALLBACK_LANGUAGE){ + public function __construct(string $lang, ?string $path = null, string $fallback = self::FALLBACK_LANGUAGE){ $this->langName = strtolower($lang); if($path === null){ @@ -129,7 +129,7 @@ class Language{ * * @return string */ - public function translateString(string $str, array $params = [], string $onlyPrefix = null) : string{ + public function translateString(string $str, array $params = [], ?string $onlyPrefix = null) : string{ $baseText = $this->get($str); $baseText = $this->parseTranslation(($baseText !== null and ($onlyPrefix === null or strpos($str, $onlyPrefix) === 0)) ? $baseText : $str, $onlyPrefix); @@ -179,7 +179,7 @@ class Language{ * * @return string */ - protected function parseTranslation(string $text, string $onlyPrefix = null) : string{ + protected function parseTranslation(string $text, ?string $onlyPrefix = null) : string{ $newString = ""; $replaceString = null; diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 61b5cb8681..40981b0f17 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -478,7 +478,7 @@ class Level implements ChunkManager, Metadatable{ $this->closed = true; } - public function addSound(Vector3 $pos, Sound $sound, array $players = null){ + public function addSound(Vector3 $pos, Sound $sound, ?array $players = null){ $pk = $sound->encode($pos); if(!is_array($pk)){ $pk = [$pk]; @@ -494,7 +494,7 @@ class Level implements ChunkManager, Metadatable{ } } - public function addParticle(Vector3 $pos, Particle $particle, array $players = null){ + public function addParticle(Vector3 $pos, Particle $particle, ?array $players = null){ $pk = $particle->encode($pos); if(!is_array($pk)){ $pk = [$pk]; @@ -1626,7 +1626,7 @@ class Level implements ChunkManager, Metadatable{ * * @return ItemEntity|null */ - public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, int $delay = 10){ + public function dropItem(Vector3 $source, Item $item, ?Vector3 $motion = null, int $delay = 10){ $motion = $motion ?? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1); $itemTag = $item->nbtSerialize(); $itemTag->setName("Item"); @@ -1686,7 +1686,7 @@ class Level implements ChunkManager, Metadatable{ * * @return bool */ - public function useBreakOn(Vector3 $vector, Item &$item = null, Player $player = null, bool $createParticles = false) : bool{ + public function useBreakOn(Vector3 $vector, Item &$item = null, ?Player $player = null, bool $createParticles = false) : bool{ $target = $this->getBlock($vector); $affectedBlocks = $target->getAffectedBlocks(); @@ -1788,7 +1788,7 @@ class Level implements ChunkManager, Metadatable{ * * @return bool */ - public function useItemOn(Vector3 $vector, Item &$item, int $face, Vector3 $clickVector = null, Player $player = null, bool $playSound = false) : bool{ + public function useItemOn(Vector3 $vector, Item &$item, int $face, ?Vector3 $clickVector = null, ?Player $player = null, bool $playSound = false) : bool{ $blockClicked = $this->getBlock($vector); $blockReplace = $blockClicked->getSide($face); @@ -1928,7 +1928,7 @@ class Level implements ChunkManager, Metadatable{ * * @return Entity[] */ - public function getCollidingEntities(AxisAlignedBB $bb, Entity $entity = null) : array{ + public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{ $nearby = []; if($entity === null or $entity->canCollide){ @@ -1960,7 +1960,7 @@ class Level implements ChunkManager, Metadatable{ * * @return Entity[] */ - public function getNearbyEntities(AxisAlignedBB $bb, Entity $entity = null) : array{ + public function getNearbyEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{ $nearby = []; $minX = ((int) floor($bb->minX - 2)) >> 4; diff --git a/src/pocketmine/level/LevelManager.php b/src/pocketmine/level/LevelManager.php index 2dbbdb1151..6ac55a4163 100644 --- a/src/pocketmine/level/LevelManager.php +++ b/src/pocketmine/level/LevelManager.php @@ -259,7 +259,7 @@ class LevelManager{ * @return bool * @throws \InvalidArgumentException */ - public function generateLevel(string $name, int $seed = null, string $generator = Normal::class, array $options = [], bool $backgroundGeneration = true) : bool{ + public function generateLevel(string $name, ?int $seed = null, string $generator = Normal::class, array $options = [], bool $backgroundGeneration = true) : bool{ if(trim($name) === "" or $this->isLevelGenerated($name)){ return false; } diff --git a/src/pocketmine/level/Location.php b/src/pocketmine/level/Location.php index b24d902421..beb129ef45 100644 --- a/src/pocketmine/level/Location.php +++ b/src/pocketmine/level/Location.php @@ -40,7 +40,7 @@ class Location extends Position{ * @param float $pitch * @param Level $level */ - public function __construct($x = 0, $y = 0, $z = 0, $yaw = 0.0, $pitch = 0.0, Level $level = null){ + public function __construct($x = 0, $y = 0, $z = 0, $yaw = 0.0, $pitch = 0.0, ?Level $level = null){ $this->yaw = $yaw; $this->pitch = $pitch; parent::__construct($x, $y, $z, $level); @@ -54,7 +54,7 @@ class Location extends Position{ * * @return Location */ - public static function fromObject(Vector3 $pos, Level $level = null, $yaw = 0.0, $pitch = 0.0) : Location{ + public static function fromObject(Vector3 $pos, ?Level $level = null, $yaw = 0.0, $pitch = 0.0) : Location{ return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, $level ?? (($pos instanceof Position) ? $pos->level : null)); } diff --git a/src/pocketmine/level/Position.php b/src/pocketmine/level/Position.php index b1de803aeb..a6bb3ef67a 100644 --- a/src/pocketmine/level/Position.php +++ b/src/pocketmine/level/Position.php @@ -37,12 +37,12 @@ class Position extends Vector3{ * @param int $z * @param Level $level */ - public function __construct($x = 0, $y = 0, $z = 0, Level $level = null){ + public function __construct($x = 0, $y = 0, $z = 0, ?Level $level = null){ parent::__construct($x, $y, $z); $this->setLevel($level); } - public static function fromObject(Vector3 $pos, Level $level = null){ + public static function fromObject(Vector3 $pos, ?Level $level = null){ return new Position($pos->x, $pos->y, $pos->z, $level); } diff --git a/src/pocketmine/permission/BanList.php b/src/pocketmine/permission/BanList.php index df849c1c90..82493e1bf2 100644 --- a/src/pocketmine/permission/BanList.php +++ b/src/pocketmine/permission/BanList.php @@ -118,7 +118,7 @@ class BanList{ * * @return BanEntry */ - public function addBan(string $target, string $reason = null, \DateTime $expires = null, string $source = null) : BanEntry{ + public function addBan(string $target, ?string $reason = null, ?\DateTime $expires = null, ?string $source = null) : BanEntry{ $entry = new BanEntry($target); $entry->setSource($source ?? $entry->getSource()); $entry->setExpires($expires); diff --git a/src/pocketmine/permission/DefaultPermissions.php b/src/pocketmine/permission/DefaultPermissions.php index 465f7a7754..015f87d54f 100644 --- a/src/pocketmine/permission/DefaultPermissions.php +++ b/src/pocketmine/permission/DefaultPermissions.php @@ -35,7 +35,7 @@ abstract class DefaultPermissions{ * * @return Permission */ - public static function registerPermission(Permission $perm, Permission $parent = null) : Permission{ + public static function registerPermission(Permission $perm, ?Permission $parent = null) : Permission{ if($parent instanceof Permission){ $parent->getChildren()[$perm->getName()] = true; diff --git a/src/pocketmine/permission/Permissible.php b/src/pocketmine/permission/Permissible.php index 517750cacc..21ebba7b2c 100644 --- a/src/pocketmine/permission/Permissible.php +++ b/src/pocketmine/permission/Permissible.php @@ -52,7 +52,7 @@ interface Permissible extends ServerOperator{ * * @return PermissionAttachment */ - public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment; + public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment; /** * @param PermissionAttachment $attachment diff --git a/src/pocketmine/permission/PermissibleBase.php b/src/pocketmine/permission/PermissibleBase.php index 809d62c756..47b5acfde5 100644 --- a/src/pocketmine/permission/PermissibleBase.php +++ b/src/pocketmine/permission/PermissibleBase.php @@ -111,7 +111,7 @@ class PermissibleBase implements Permissible{ * * @return PermissionAttachment */ - public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{ + public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment{ if(!$plugin->isEnabled()){ throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled"); } diff --git a/src/pocketmine/permission/Permission.php b/src/pocketmine/permission/Permission.php index 9bbd374e56..4759d0666a 100644 --- a/src/pocketmine/permission/Permission.php +++ b/src/pocketmine/permission/Permission.php @@ -60,7 +60,7 @@ class Permission{ * @param string $defaultValue * @param bool[] $children */ - public function __construct(string $name, string $description = null, string $defaultValue = null, array $children = []){ + public function __construct(string $name, ?string $description = null, ?string $defaultValue = null, array $children = []){ $this->name = $name; $this->description = $description ?? ""; $this->defaultValue = $defaultValue ?? self::$DEFAULT_PERMISSION; diff --git a/src/pocketmine/plugin/PluginManager.php b/src/pocketmine/plugin/PluginManager.php index 3e7e1270f5..93f4c4edc6 100644 --- a/src/pocketmine/plugin/PluginManager.php +++ b/src/pocketmine/plugin/PluginManager.php @@ -137,7 +137,7 @@ class PluginManager{ * * @return Plugin|null */ - public function loadPlugin(string $path, array $loaders = null) : ?Plugin{ + public function loadPlugin(string $path, ?array $loaders = null) : ?Plugin{ foreach($loaders ?? $this->fileAssociations as $loader){ if($loader->canLoadPlugin($path)){ $description = $loader->getPluginDescription($path); @@ -193,7 +193,7 @@ class PluginManager{ * * @return Plugin[] */ - public function loadPlugins(string $directory, array $newLoaders = null){ + public function loadPlugins(string $directory, ?array $newLoaders = null){ if(!is_dir($directory)){ return []; } diff --git a/src/pocketmine/timings/TimingsHandler.php b/src/pocketmine/timings/TimingsHandler.php index 102f5466cc..8889e2b142 100644 --- a/src/pocketmine/timings/TimingsHandler.php +++ b/src/pocketmine/timings/TimingsHandler.php @@ -150,7 +150,7 @@ class TimingsHandler{ * @param string $name * @param TimingsHandler $parent */ - public function __construct(string $name, TimingsHandler $parent = null){ + public function __construct(string $name, ?TimingsHandler $parent = null){ $this->name = $name; $this->parent = $parent; diff --git a/src/pocketmine/utils/Internet.php b/src/pocketmine/utils/Internet.php index ebd704bdaa..b7f9ab1cf0 100644 --- a/src/pocketmine/utils/Internet.php +++ b/src/pocketmine/utils/Internet.php @@ -193,7 +193,7 @@ class Internet{ * * @throws InternetException if a cURL error occurs */ - public static function simpleCurl(string $page, $timeout = 10, array $extraHeaders = [], array $extraOpts = [], callable $onSuccess = null){ + public static function simpleCurl(string $page, $timeout = 10, array $extraHeaders = [], array $extraOpts = [], ?callable $onSuccess = null){ if(!self::$online){ throw new InternetException("Cannot execute web request while offline"); } diff --git a/src/pocketmine/utils/UUID.php b/src/pocketmine/utils/UUID.php index 0c21d8a7b8..703d9fdc74 100644 --- a/src/pocketmine/utils/UUID.php +++ b/src/pocketmine/utils/UUID.php @@ -41,7 +41,7 @@ class UUID{ private $parts = [0, 0, 0, 0]; private $version = null; - public function __construct(int $part1 = 0, int $part2 = 0, int $part3 = 0, int $part4 = 0, int $version = null){ + public function __construct(int $part1 = 0, int $part2 = 0, int $part3 = 0, int $part4 = 0, ?int $version = null){ $this->parts = [$part1, $part2, $part3, $part4]; $this->version = $version ?? ($this->parts[1] & 0xf000) >> 12; @@ -63,7 +63,7 @@ class UUID{ * * @return UUID */ - public static function fromString(string $uuid, int $version = null) : UUID{ + public static function fromString(string $uuid, ?int $version = null) : UUID{ return self::fromBinary(hex2bin(str_replace("-", "", trim($uuid))), $version); } @@ -77,7 +77,7 @@ class UUID{ * * @throws \InvalidArgumentException */ - public static function fromBinary(string $uuid, int $version = null) : UUID{ + public static function fromBinary(string $uuid, ?int $version = null) : UUID{ if(strlen($uuid) !== 16){ throw new \InvalidArgumentException("Must have exactly 16 bytes"); }