From 86fc33fe265619b480e4a31c35da1e64cb9d4096 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 6 Feb 2020 14:20:19 +0000 Subject: [PATCH] Level: add phpstan generics to getNearestEntity() --- src/pocketmine/level/Level.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index fa6201145..e03f791da 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2026,8 +2026,11 @@ class Level implements ChunkManager, Metadatable{ * * @param string $entityType Class of entity to use for instanceof * @param bool $includeDead Whether to include entitites which are dead + * @phpstan-template TEntity of Entity + * @phpstan-param class-string $entityType * * @return Entity|null an entity of type $entityType, or null if not found + * @phpstan-return TEntity */ public function getNearestEntity(Vector3 $pos, float $maxDistance, string $entityType = Entity::class, bool $includeDead = false) : ?Entity{ assert(is_a($entityType, Entity::class, true)); @@ -2039,7 +2042,10 @@ class Level implements ChunkManager, Metadatable{ $currentTargetDistSq = $maxDistance ** 2; - /** @var Entity|null $currentTarget */ + /** + * @var Entity|null $currentTarget + * @phpstan-var TEntity|null $currentTarget + */ $currentTarget = null; for($x = $minX; $x <= $maxX; ++$x){