HungerManager: use AttributeMap->mustGet()

fixes 2 errors on phpstan level 8
This commit is contained in:
Dylan K. Taylor 2020-06-27 01:20:03 +01:00
parent 7e391a8123
commit 3c1b8b83f5
2 changed files with 1 additions and 11 deletions

View File

@ -57,7 +57,7 @@ class HungerManager{
}
private static function fetchAttribute(Entity $entity, string $attributeId) : Attribute{
$attribute = AttributeFactory::getInstance()->get($attributeId);
$attribute = AttributeFactory::getInstance()->mustGet($attributeId);
$entity->getAttributeMap()->add($attribute);
return $attribute;
}

View File

@ -130,16 +130,6 @@ parameters:
count: 1
path: ../../../src/entity/Entity.php
-
message: "#^Parameter \\#1 \\$attribute of method pocketmine\\\\entity\\\\AttributeMap\\:\\:add\\(\\) expects pocketmine\\\\entity\\\\Attribute, pocketmine\\\\entity\\\\Attribute\\|null given\\.$#"
count: 1
path: ../../../src/entity/HungerManager.php
-
message: "#^Method pocketmine\\\\entity\\\\HungerManager\\:\\:fetchAttribute\\(\\) should return pocketmine\\\\entity\\\\Attribute but returns pocketmine\\\\entity\\\\Attribute\\|null\\.$#"
count: 1
path: ../../../src/entity/HungerManager.php
-
message: "#^Cannot call method getEffectLevel\\(\\) on pocketmine\\\\entity\\\\effect\\\\EffectInstance\\|null\\.$#"
count: 3