Improve PHPDocs in world package

This commit is contained in:
Dylan K. Taylor
2025-01-06 22:46:16 +00:00
parent c5a1c15389
commit b6bd3ef30c
6 changed files with 24 additions and 10 deletions

View File

@ -1562,6 +1562,7 @@ class World implements ChunkManager{
* Larger AABBs (>= 2 blocks on any axis) are not accounted for.
*
* @return AxisAlignedBB[]
* @phpstan-return list<AxisAlignedBB>
*/
private function getBlockCollisionBoxesForCell(int $x, int $y, int $z) : array{
$block = $this->getBlockAt($x, $y, $z);
@ -2040,7 +2041,6 @@ class World implements ChunkManager{
* @phpstan-return list<ExperienceOrb>
*/
public function dropExperience(Vector3 $pos, int $amount) : array{
/** @var ExperienceOrb[] $orbs */
$orbs = [];
foreach(ExperienceOrb::splitIntoOrbSizes($amount) as $split){
@ -3083,6 +3083,7 @@ class World implements ChunkManager{
* @phpstan-return Promise<Position>
*/
public function requestSafeSpawn(?Vector3 $spawn = null) : Promise{
/** @phpstan-var PromiseResolver<Position> $resolver */
$resolver = new PromiseResolver();
$spawn ??= $this->getSpawnLocation();
/*
@ -3254,6 +3255,7 @@ class World implements ChunkManager{
private function enqueuePopulationRequest(int $chunkX, int $chunkZ, ?ChunkLoader $associatedChunkLoader) : Promise{
$chunkHash = World::chunkHash($chunkX, $chunkZ);
$this->addChunkHashToPopulationRequestQueue($chunkHash);
/** @phpstan-var PromiseResolver<Chunk> $resolver */
$resolver = $this->chunkPopulationRequestMap[$chunkHash] = new PromiseResolver();
if($associatedChunkLoader === null){
$temporaryLoader = new class implements ChunkLoader{};