From 60154d81278533bde2f2bc6b8232ec06b5cda424 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 4 Dec 2019 18:26:18 +0000 Subject: [PATCH] SubChunkIteratorManager: assert type of subchunk to make PHPStan happy we know this should be a SubChunk, even though it doesn't. --- src/world/utils/SubChunkIteratorManager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/world/utils/SubChunkIteratorManager.php b/src/world/utils/SubChunkIteratorManager.php index 6a54ccb8d..c79199658 100644 --- a/src/world/utils/SubChunkIteratorManager.php +++ b/src/world/utils/SubChunkIteratorManager.php @@ -71,7 +71,9 @@ class SubChunkIteratorManager{ return false; } - $this->currentSubChunk = $this->currentChunk->getSubChunk($y >> 4); + $newSubChunk = $this->currentChunk->getSubChunk($y >> 4); + assert($newSubChunk instanceof SubChunk, "chunk inside valid bounds should always be a SubChunk instance"); + $this->currentSubChunk = $newSubChunk; if($this->onSubChunkChangeFunc !== null){ ($this->onSubChunkChangeFunc)(); }