diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 05ae682a4..4432a58a2 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -477,7 +477,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, return $this->lineHeight ?? 7; } - public function setScreenLineHeight(int $height = null){ + public function setScreenLineHeight(?int $height){ if($height !== null and $height < 1){ throw new \InvalidArgumentException("Line height must be at least 1"); } diff --git a/src/pocketmine/command/Command.php b/src/pocketmine/command/Command.php index 2f47e2029..0cea12cd9 100644 --- a/src/pocketmine/command/Command.php +++ b/src/pocketmine/command/Command.php @@ -115,7 +115,7 @@ abstract class Command{ /** * @param string|null $permission */ - public function setPermission(string $permission = null){ + public function setPermission(?string $permission){ $this->permission = $permission; } diff --git a/src/pocketmine/command/CommandSender.php b/src/pocketmine/command/CommandSender.php index 97fed1b29..027a1a5cf 100644 --- a/src/pocketmine/command/CommandSender.php +++ b/src/pocketmine/command/CommandSender.php @@ -57,5 +57,5 @@ interface CommandSender extends Permissible{ * * @param int|null $height */ - public function setScreenLineHeight(int $height = null); + public function setScreenLineHeight(?int $height); } diff --git a/src/pocketmine/command/ConsoleCommandSender.php b/src/pocketmine/command/ConsoleCommandSender.php index 32c422a9c..119c55fef 100644 --- a/src/pocketmine/command/ConsoleCommandSender.php +++ b/src/pocketmine/command/ConsoleCommandSender.php @@ -142,7 +142,7 @@ class ConsoleCommandSender implements CommandSender{ return $this->lineHeight ?? PHP_INT_MAX; } - public function setScreenLineHeight(int $height = null){ + public function setScreenLineHeight(?int $height){ if($height !== null and $height < 1){ throw new \InvalidArgumentException("Line height must be at least 1"); } diff --git a/src/pocketmine/level/ChunkManager.php b/src/pocketmine/level/ChunkManager.php index 2e669253b..b53996cbc 100644 --- a/src/pocketmine/level/ChunkManager.php +++ b/src/pocketmine/level/ChunkManager.php @@ -106,7 +106,7 @@ interface ChunkManager{ * @param int $chunkZ * @param Chunk|null $chunk */ - public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null); + public function setChunk(int $chunkX, int $chunkZ, ?Chunk $chunk); /** * Returns the height of the world diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index cb465faef..61b5cb868 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2303,7 +2303,7 @@ class Level implements ChunkManager, Metadatable{ * @param Chunk|null $chunk * @param bool $deleteEntitiesAndTiles Whether to delete entities and tiles on the old chunk, or transfer them to the new one */ - public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null, bool $deleteEntitiesAndTiles = true){ + public function setChunk(int $chunkX, int $chunkZ, ?Chunk $chunk, bool $deleteEntitiesAndTiles = true){ if($chunk === null){ return; } diff --git a/src/pocketmine/level/Position.php b/src/pocketmine/level/Position.php index 0be7137a9..b1de803ae 100644 --- a/src/pocketmine/level/Position.php +++ b/src/pocketmine/level/Position.php @@ -79,7 +79,7 @@ class Position extends Vector3{ * * @throws \InvalidArgumentException if the specified Level has been closed */ - public function setLevel(Level $level = null){ + public function setLevel(?Level $level){ if($level !== null and $level->isClosed()){ throw new \InvalidArgumentException("Specified world has been unloaded and cannot be used"); } diff --git a/src/pocketmine/level/SimpleChunkManager.php b/src/pocketmine/level/SimpleChunkManager.php index 93512944d..a51452cef 100644 --- a/src/pocketmine/level/SimpleChunkManager.php +++ b/src/pocketmine/level/SimpleChunkManager.php @@ -102,7 +102,7 @@ class SimpleChunkManager implements ChunkManager{ * @param int $chunkZ * @param Chunk|null $chunk */ - public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null){ + public function setChunk(int $chunkX, int $chunkZ, ?Chunk $chunk){ if($chunk === null){ unset($this->chunks[Level::chunkHash($chunkX, $chunkZ)]); return; diff --git a/src/pocketmine/level/format/Chunk.php b/src/pocketmine/level/format/Chunk.php index 38799b060..9939cc59d 100644 --- a/src/pocketmine/level/format/Chunk.php +++ b/src/pocketmine/level/format/Chunk.php @@ -696,7 +696,7 @@ class Chunk{ * * @return bool */ - public function setSubChunk(int $y, SubChunkInterface $subChunk = null, bool $allowEmpty = false) : bool{ + public function setSubChunk(int $y, ?SubChunkInterface $subChunk, bool $allowEmpty = false) : bool{ if($y < 0 or $y >= $this->height){ return false; } diff --git a/src/pocketmine/permission/BanEntry.php b/src/pocketmine/permission/BanEntry.php index 80aae0c6e..cb64d7e7c 100644 --- a/src/pocketmine/permission/BanEntry.php +++ b/src/pocketmine/permission/BanEntry.php @@ -90,7 +90,7 @@ class BanEntry{ * @param \DateTime|null $date * @throws \InvalidArgumentException */ - public function setExpires(\DateTime $date = null){ + public function setExpires(?\DateTime $date){ if($date !== null){ self::validateDate($date); } diff --git a/src/pocketmine/permission/PermissionAttachmentInfo.php b/src/pocketmine/permission/PermissionAttachmentInfo.php index 198f21bbf..418edfb81 100644 --- a/src/pocketmine/permission/PermissionAttachmentInfo.php +++ b/src/pocketmine/permission/PermissionAttachmentInfo.php @@ -45,7 +45,7 @@ class PermissionAttachmentInfo{ * * @throws \InvalidStateException */ - public function __construct(Permissible $permissible, string $permission, PermissionAttachment $attachment = null, bool $value){ + public function __construct(Permissible $permissible, string $permission, ?PermissionAttachment $attachment, bool $value){ $this->permissible = $permissible; $this->permission = $permission; $this->attachment = $attachment; diff --git a/src/pocketmine/scheduler/Task.php b/src/pocketmine/scheduler/Task.php index c5851b587..af7d0c50d 100644 --- a/src/pocketmine/scheduler/Task.php +++ b/src/pocketmine/scheduler/Task.php @@ -55,7 +55,7 @@ abstract class Task{ /** * @param TaskHandler|null $taskHandler */ - final public function setHandler(TaskHandler $taskHandler = null){ + final public function setHandler(?TaskHandler $taskHandler){ if($this->taskHandler === null or $taskHandler === null){ $this->taskHandler = $taskHandler; } diff --git a/src/pocketmine/tile/ItemFrame.php b/src/pocketmine/tile/ItemFrame.php index da6d3792f..cd75daeaf 100644 --- a/src/pocketmine/tile/ItemFrame.php +++ b/src/pocketmine/tile/ItemFrame.php @@ -68,7 +68,7 @@ class ItemFrame extends Spawnable{ return clone $this->item; } - public function setItem(Item $item = null){ + public function setItem(?Item $item){ if($item !== null and !$item->isNull()){ $this->item = clone $item; }else{