From 40d49b88dd24c23937bc9311897f7549492143fc Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 17 Aug 2020 13:20:34 +0100 Subject: [PATCH] EntityFactory: remove requirement for $className as return type on creation funcs since the removal of EntityFactory::create() this isn't needed anymore, since these creation functions are only used for creating entities loaded from disk. --- src/entity/EntityFactory.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/entity/EntityFactory.php b/src/entity/EntityFactory.php index a032c088f..060e152da 100644 --- a/src/entity/EntityFactory.php +++ b/src/entity/EntityFactory.php @@ -161,12 +161,11 @@ final class EntityFactory{ } /** - * @phpstan-param class-string $baseClass * @phpstan-param \Closure(World, CompoundTag) : Entity $creationFunc */ - private static function validateCreationFunc(string $baseClass, \Closure $creationFunc) : void{ + private static function validateCreationFunc(\Closure $creationFunc) : void{ $sig = new CallbackType( - new ReturnType($baseClass), + new ReturnType(Entity::class), new ParameterType("world", World::class), new ParameterType("nbt", CompoundTag::class) ); @@ -193,7 +192,7 @@ final class EntityFactory{ throw new \InvalidArgumentException("At least one save name must be provided"); } Utils::testValidInstance($className, Entity::class); - self::validateCreationFunc($className, $creationFunc); + self::validateCreationFunc($creationFunc); foreach($saveNames as $name){ $this->creationFuncs[$name] = $creationFunc;