ChestInventory: document that getHolder() may return Position

there is a variance issue with EnderChestInventory that was detected by phpstan-strict-rules which can't be addressed without a BC break. This fix will at least allow static analysers to be aware that code using this function might catch fire when it sees an EnderChestInventory without realizing it.
This commit is contained in:
Dylan K. Taylor 2020-02-06 19:22:27 +00:00
parent a1622fa345
commit 4e693e91e6
2 changed files with 4 additions and 2 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\inventory;
use pocketmine\level\Position;
use pocketmine\network\mcpe\protocol\BlockEventPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\network\mcpe\protocol\types\WindowTypes;
@ -53,7 +54,7 @@ class ChestInventory extends ContainerInventory{
/**
* This override is here for documentation and code completion purposes only.
* @return Chest
* @return Chest|Position
*/
public function getHolder(){
return $this->holder;

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\inventory;
use pocketmine\item\Item;
use pocketmine\level\Position;
use pocketmine\Player;
use pocketmine\tile\Chest;
use function array_merge;
@ -56,7 +57,7 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
}
/**
* @return Chest
* @return Chest|Position
*/
public function getHolder(){
return $this->left->getHolder();