From 495bfda044dd074d6abf16a9ab6c71d3cab30f60 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 5 Feb 2020 20:53:54 +0000 Subject: [PATCH] Drop a bunch of invalid null defaults phpstan doesn't report these out of the box, for reasons I'm not clear on. It's also not clear if having null defaults has any effect on nullability behaviour, so they are best removed. In addition, these would be problematic on 7.4. --- src/pocketmine/Player.php | 4 ++-- src/pocketmine/Server.php | 18 +++++++++--------- src/pocketmine/block/BlockFactory.php | 16 ++++++++-------- src/pocketmine/item/ItemFactory.php | 2 +- src/pocketmine/level/Level.php | 2 +- .../network/mcpe/protocol/PacketPool.php | 2 +- src/pocketmine/permission/BanEntry.php | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index c204496f4..c498cebee 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -286,7 +286,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ /** @var PlayerCursorInventory */ protected $cursorInventory; /** @var CraftingGrid */ - protected $craftingGrid = null; + protected $craftingGrid; /** @var CraftingTransaction|null */ protected $craftingTransaction = null; @@ -348,7 +348,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ protected $flying = false; /** @var PermissibleBase */ - private $perm = null; + private $perm; /** @var int|null */ protected $lineHeight = null; diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index ca8087f86..a32f67086 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -193,16 +193,16 @@ class Server{ private $tickSleeper; /** @var BanList */ - private $banByName = null; + private $banByName; /** @var BanList */ - private $banByIP = null; + private $banByIP; /** @var Config */ - private $operators = null; + private $operators; /** @var Config */ - private $whitelist = null; + private $whitelist; /** @var bool */ private $isRunning = true; @@ -211,13 +211,13 @@ class Server{ private $hasStopped = false; /** @var PluginManager */ - private $pluginManager = null; + private $pluginManager; /** @var float */ private $profilingTickRate = 20; /** @var AutoUpdater */ - private $updater = null; + private $updater; /** @var AsyncPool */ private $asyncPool; @@ -255,10 +255,10 @@ class Server{ private $memoryManager; /** @var CommandReader */ - private $console = null; + private $console; /** @var SimpleCommandMap */ - private $commandMap = null; + private $commandMap; /** @var CraftingManager */ private $craftingManager; @@ -324,7 +324,7 @@ class Server{ private $queryHandler = null; /** @var QueryRegenerateEvent */ - private $queryRegenerateTask = null; + private $queryRegenerateTask; /** @var Config */ private $properties; diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index 68f42ea11..6e99fcf6d 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -33,22 +33,22 @@ use function min; */ class BlockFactory{ /** @var \SplFixedArray */ - private static $fullList = null; + private static $fullList; /** @var \SplFixedArray */ - public static $solid = null; + public static $solid; /** @var \SplFixedArray */ - public static $transparent = null; + public static $transparent; /** @var \SplFixedArray */ - public static $hardness = null; + public static $hardness; /** @var \SplFixedArray */ - public static $light = null; + public static $light; /** @var \SplFixedArray */ - public static $lightFilter = null; + public static $lightFilter; /** @var \SplFixedArray */ - public static $diffusesSkyLight = null; + public static $diffusesSkyLight; /** @var \SplFixedArray */ - public static $blastResistance = null; + public static $blastResistance; /** * Initializes the block factory. By default this is called only once on server start, however you may wish to use diff --git a/src/pocketmine/item/ItemFactory.php b/src/pocketmine/item/ItemFactory.php index ed9e969d4..0f933fd9c 100644 --- a/src/pocketmine/item/ItemFactory.php +++ b/src/pocketmine/item/ItemFactory.php @@ -47,7 +47,7 @@ class ItemFactory{ * @var \SplFixedArray * @phpstan-var \SplFixedArray */ - private static $list = null; + private static $list; /** * @return void diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 922916b4f..fa6201145 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -265,7 +265,7 @@ class Level implements ChunkManager, Metadatable{ /** @var bool */ private $clearChunksOnTick; /** @var \SplFixedArray */ - private $randomTickBlocks = null; + private $randomTickBlocks; /** @var LevelTimings */ public $timings; diff --git a/src/pocketmine/network/mcpe/protocol/PacketPool.php b/src/pocketmine/network/mcpe/protocol/PacketPool.php index cb4b919f4..3c8e3610e 100644 --- a/src/pocketmine/network/mcpe/protocol/PacketPool.php +++ b/src/pocketmine/network/mcpe/protocol/PacketPool.php @@ -28,7 +28,7 @@ use pocketmine\utils\BinaryDataException; class PacketPool{ /** @var \SplFixedArray */ - protected static $pool = null; + protected static $pool; /** * @return void diff --git a/src/pocketmine/permission/BanEntry.php b/src/pocketmine/permission/BanEntry.php index ddda2f511..d67399925 100644 --- a/src/pocketmine/permission/BanEntry.php +++ b/src/pocketmine/permission/BanEntry.php @@ -38,7 +38,7 @@ class BanEntry{ /** @var string */ private $name; /** @var \DateTime */ - private $creationDate = null; + private $creationDate; /** @var string */ private $source = "(Unknown)"; /** @var \DateTime|null */